Skip to content
RCE Write-up Advanced

Dota 2 Under Attack: How a V8 Bug Was Exploited in the Game

Dota 2 shipped an outdated V8 JavaScript engine that was vulnerable to CVE-2021-38003, and an attacker published custom game modes containing an exploit for it. Because V8 was not sandboxed in the game, the exploit could give an attacker remote code execution on other players' machines.

Jan Vojtěšek Follow

Published on decoded.avast.io

When we think about V8 exploits, the first things that come to mind are probably related to sophisticated browser zero-day exploit chains. While the browser may be the most interesting target for V8 exploits, we shouldn’t forget that this open-source JavaScript engine is also embedded into countless projects other…

Jan Vojtěšek, on decoded.avast.io

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Impact

The exploit could achieve remote code execution against other players, though the campaign was small: under 200 players were affected.

What the attacker needed

Victim installs a malicious custom game mode; game mode passes Steam verification; no sandbox around V8 in the game

The fix

Valve updated the vulnerable V8 build, removed the malicious game modes, notified affected players and added mitigations.

How it was found

  1. The attacker replaced a legitimate scoreboard script in a custom game mode with an exploit for the V8 bug.
  2. The exploit leaks an internal object and uses it to corrupt a map, then an array length, giving a relative read/write.
  3. It corrupts an ArrayBuffer backing store to gain arbitrary read/write.
  4. It uses a WebAssembly trick to run custom shellcode.
  5. In later game modes, client JavaScript signals readiness and server Lua fetches a payload from a command server.
  6. The client receives the payload in an event and executes it dynamically.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

Dota 2 lets players build their own game modes, and the interface parts of these run JavaScript inside the game. The game used an old, buggy version of the JavaScript engine, so a rigged game mode could break out of that engine and run the attacker's code on a player's computer. The attacker hid this in game modes that players could install with one click.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

More from Valve

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.