DoS vulnerability via flood of logins
The bug
A denial-of-service vulnerability exists in the server due to the lack of rate limiting of logins.
A disconnection during login appears to be handled, at least in part, by the main server thread, so the server can lag and possibly crash (killed by the watchdog).
Banning the attacker's IP address does not mitigate the issue. (However, it could presumably be blocked with a firewall.) Exploiting the bug does not even require any kind of login or authentication.
How to reproduce
- Start a local server.
- Download and extract mc122903-compiled.zip
(source code is in mc122903.zip
) - Run the jar with java -jar mc122903.jar localhost 25565 protocol-version-number.
- The server will crash (or experience a large lag spike) after about a minute. If it doesn't crash, try doing step 3 again.
Notes:
- A beefy computer may give better results. This also might work better on certain operating systems; I've been testing this on Linux.
- If you get "Too many open files" errors in the program and/or the server, try raising the limit before running them (requires root):
# ulimit -Hn 65536
Then run the program/server in that root shell. Note that the limit is high enough by default on most Linux distros, so usually you will not need to do this.
- If you see "Took too long to log in" in the server log, then this usually signals that the server is about to lag or crash.
info: data: 17 (0x11) bytes info: ----------------------------------------------------- info: 0000: 10 00 ba 04 09 6c 6f 63 61 6c 68 6f 73 74 63 dd info: 0010: 02 info: ----------------------------------------------------- info: starting info: 14,708 connections made info: 15,684 connections made info: 16,658 connections made <<snip>> info: 24,874 connections made info: 25,938 connections made info: 26,946 connections made
<<lots of timed out messages and thread dumps>> [21:14:04] [Server thread/INFO]: /127.0.0.1:41592 lost connection: Timed out [21:14:04] [Server thread/INFO]: /127.0.0.1:41608 lost connection: Timed out [21:14:04] [Server thread/INFO]: /127.0.0.1:40986 lost connection: Timed out [21:14:04] [Server thread/INFO]: Disconnecting /127.0.0.1:40998: Took too long to log in [21:15:04] [Server Watchdog/FATAL]: A single server tick took 60.00 seconds (should be max 0.05) [21:15:04] [Server Watchdog/FATAL]: Considering it to be crashed, server will forcibly shutdown. [21:15:04] [Server Watchdog/ERROR]: This crash report has been saved to: /home/jtai/BugServer/./crash-reports/crash-2019-12-05_21.15.04-server.txt
How the program works
- Initiate connection to server.
- Send the Handshake packet.
- Without closing the connection, create another connection and repeat.
How this could be fixed
This could be fixed by simply rate limiting logins. Since sending too many logins clearly causes bad things to happen, logins could simply be rate limited, for example 10 logins per minute per IP. As far as I could tell, there is currently no rate limiting of logins — I was able to start tens of thousands.
2017-12-06, 08:33 AM
2023-07-09, 06:04 AM
4
2
Minecraft 1.12.2 - 1.20.1
Minecraft 1.12.2, Minecraft 17w48a, Minecraft 17w49a, Minecraft 18w11a, Minecraft 18w21b, Minecraft 1.13-pre2, Minecraft 1.13-pre3, Minecraft 1.13-pre5, Minecraft 1.13-pre8, Minecraft 1.13, Minecraft 18w30a, Minecraft 18w30b, Minecraft 18w31a, Minecraft 18w32a, Minecraft 18w33a, Minecraft 1.13.1-pre1, Minecraft 1.13.1-pre2, Minecraft 1.13.1, Minecraft 1.13.2, Minecraft 18w43c, Minecraft 18w44a, Minecraft 18w45a, Minecraft 18w46a, Minecraft 18w47b, Minecraft 18w48a, Minecraft 18w48b, Minecraft 18w50a, Minecraft 19w02a, Minecraft 19w03a, Minecraft 19w04b, Minecraft 19w05a, Minecraft 19w07a, Minecraft 19w08a, Minecraft 19w08b, Minecraft 19w09a, Minecraft 19w12a, Minecraft 19w14a, Minecraft 1.14 Pre-Release 1, Minecraft 1.14 Pre-Release 2, Minecraft 1.14 Pre-Release 3, Minecraft 1.14 Pre-Release 5, Minecraft 1.14, Minecraft 1.14.1 Pre-Release 1, Minecraft 1.14.1 Pre-Release 2, Minecraft 1.14.1, Minecraft 1.14.2 Pre-Release 1, Minecraft 1.14.2 Pre-Release 2, Minecraft 1.14.2 Pre-Release 3, Minecraft 1.14.2 Pre-Release 4, Minecraft 1.14.2, Minecraft 1.14.3 Pre-Release 1, Minecraft 1.14.3 Pre-Release 2, Minecraft 1.14.3 Pre-Release 3, Minecraft 1.14.3 Pre-Release 4, Minecraft 1.14.3, Minecraft 1.14.4 Pre-Release 2, Minecraft 1.14.4 Pre-Release 3, Minecraft 1.14.4 Pre-Release 4, Minecraft 1.14.4 Pre-Release 5, Minecraft 1.14.4 Pre-Release 6, 1.14.4 Pre-Release 7, 1.14.4, 19w34a, 19w35a, 19w36a, 19w37a, 19w41a, 19w42a, 19w45b, 19w46b, 1.15 Pre-release 1, 1.15 Pre-Release 2, 1.15 Pre-release 5, 1.15, 1.15.1 Pre-release 1, 1.15.2, 20w06a, 20w07a, 20w12a, 20w15a, 20w18a, 1.16 Pre-release 3, 1.16.1, 20w27a, 20w28a, 1.16.2 Release Candidate 2, 1.16.2, 1.16.3, 1.16.4 Pre-release 1, 1.16.4 Pre-release 2, 20w45a, 20w51a, 21w03a, 21w05b, 21w06a, 21w14a, 21w16a, 1.17 Release Candidate 1, 1.17, 1.17.1 Release Candidate 1, 1.17.1, 21w40a, 21w41a, 1.18 Pre-release 1, 1.18, 1.18.1, 1.18.2, 22w12a, 22w14a, 1.19 Pre-release 4, 1.19, 1.19.1 Release Candidate 2, 1.19.1, 1.19.2, 1.19.3, 1.19.4 Release Candidate 2, 1.20.1
-