Skip to content
Memory corruption Write-up Advanced

Exploiting American Conquest

The game American Conquest contains multiple stack buffer overflows in its network message handling, including a chat message copied into a fixed-size buffer and a file path hashing function that uses strcpy into a 64-byte buffer. An attacker on the same LAN could send crafted messages to execute arbitrary code on another player's machine.

Thomas Dubier Follow

Published on synacktiv.com

Written by Thomas Dubier - 16/04/2024 - in Exploit, Reverse-engineering - Download

Thomas Dubier (@tomtombinary), on synacktiv.com

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

The game uses unsafe functions like memcpy and strcpy without checking the length of user-supplied data, leading to buffer overflows.

Impact

An attacker on the same LAN could execute arbitrary code on another player's machine, but the publisher will not fix the vulnerabilities because the game is too old.

What the attacker needed

Attacker and victim on same LAN; victim runs the game

How it was found

  1. Capture network traffic to identify the DirectPlay protocol and message format.
  2. Locate the code that processes chat messages by searching for the 'CHAT' string in the binary.
  3. Identify that chat messages are copied into a fixed-size buffer without length validation.
  4. Find the 'FIDN' message handler and observe that it uses strcpy into a 64-byte stack buffer.
  5. Craft a file path that overflows the buffer and redirects execution to a gadget (jmp eax).
  6. Send a chat message containing shellcode, then send a crafted FIDN message to trigger the overflow and execute the shellcode.

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.

This report describes security bugs in an old video game. When players connect over a local network, the game sends messages to each other. The game does not check the size of some messages, so a malicious player can send a very long message that overwrites part of the game's memory. This can let the attacker run their own code on another player's computer.

What is Memory corruption?

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.