Log4j Exploit Fixes

I want to make this Thread a List of all ways to help fixing that new Log4j zero day exploit that Minecraft seems to have now. Testing can be done by just typing ${jndi:ldap://127.0.0.1:1389/a} in Chat, but all I get is Forges Chat Formatter fucking up with IllegalArgumentException and MC crashing instantly without any trace of trying to connect (I replaced that IP with an IP/Port on my local network, to see if that Computer receives any connection attempt, but nope).

  1. The first way, which does NOT seem to work from my testing in 1.7.10 is adding -Dlog4j2.formatMsgNoLookups=true to the JVM arguments.

  2. The second way is just using an up to date MultiMC, which downloads the updated Version of that Library.

  3. Update Java, apparently Oracle fixed this Issue on the Java end in 2018, and OpenJDK fixed it a few months later too… This ALSO explains why i was not able to reproduce this Issue on my Computer, because my Version of Java 8 was too up to date… This one does NOT work fully and only shields against the some of the simplest attacks.

  4. Add one of the dedicated Fixer Mods.

I would like to see more ways, including dedicated Mods, so anyone have suggestions?

3 Likes

I just added that parameter, but had no way to test it.

2 Likes

I just tried putting that on the server console with the parameter set, nothing happened. It echoed to the log file normally without evaluation.

2 Likes

From IRC, looks interesting.

2 Likes

Here’s a fix mod. I don’t know if it works

2 Likes

Yeah I did not post the ones we talked on IRC about, in order to encourage more people to post something here. :wink:

Yep, that one is on my List of things to look at, because it actually shows how it is done. I may or may not be planning to somehow integrate a mixture of all those fixes into GT6, which was one of the reasons I started this Thread, in case there is a good Solution. ^^

2 Likes

https://www.minecraft.net/en-us/article/important-message--security-vulnerability-java-edition

They recommend an updated log4j configuration server side? I’m installing this now but I don’t really have a good way to test anything.

2 Likes

Server has -Dlog4j2.formatMsgNoLookups=true and https://www.minecraft.net/en-us/article/important-message--security-vulnerability-java-edition xml config applied with -Dlog4j.configurationFile=log4j2_17-111.xml

On client, sent chat message with

${jndi:ldap://127.0.0.1/a}

Client crashed with “Internal error” message.

On server, process kept running and logged:

[17:43:17] [Server thread/WARN]: Failed to handle packet for /10.66.69.201:65082
java.lang.IllegalArgumentException: Illegal character in path at index 18: ldap://127.0.
0.1/a}
at java.net.URI.create(URI.java:852) ~[?:1.8.0_265]
at net.minecraftforge.common.ForgeHooks.newChatWithLinks(ForgeHooks.java:417) ~[
ForgeHooks.class:?]
at net.minecraft.network.NetHandlerPlayServer.func_147354_a(NetHandlerPlayServer
.java:722) ~[nh.class:?]
at net.minecraft.network.play.client.C01PacketChatMessage.func_148833_a(SourceFi
le:37) ~[ir.class:?]
at net.minecraft.network.play.client.C01PacketChatMessage.func_148833_a(SourceFi
le:9) ~[ir.class:?]
at net.minecraft.network.NetworkManager.func_74428_b(NetworkManager.java:212) ~[
ej.class:?]
at net.minecraft.network.NetworkSystem.func_151269_c(NetworkSystem.java:165) [nc
.class:?]
at net.minecraft.server.MinecraftServer.func_71190_q(MinecraftServer.java:659) [
MinecraftServer.class:?]
at net.minecraft.server.dedicated.DedicatedServer.func_71190_q(DedicatedServer.j
ava:334) [lt.class:?]
at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:547) [
MinecraftServer.class:?]
at fastcraft.u.a(F:289) [FastCraft.jar:?]
at fastcraft.H.aq(F:36) [FastCraft.jar:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:396) [Minecraft
Server.class:?]
at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:685) [li.clas
s:?]
Caused by: java.net.URISyntaxException: Illegal character in path at index 18: ldap://12
7.0.0.1/a}
at java.net.URI$Parser.fail(URI.java:2848) ~[?:1.8.0_265]
at java.net.URI$Parser.checkChars(URI.java:3021) ~[?:1.8.0_265]
at java.net.URI$Parser.parseHierarchical(URI.java:3105) ~[?:1.8.0_265]
at java.net.URI$Parser.parse(URI.java:3053) ~[?:1.8.0_265]
at java.net.URI.(URI.java:588) ~[?:1.8.0_265]
at java.net.URI.create(URI.java:850) ~[?:1.8.0_265]
… 13 more

does that mean successfully patched and not vulnerable?

