Skip to content

Commit

Permalink
Fix severe NEI exploit.
Browse files Browse the repository at this point in the history
Signed-off-by: Ross Allan <rallanpcl@gmail.com>
  • Loading branch information
LunNova committed Jul 11, 2013
1 parent fa0327b commit f3e10be
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
10 changes: 10 additions & 0 deletions resources/patches-deobfuscated.xml
Expand Up @@ -1822,4 +1822,14 @@
<replaceMethodCall code="{}" method="println">onCrafting</replaceMethodCall>
</class>
</xReliquary>
<notEnoughItems>
<class id="codechicken.nei.NEISPH">
<insertBefore code="{
if ($1.getType() != 10 &amp;&amp; !$3.^method:EntityPlayerMP/canCommandSenderUseCommand^(4, &quot;give&quot;)) {
Redirects.notifyAdmins(&quot;Modified NotEnoughItems. Probably duping and/or in creative mode. Packet type &quot; + $1.getType());
return;
}
}">handlePacket</insertBefore>
</class>
</notEnoughItems>
</mods>
10 changes: 10 additions & 0 deletions src/common/nallar/tickthreading/global/Redirects.java
Expand Up @@ -21,11 +21,21 @@
public class Redirects {
private static final int FML_HASH = Hashing.murmur3_32().hashString("FML").asInt();

public static void exploitNotify(String message, EntityPlayerMP entityPlayerMP) {
String fullMessage = entityPlayerMP + " attempted to use an exploit: " + message;
Log.severe(fullMessage);
sendToAdmins(fullMessage);
}

public static void notifyAdmins(String message) {
if (!TickThreading.instance.antiCheatNotify) {
return;
}
Log.warning("Admin notify: " + message);
sendToAdmins(message);
}

private static void sendToAdmins(String message) {
ServerConfigurationManager serverConfigurationManager = MinecraftServer.getServer().getConfigurationManager();
serverConfigurationManager.playerUpdateLock.lock();
try {
Expand Down
1 change: 1 addition & 0 deletions src/common/nallar/tickthreading/patcher/ClassRegistry.java
Expand Up @@ -63,6 +63,7 @@ public class ClassRegistry {
classes.importPackage("java.util");
classes.importPackage("java.io");
classes.importPackage("nallar.tickthreading");
classes.importPackage("nallar.tickthreading.global");
classes.importPackage("nallar.collections");
}

Expand Down

4 comments on commit f3e10be

@seriousvern
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what perms do i need for this
is it op or can i use a permission system like permissions ex

@LunNova
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It requires op to allow NEI actions. Can fix to use normal NEI permissions instead of requiring op tomorrow.

@seriousvern
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do i have to allow cheat notify in the tt config

@LunNova
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, due to the severity of this exploit you get the warning even with that disabled, so you know if people previously were abusing it.

Please sign in to comment.