# RCE on CS:GO client using unsanitized entity ID in EntityMsg message

Unvalidated entity index in CSVCMsg_EntityMsg lets a malicious CS:GO server trigger OOB read and virtual call on a fake object, achieving client RCE.

- Payout: $9,000
- Severity: critical
- Program: Valve
- Found by: teapotd
- Disclosed: 2021-05-27
- Write-up quality: 9/10
- Original: https://hackerone.com/reports/584603
- Library page: https://bugbountylibrary.com/r/h1%3A584603
- Tags: area:os domain:desktop impact:rce kind:bounty platform:hackerone sev:critical tech:windows technique:chained technique:source-review vuln:info-disclosure vuln:memory-corruption vuln:rce

**Target:** CS:GO client (csgo.exe) network message handler for CSVCMsg_EntityMsg
**Root cause:** ProcessEntityMessage passes attacker-controlled ent_index to GetClientNetworkable without bounds checking; invalid index yields a pointer outside the entity list, and a virtual call is made on it.
**Steps:**
1. Craft CSVCMsg_EntityMsg with arbitrary ent_index pointing past the statically allocated entity list in client_panorama.dll.
2. Place a fake IClientNetworkable object plus ROP chain at a known address by sending it as the map name (overwrite repeatedly to embed null bytes).
3. Compute ent_index from the constant offset between entity list and the map-name global.
4. Send the message from a malicious server; client dereferences the fake object and executes the virtual function, pivoting to the ROP chain.
5. ROP chain calls IProcessUtils from tier0.dll to launch calc.exe.
**How found:** Code review of the CSVCMsg_EntityMsg handler revealed GetClientNetworkable was called with an unchecked ent_index; noted entity list is a static array in client_panorama.dll, making the offset to a controllable global (map name) constant and predictable.
**Exploitation:** Attacker runs a malicious CS:GO server. Requires knowledge of client_panorama.dll base (via separate infoleak #581774 or ASLR brute force on 32-bit). Payload (fake object + ROP) is delivered as map name into a known global; then a crafted EntityMsg with computed ent_index triggers the virtual call. Victim connects manually or automatically via Steam browser protocol from a malicious webpage, no confirmation needed.
**Escalation:** Chained with a memory disclosure (#581774) to defeat ASLR, and with Steam browser protocol to auto-launch the client from a webpage without user interaction; social engineering via faked player counts increases join rate.
**Insight:** When a network handler indexes a statically allocated array with an attacker-controlled integer, the fixed offset to any server-controllable global (e.g. map name) becomes a reliable target for fake-object placement; look for virtual calls on the resulting pointer to convert OOB read into control-flow hijack.

