Storage Scanner Bypasses Mod protections and Server Protections
Venrixia opened this issue ยท 22 comments
Issue description: The storage scanner can be used to access inventories protected by other mods and plugins. Such as grief prevention or even AE2's Security terminal
Steps to reproduce:
Place Storage scanner and power it.
Scan for inventories.
Pull items from protected inventories.
Versions:
- Minecraft: 1.12.2
- Forge: forge-1.12.2-14.23.3.2690
- CompatLayer (only if on Minecraft 1.10 or 1.11):
- McJtyLib: mcjtylib-1.12-2.6.7
- RFTools: rftools-1.12-7.33
Server tested on is running spongeforge-1.12.2-2690-7.1.0-BETA-3110 and uses
griefprevention-1.12.2-4.3.0.573 . Tested on Inventories protected by Grief prevention and inventories only protected with appliedenergistics2-rv5-stable-11
Not sure if this is really considered a bug rather than just how it works, but you can work around this by reducing the maximum radius by a lot or even enabling XNet only mode in the config.
Storage scanner still bypasses multiple mod protections even when using XNET only mode. Tested in SP with :
Forge-14.23.4.2705
appliedenergistics2-rv5-stable-11
industrialcraft-2-2.8.81-ex112
FTBUtilities-5.1.0.24
FTBLib-5.1.0.19
ThermalExpansion-1.12.2-5.5.0.29-universal
ThermalFoundation-1.12.2-2.5.0.18-universal
CoFHCore-1.12.2-4.5.0.16-universal
CoFHWorld-1.12.2-1.2.0.5-universal
And your mod versions
mcjtylib-1.12-2.6.7
rftools-1.12-7.33
xnet-1.12-1.6.9
The storage scanner asks for the inventory from all affected blocks. I have no way of knowing if that's allowed or not. If it is not allowed then it is up to the block itself (or to the plugin) to prevent returning the data. On my side there is nothing that I can do to fix this as I don't have any information about this protection
Standard forge events already provides ways to check if a given entity can access a block. It's up to RFTools to properly call those events.
Hmm what event would that be? I'm not aware of events that check for this kind of thing
The only events that seem related are PlayerInteractEvents but those are not usable as they are meant for player interaction and I don't have a player here
onBlockActivated is also worth a try.
I'll check later tonight for the forge events.
onBlockActivated can have all kinds of side effects (like opening a gui)
Also the boolean return result has nothing to do with it being allowed to access or not
I have no idea... I suspect in the case of SpongeForge they have custom code to prevent those (they are part of vanilla after all). But I really don't know
That can't be right. First that also requires a player (which I don't have, the player isn't doing this, pipes are doing this). Also the comment with this event says:
* HarvestCheck is fired when a player attempts to harvest a block.<br>
* This event is fired whenever a player attempts to harvest a block in
Extracting or inserting items is not the same as harvesting a block
The following blocks can't be emptied by an hopper:
- an IC2 personnal safe
- a TE Strongbox with a Signalum Security Lock upgrade, set to Owner only
=> there's probably a check missing in the inventory access to those
The event name is PlayerEvent.HarvestCheck().
The proper way to use it is to call the block::canHarvest() method.
FakePlayers are specifically there for the case of machines doing a player action while the latest is away or offline.
As the name implies, HarvestCheck is just a check, it doesn't imply that harvesting will actually happen.
Yes but I'm not doing any harvesting. Extracting/inserting items and/or energy is not harvesting
Also the problem with fake players is that FTB Utilities either blocks those or allows those. If it blocks those it means you cannot use my mods anywhere because the fake player will not be allowed to access blocks that belong to yourself. If it doesn't block then it will work regardless
This event is used beyond what its name implies since at least MC1.7.10. Make a pull request on Forge if you want finer event handling for MC1.13+.
You can always grab the player who placed the controller, and default to a FakePlayer with that player name if the real one is offline or in another dimension.