minecraft2shell: how a font could take over your PC, and how Modal fixed it

Am I safe?

SAFEModal 1.2.3

Every version you play loads fonts with Mojang’s fixed FreeType. Modal 1.1 and newer update to it by themselves: restart Modal to install it.

AT RISK1.20.5 to 1.21.11, elsewhere

In Modal before 1.2.3, and in launchers that start these versions as Mojang ships them.

NEVER AFFECTED1.20.4 and older

These versions never used FreeType, so the flaw was never there.

There’s nothing else you need to do. Your instances, worlds and mods are as they were.

What happened

Since 1.20.5, Minecraft draws TrueType fonts with FreeType, a font library written in C that the game loads through LWJGL’s lwjgl-freetype. Resource packs can bring their own fonts, and a server can send you its resource pack when you join.

A specially made TrueType font could make that copy of FreeType run code of the attacker’s choosing. It runs outside Java, with the same rights as the game, so it can do anything a program you start yourself can do. Joining the wrong server and accepting its pack could be enough. This is the flaw known as minecraft2shell.

The problem is in Minecraft itself, not in any launcher. Every launcher that starts an affected version as Mojang ships it starts it with the vulnerable library.

Which versions were affected

Mojang rebuilt FreeType as lwjgl-freetype 3.4.3-mojang-2.15.0, but only put it in 26.1 and newer. The versions before that still list the vulnerable library.

MinecraftFreeType it loadsAs Mojang ships itIn Modal 1.2.3
1.20.4 and olderNoneNot affectedNot affected
1.20.5 to 1.21.11lwjgl-freetype 3.3.3 (some snapshots 3.3.2, 3.3.6 or 3.4.2)VulnerableFixed
26.1 and newerlwjgl-freetype 3.4.3-mojang-2.15.0Fixed by MojangFixed

Mods don’t change this either way: a Fabric, Forge, NeoForge or Quilt instance loads the same FreeType as the Minecraft version it’s built on.

What Modal does now

Before every start, Modal looks at which lwjgl-freetype the version lists. If it isn’t Mojang’s patched build, Modal swaps in the patched one:

  1. It downloads Mojang’s patched FreeType from Mojang’s own library server, the same place the game’s other files come from. It does this once, and checks it against the checksum Mojang publishes.
  2. It picks the build that matches the Java the game runs on, not just your PC. That way an x64 Java on an ARM PC gets the x64 library.
  3. It tells LWJGL to load that library instead, with the org.lwjgl.freetype.libname setting. Modal adds this setting after everything else, so an instance’s own Java arguments can’t point it back at the old library.

Only the native library changes. The game’s own code stays exactly as Mojang made it, so nothing else about how Minecraft runs is different. This works the same in vanilla and modded instances, and needs nothing from you.

How we checked it

Before releasing 1.2.3, we launched every stable version from 1.20.5 to 26.3 with a resource pack containing a TrueType font, and checked that each one loaded the patched library. That includes all 19 affected stable releases.

Where the fix can’t reach

Mojang has no patched build for 32-bit Windows or for Linux on ARM, so Modal can’t swap the library there. On those systems, the game’s log says so, and you should only join servers you trust. The same applies if the patched library can’t be downloaded when you press Play, for example when you’re offline the first time. That start uses the version’s own library, and the log warns you.

Check it yourself

Open an instance, press Play, and look at its Logs tab. Modal writes which FreeType the game uses near the top. On an affected version, it looks like this:

Logs
FreeType: this version lists lwjgl-freetype 3.3.3; using Mojang's patched 3.4.3-mojang-2.15.0 instead (…)

On 26.1 and newer, which Mojang fixed, it looks like this:

Logs
FreeType: lwjgl-freetype 3.4.3-mojang-2.15.0 (Mojang's patched build)

If you see 3.4.3-mojang, you’re protected. Versions older than 1.20.5 don’t write a FreeType line at all, because they don’t use it.

What you should do

  • Update Modal to 1.2.3. Modal 1.1 and newer download it by themselves: restart Modal to install it. The first time you open it, a short notice explains what happened.
  • On a .deb, .rpm, Flatpak or Arch package? Your package manager updates those, so update through it.
  • Still on Modal 1.0? It can’t update itself. Download 1.2.3 and install it over the top.
  • Playing 1.20.5 to 1.21.11 in another launcher? Until that launcher fixes it, only accept resource packs from servers you trust.

Questions

Ask us on Discord (opens in a new tab). If you find a security problem in Modal, please report it privately, as SECURITY.md (opens in a new tab) describes, rather than in public.

Download Modal 1.2.3 Read the docs