# [CS:GO] Unchecked texture file name with TEXTUREFLAGS_DEPTHRENDERTARGET can lead to Remote Code Execution

A texture with an overlong filename and TEXTUREFLAGS_DEPTHRENDERTARGET set overflows a stack buffer in CS:GO, overwriting EIP and enabling remote code execution via a malicious map.

- Payout: $2,500
- Severity: high
- Program: Valve
- Found by: nyancat0131
- Disclosed: 2021-05-06
- Write-up quality: 6/10
- Original: https://hackerone.com/reports/550625
- Library page: https://bugbountylibrary.com/r/h1%3A550625
- Tags: area:devices domain:desktop domain:network impact:rce kind:bounty platform:hackerone sev:high tech:windows technique:fuzzing vuln:memory-corruption vuln:rce

**Target:** csgo.exe texture loader (Source Engine material/texture parsing)
**Root cause:** Texture filename is copied into a fixed-size stack buffer without bounds checking when TEXTUREFLAGS_DEPTHRENDERTARGET is set, allowing overflow past the return address.
**Steps:**
1. Extract provided F478261 archive into `<csgo_install_dir>/csgo`
2. Start CS:GO and attach WinDBG
3. Host a new game on map `aim_pwn`
4. Observe crash; EIP overwritten to `0x61616161`
**How found:** Researcher identified that texture filenames combined with the DEPTHRENDERTARGET flag reach an unchecked stack copy, then crafted a map to trigger it under a debugger.
**Exploitation:** Attacker hosts a CS:GO server with a custom map containing a texture whose filename is overlong and has TEXTUREFLAGS_DEPTHRENDERTARGET set; victim connecting downloads the map and resources, triggering the overflow and EIP control for arbitrary code execution.
**Insight:** Source Engine material/texture flags gate different code paths; fuzzing filename lengths per texture flag combination can expose unchecked stack copies reachable via auto-downloaded map resources.

