Skip to content
Memory corruption Disclosed report Advanced

[GoldSrc] Remote Code Execution using malicious WAD list in BSP file

The TEX_InitFromWad function copies a WAD file name from a path into a small stack buffer using COM_FileBase, which performs no boundary checks, so an overly long name overflows the stack. An attacker could use this to run arbitrary code on a victim's machine when they connect to a malicious server.

nyancat0131 Follow

Originally disclosed on HackerOne

Bounty$750 Critical 9.8 View original
  • Triaged in 7 months
  • Fixed in 12 months
  • Paid in 12 months
  • Disclosed after 21 months

Summary by the program

Summary

TEX_InitFromWad function calls COM_FileBase to get file name from a path into a buffer on the stack. Since COM_FileBase does not have boundary checks and the buffer is small, long WAD file name can trigger a Stack Buffer Overflow, leading to arbitrary code execution.

Steps to reproduce

Environment: Windows 10 x64 18362

  • Install Counter-Strike Dedicated Server. Let's call the directory where it's installed SERVER_DIR
  • Install AMX Mod X for the dedicated server
  • Compile F558348, install and enable it in AMX Mod X plugins.ini
  • Copy any .exe file to SERVER_DIR/cstrike/pwn.ed (pwn.ed is the file name)
  • Extract F558346 to SERVER_DIR/cstrike/maps/
  • Start Counter-Strike Dedicated Server on map cs_pwn
  • After the map is fully loaded, extract F558347 to SERVER_DIR/cstrike/maps/
  • Install Counter-Strike Client
  • Start Counter-Strike Client
  • Connect to the dedicated server

Expected behavior: pwn.ed will be downloaded and executed.

Impact

Attackers can remotely execute arbitrary code on victim's computer. The lack of ASLR on hl.exe makes the exploit 100% reliable.

The original report as published on HackerOne, by nyancat0131. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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

How it worked

Root cause

Likely the COM_FileBase helper copies the base file name into a fixed-size stack buffer without any length check, so a long WAD name overflows it.

Impact

An attacker could run arbitrary code on a victim's computer, and the absence of ASLR on the game executable makes the exploit fully reliable.

What the attacker needed

Victim connects to attacker's server; Server runs AMX Mod X with a plugin

How it was found

  1. Set up a Counter-Strike dedicated server with AMX Mod X and a custom plugin enabled.
  2. Place an executable file in the game's cstrike directory under a chosen name.
  3. Put the crafted map files on the server and start the server on that map.
  4. Add the remaining map files after the map has fully loaded.
  5. Start the Counter-Strike client and connect to the dedicated server.
  6. The executable is downloaded and run on the client.

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 report has not been written yet. The Original tab links to the source.

Because the game executable has no ASLR, the attack is described as fully reliable.

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.

More by nyancat0131

View all

5 more disclosed reports, best first.

More from Valve

View all

The newest disclosed reports for this program.

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.