Skip to content
Path traversal Write-up Advanced

Client <-> Server file upload

The game's file-transfer code checked a filename for blocked extensions and directories, but then truncated the path to 256 bytes after the checks, so a long name ending in a harmless extension could become a blocked one. An attacker could write files anywhere on a victim's disk and load a malicious plugin, giving code execution on both clients and servers.

mev Follow

Published on secret.club

Alien Swarm was originally a free game released circa July 2010. It differs from most Source Engine games in that it is a top-down shooter, though with gameplay elements not dissimilar from Left 4 Dead.

mev, on secret.club

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

Root cause

Likely the filename was validated against a 260-byte buffer but then copied into a 256-byte buffer, so the checked name and the written name differed.

Impact

An attacker could execute arbitrary code on game servers and on connecting clients, and because the flaw works in both directions the exploit chain is wormable.

What the attacker needed

Ability to join the game server; victim connects to a malicious server; wait for a map change

The fix

The game was patched in the beta branch and then in release.

How it was found

  1. Send a file whose name is padded with dot-slash sequences so it exceeds 256 bytes and ends in a permitted extension.
  2. The receiver checks the long name and accepts it because the extension looks harmless.
  3. The name is truncated to 256 bytes, turning the fake extension into a blocked one such as a dynamic library.
  4. Upload a config file and a malicious plugin to the config directory the engine reads.
  5. Wait for a map change so the config is reloaded and the plugin is loaded.

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.

When one player joins a game, their computer and the game server swap files, such as maps. The game tried to block dangerous file types by looking at the name, but it looked at the name before shortening it, so a long name could sneak past. The attacker could then plant a file that the game loads as code, taking over the machine.

What is Path traversal?

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.

More from Valve

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Path traversal and file inclusion

The lesson behind this report.

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.