2 Likes

Quick note. I removed the XML and the startup parameters and tested. I received the same invalid character message. I added them back, and again got the same invalid character message.

At this point I can’t tell if my server is vulnerable or fixed because it’s the same message either way.

2 Likes

Maybe enter an IP from your local network and test on that IP if someone tried to connect to you?

1 Like

The original CVE said that it should log a network error. This never seemed to get that far.

2 Likes

Here is a Solution I did not expect:

Update Java, apparently Oracle fixed this Issue on the Java end in 2018, and OpenJDK fixed it a few months later too… This ALSO explains why i was not able to reproduce this Issue on my Computer, because my Version of Java 8 was too up to date…

1 Like

Link? I hadn’t seen implied fixes.

1 Like

Searching for this nets multiple slightly conflicting Results, but this is what I think is somewhat correct:

Java 6 – 6u212
Java 7 – 7u202
Java 8 – 8u192
Java 11 - 11.0.2

There is sources that say Oracle fixed it in 2017 already instead of 2018, so I am erring on the side of 2018.

1 Like

I couldnt get an outdated enough Java Version to run on my Computer, I finally found one that was not javascript-locked behind a malfunctioning Oracle EULA Wall, but that one was incompatible with 2018 Debian…

I even tried my old Win 8 Install until I realized I nuked Minecraft from it, when I installed Linux on the second Partition for Dual Booting, and I dont wanna connect that thing to the Internet at all to install MC again…

Can someone who is still vulnerable and didnt update Java 8 in at least 4 years use the current Secret Version of GT6 to see if it successfully detects that you are vulnerable to the exploit?

1 Like

I tried to boot the game with the 1.8.0_60 version, and this is the output I found in the log.

[01:30:26] [Client thread/INFO] [log4j-vulnerability-detector/gregapi]: Checking if the log4j Exploit has been fixed.
[01:30:26] [Client thread/INFO] [log4j-vulnerability-detector/gregapi]: If the Game Crashes from this following check there are a few ways to fix it:
[01:30:26] [Client thread/INFO] [log4j-vulnerability-detector/gregapi]: 1. Update Java to one of the following Versions or later: Java 7 – 7u202+, Java 8 – 8u192+, or whichever Java equivalent you use that has the log4j exploit fixed. Yes, Oracle fixed this exploit back in 2018 already.
[01:30:26] [Client thread/INFO] [log4j-vulnerability-detector/gregapi]: 2. Use a Minecraft Launcher that automatically updates log4j for you to a patched Version, such as the official Launcher or MultiMC
[01:30:26] [Client thread/INFO] [log4j-vulnerability-detector/gregapi]: 3. Install one of the many Patcher Mods that fix this Issue in one way or another.
[01:30:26] [Client thread/INFO] [log4j-vulnerability-detector/gregapi]: Now performing the actual check! Don't worry, these are IPs which loop back to your own Computer, and dont go to your Network!
[01:30:26] [Client thread/INFO] [log4j-vulnerability-detector/gregapi]: ${jndi:ldap://127.0.0.1:8000/test}
[01:30:32] [Client thread/INFO] [log4j-vulnerability-detector/gregapi]: ${jndi:rmi://localhost:8000/test}
[01:30:39] [Client thread/DEBUG] [FML/gregapi]: Bar Finished: log4j exploit check took 12.239s

It looks like the detection didn’t work, I entered the detection in the game and crashed.
Maybe it’s better to test it yourself. https://drive.google.com/file/d/1zR6bTh8Fyce3Oiy0zLpCiBkJCHVYJgAl (:gregorius: do note that this is a java exe file before clicking this link)

3 Likes

Dude I use Linux, that’s why I cant just use my old Java 8 Installer for WIndows either, because all my Windows Devices are not connected to the Internet whatsoever (something something Microsoft is malware something something), so I cant reinstall Minecraft on them. XD

And the Game Crash happens because Forge tries to parse the IP in Chat inside the exploit, so it will ALWAYS crash no matter if it is fixed or not. The exploit is supposed to Freeze and not Crash the Game. :wink:

3 Likes

So, finally found out one thing about this exploit, you actually HAVE to run a Web Server on that IP and Port, or else it will literally not do anything. Kinda makes it hard to check for, soI will not do that in GT6.

I will probably just nuke the lookup function with ASM or something, like most of the Fixer Mods do.

2 Likes

No. You have to run something that takes unfiltered network traffic of any protocol that may log portions of that packet that has string data. Logging of malformed URLs is one item, but chat in Minecraft was another.

3 Likes

Thing is Chat wont work in 1.7.10 because Forge was too incompetent to parse URLs…

2 Likes