# CS:GO Server -> Client RCE through OOB access in CSVCMsg_SplitScreen + Info leak in HTTP download

Malicious CS:GO server chains a case-sensitive Content-Length parser mismatch leaking uninitialized heap memory with an OOB slot index in CSVCMsg_SplitScreen to hijack RIP and ROP to RCE on connecting clients.

- Payout: $7,500
- Severity: critical
- Program: Valve
- Found by: simonscannell
- Disclosed: 2021-05-17
- Write-up quality: 10/10
- Original: https://hackerone.com/reports/1070835
- Library page: https://bugbountylibrary.com/r/h1%3A1070835
- Tags: area:os domain:desktop impact:data-leak impact:rce kind:bounty platform:hackerone sev:critical tech:curl technique:chained technique:parser-differential technique:source-review vuln:info-disclosure vuln:memory-corruption vuln:rce

**Target:** CS:GO client (csgo.exe) HTTP file download and CSVCMsg_SplitScreen protobuf handler in engine.dll
**Root cause:** Client's curl header callback does a case-sensitive search for 'Content-Length', so a lowercase 'content-length: 0' is honored by curl but ignored by CS:GO, causing an uninitialized heap buffer of attacker-chosen size to be written to disk; separately, CSVCMsg_SplitScreen.slot is used unchecked as an index into a global splitscreen array, yielding an attacker-controlled pointer that is dereferenced as an object with a vtable call.
**Steps:**
1. Host a fake CS:GO server that sends a .res file causing the client to HTTP-download a file.
2. Respond with `Content-Length: 1337` and `content-length: 0` so curl writes no body but CS:GO allocates 1337 bytes of uninitialized heap and saves it.
3. Use `NETMsg_File` to make the client upload the leaked file back to the server.
4. Spray `CSVCMsg_SendTable` 256 times with marker values `type=0x1337ee00`, `num_bits=0x00ff00ff` to place sendprop_t objects with engine.dll function pointers on the heap.
5. Parse uploaded leak for markers, subtract vtable offset to compute engine.dll base (ASLR broken).
6. Send `CNETMsg_SetConVar` with a convar whose string value contains a fake object/vtable and another convar with an integer value for the call target.
7. Send `CSVCMsg_SplitScreen` with `slot` set so the OOB index lands on the convar pointer, causing vtable deref at +8 and call through +0xAC to attacker-controlled address.
8. ROP chain to ShellExecuteA to execute arbitrary system commands.
**How found:** Noticed CS:GO servers can push custom files via .res and reversed the Linux curl-based downloader, spotting a case-sensitive Content-Length search and missing length validation. Separately, while reviewing protobuf messages, spotted CSVCMsg_SplitScreen with a slot index and confirmed via disassembly that slot indexes a global .data array unchecked, leading to a vtable call on attacker-influenced pointer.
**Exploitation:** Attacker controls a malicious CS:GO server. Client connects, downloads files via HTTP; crafted duplicate Content-Length headers leak uninitialized heap memory containing engine.dll pointers back to the server via NETMsg_File, breaking ASLR. Then CSVCMsg_SendTable spray places marker-tagged sendprop_t objects with engine.dll function pointers. Convar strings/ints are placed at known engine.dll offsets to form a fake object and vtable. CSVCMsg_SplitScreen slot OOB indexes the global array to fetch the convar pointer as an object, dereferences fake vtable at +8, then calls through +0xAC, giving RIP control. ROP chain executes ShellExecuteA to run arbitrary commands. ~98% reliable on Windows and Linux.
**Escalation:** Chained info leak (ASLR bypass) with OOB pointer deref to convert a read primitive into full RIP control and RCE; convar string/int storage used as a controlled-memory gadget to build fake vtable and call target.
**Insight:** When a client uses a third-party HTTP library (curl) alongside its own header parsing, look for case-sensitivity and duplicate-header mismatches between the two parsers; also audit protobuf integer fields used as array indices, and abuse global convar objects as controlled-memory gadgets since their string/int values land at fixed offsets in the binary.

## Proof of concept (copied exactly from the original report)

**Malicious HTTP response with duplicate Content-Length headers**

```
HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 1337
content-length: 0
Connection: closed
```

**SendTable spray to leak engine.dll pointer**

```
def spray_send_table(s, addr, nprops):
    table = nmsg.CSVCMsg_SendTable()
    table.is_end = False
    table.net_table_name = "abctable"
    table.needs_decoder = False

    for i in range(nprops):
        prop = table.props.add()
        prop.type = 0x1337ee00
        prop.var_name = "abc"
        prop.flags = 0
        prop.priority = 0
        prop.dt_name = "whatever"
        prop.num_elements = 0
        prop.low_value = 0.0
        prop.high_value = 0.0
        prop.num_bits = 0x00ff00ff

    tosend = prepare_payload(table, 9)
    s.sendto(tosend, addr)
```

**Parse leaked memory to compute engine.dll base**

```
for i in range(len(data) - 0x54):
        vtable_ptr = struct.unpack('<I', data[i:i+4])[0]
        table_type = struct.unpack('<I', data[i+8:i+12])[0]
        table_nbits = struct.unpack('<I', data[i+12:i+16])[0]
        if table_type == 0x1337ee00 and table_nbits == 0x00ff00ff:
            engine_base = vtable_ptr - OFFSET_VTABLE
```

