Valve · Report #505173
Malformed map detailed texture files in GoldSrc games lead to Remote Code Execution
Validstatus
mediumseverity
$350bounty
30upvotes
17 Sept 2019disclosed
How it was found
A crafted map detailed texture file (maps/<map_name>_detail.txt) can be used to exploit a stack overflow vulnerability in hw.dll that can lead to remote code execution.
Reproduction
I used Counter-Strike for PoCs.
Using a listen server
- Place attached
cs_assault_detail.txtincstrike/mapsfolder - Start the game
- Open the console, type
r_detailtextures 1 - Host a new game on
cs_assault - The game crashes when trying to load detailed textures
Using a dedicated server
- Place attached
cs_assault_detail.txtincstrike/mapsfolder on the server - Write an AMXX plugin that does the following:
- Use
precache_genericto precachemaps/cs_assault_detail.txt - Use
client_cmdto force clients to executer_detailtextures 1 - Host a new server on
cs_assault - Open the client and connect to the server
- The client crashes when trying to load detailed textures
Note:
precache_generichas some bug (https://github.com/ValveSoftware/halflife/issues/1551). The workaround is to setupsv_downloadurlfor the server.
Exploitability
Since the file can be sent from the server using precache_generic, and the server has the ability to slowhack clients, attackers can use this to trigger RCE on clients.
Impact
Attackers can exploit this bug to execute arbitrary unauthorized codes on victim's computer.