Skip to content
RCE Disclosed report Advanced

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

A malicious CS:GO server could exploit an out-of-bounds array access in the splitscreen message to control the instruction pointer, and an information leak in HTTP downloads to defeat ASLR, leading to remote code execution on the client.

simonscannell Follow

Originally disclosed on HackerOne

Bounty$7,500 Critical 9.6 View original
  • Triaged in 8 days
  • Fixed in 4 months
  • Paid in 4 months
  • Disclosed after 4 months

Summary by the program

Title: CS:GO Server -> Client RCE through OOB access in CSVCMsg_SplitScreen + Info leak in HTTP download Scope: csgo.exe Weakness: Out-of-bounds Read Severity: Critical (9.6) Link: https://hackerone.com/reports/1070835 Date: 2021-01-04 00:22:02 +0000 By: @simonscannell

Details: We managed to write an extremely reliable exploit for CS:GO on Windows by chaining an OOB access that leads to RIP control and an Info leak. This report consists of two critical bugs. The memory leak was initially reported in #1064367, where the other bug in the same report was a duplicate and the OOB access in #1064809. Altough #1064809 is still open as an explot was expected, we still wanted to make a new report where both bugs are in one place, as they are both two completely unique bugs.

Here is a PoC video of the exploit in action:

Vulnerability details

Bug #1: Information leak through HTTP downloads

During vulnerability research, we found out that CS:GO dedicated servers can host custom map and game modes, all of which depend on custom files. Game client's can connect to these servers and download these files dynamically. Usually, a CS:GO server maintainer would create a list of required files and write them into a .res file, which has the same name as the map the server is running on. We found this feature highly interesting, as it involves interaction with yet another untrusted server.

After reversing the code that actually handles the HTTP download on the client side on Linux, we found out that it was handled by curl and the logic seems to be the following:

  1. Create a CURL object and set all necessary options (URL, timeout, User-Agent etc)
  2. Register a callback that is called for every HTTP header the server sends
  3. Register a callback that is called when the data of the body of the HTTP response is received

This logic can be seen in the following screenshot:

After looking at the code that implements the callbacks, we found that the following logic applies:

  1. The header callback looks for the Content-Length header and uses its value to allocate a buffer to fit the file into. It does so through a case-sensitive string search.
  2. The write callback then writes the data that is received into the buffer
  3. After the download finished, it is written to the destination file.

Here is a screenshot showing how a case-sensitive search is implemented and how it is used to allocate a buffer:

The bug that occurs here is that if two Content-Length headers are sent, but one is written with uppercase characters (Content-Length) and the other header with all lower case characters content-length, then the CS:GO code will reocognize only the first and allocate a buffer with whatever size is within the field. The second header is however missed by the CS:GO code but not by curl. Here is an example HTTP response to demonstrate this:

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

If such a response is received, a buffer of size 1337 is allocated. However, the second Content-Length header tells the HTTP client, in this case curl, that no data will follow. This means that no data is ever actually written into the file buffer. The next bug is that CS:GO does not check if the data that has been received matches the size of the buffer. It will still write the allocated buffer into a file. However, since no data has been written, an attacker controlled size of uninitalized Heap memory is written to the file.

An attacker can then use the NETMsg_File message to have the client upload the just created file containing uninitialized memory. The attacker is then able to view memory contents of the user's process that have been freed before. In our case, we parsed the file and searched for pointers that we used to break ASLR in the client's game process and further exploit the client.

Bug #2: OOB access in CSVCMsg_SplitScreen

The source engine supports splitscreen users in games. We noticed this fact when looking through the available protobuf messages for CS:GO clients when we spotted the following message:

message CSVCMsg_SplitScreen {
    optional .ESplitScreenMessageType type = 1 [default = MSG_SPLITSCREEN_ADDUSER];
    optional int32 slot = 2;
    optional int32 player_index = 3;
}

This message was interesting to us, as it contained an index. As it turns out, it is not the player_index but the slot field that is used as an array index into a statically sized, global array based in engine.dll.

The following screenshot must be understood with the context in mind that ecx points to a global array in the .data section of engine.dll. edx is controlled by an attacker and corresponds to the slot field. There are no checks made on this value:

As can be seen, a pointer to some object, probably an object representating a split screen user is fetched from the array. The first byte of the object is then tested for a NULL byte.

if the first byte of whatever the object is pointing to is 0, the function continues execution and arrives at a section that is highly interesting to an attacker:

Keep in mind that ebx was a value that was derived through an OOB access and could be attacker controlled.

What we see here is that a vtable is dereferenced at offset 8 from ebx. This vtable is then used to jump to a dynamic location.

This means that if an attacker can control the contents of what ebx points to, he can point to a fake vtable under his control and ultimately control the Program Counter and thus gains the ability to execute code remotely.

Exploitation

With these two powerful bugs at hand, we went ahead and wrote an exploit. The exploitation strategy was to use the info leak to break ASLR and obtain the base address of the engine.dll file in memory. From there, we could use the OOB access to hijack the eip register and make it point somewhere useful in engine.dll and execute a ROP chain.

Breaking ASLR

Breaking ASLR happens in two steps:

  1. Allocate and deallocate an object containing a pointer to engine.dll thousands of times on the heap.
  2. Have the client write multiple files of uninitialized memory of the same size as the object created in the previous step to disk and upload it to the server. By abusing known behavior of the Windows Heap allocator and of the objects, it is extremely likely that one of the objects containing a pointer to engine.dll can be found in the file.

During testing, this exploit fails around 2/100 times.

We found that the message CSVCMsg_SendTable can be sent a variable amount of times to the client, where each message allocates a buffer of a variable number of sendprop_t objects on the heap. As it turned out, this object contains a function pointer into engine.dll. It's definition is shown here:

message CSVCMsg_SendTable
{
	message sendprop_t
	{
		optional int32 type = 1;				// SendPropType
		optional string var_name = 2;
		optional int32 flags = 3;
		optional int32 priority = 4;
		optional string dt_name = 5;			// if pProp->m_Type == DPT_DataTable || IsExcludeProp
		optional int32 num_elements = 6;		// else if pProp->m_Type == DPT_Array
		optional float low_value = 7;			// else ...
		optional float high_value = 8;			// 		...
		optional int32 num_bits = 9;			//		...
	};

	optional bool is_end = 1;
	optional string net_table_name = 2;
	optional bool needs_decoder = 3;
	repeated sendprop_t props = 4;
}

We created this message and sent it 256 times with some unique values, as demonstrated here:

Python
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)

The reason for these unique values is that we can search them for them in the files the client uploads, which contain uninitialized memory. If we find these values, we can be sure that a sendprop_t object, along with a function pointer has been included in the info leak files.

Here is the corresponding code that parses the uninitialized memory sent by a client:

Python
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 

By simply subtracting the offset of the vtable within engine.dll, it was possible to leak the client's engine.dll base address in memory.

Hijacking RIP

We mentioned that the second bug, an OOB access can be used to control a pointer. Since the array where the OOB access occurs in is a global variable and located within the .data section of engine.dll, we thought that it would be best to search for a controlled value within this .dll file to make the pointer, contained within ebx as shown previously, point to an attacker-controlled fake object containing a fake vtable.

As it turns out, one of the mechanisms through which server and client setup a game are convars. These convars contain information such as the URL from which to download files from or any other configuration settings of a server or client.

They are sent through the CMsg_CVars message

message CMsg_CVars
{
	message CVar
	{
		optional string name = 1;
		optional string value = 2;
		optional uint32 dictionary_name = 3;		// In order to save on connect packet size convars that are known will have their dictionary name index sent here
	}

	repeated CVar cvars = 1;
}

message CNETMsg_SetConVar
{
	optional CMsg_CVars convars = 1;
}

As can be seen here, a variable amount of convars is sent to the client by the server, each containing a controlled name and value field. These convars are global objects, located within engine.dll. When a server sends a convar, the string value is copied to the heap and a pointer to it saved within the global convar's object.

This means that if our exploit setup a fake object by crafting a string value containing a fake object and vtable, a pointer to it is stored at a known offset within the global binary.

Here is an illustration showing the chain of pointers that is going to happen:

The illustration shows how the splitscreen array OOB is used to interpret the pointer to the string value of a convar as an object. The fake object's vtable pointer points back into engine.dll into another convar. The convars turned out to be a very powerful gadget, as they could take both string and integer values and store them each into their object's memory.

With this target memory layout in mind, let's look at the code that dereferences the fake object to vtable to eip again:

Keep in mind, ebx, if the slot field is set accordingly, contains the pointer to the controlled string value of a convar. It then dereferences it at offset 8 and moves the result into eax. This corresponds to the fake vtable pointer pointing back at the convar in the illustration. eax is then dereferenced at offset 0xAC. By setting up another convar with an integer value, we can control the result of this pointer dereference which is then call'd and thus arbitrary RIP control is gained.

Since all offsets are known, this step of the exploit chain is 100% reliable.

ROP

We then utilized a technique called ROPchaining to setup a an attacker controlled stack and finally execute the ShellExecuteA() Windows standard library function to execute arbitrary system commands. In our case, we simply spawned a calculator.

Reproduction

Attached is a poc.zip file containing all required files to launch the PoC exploit. Unpack it into a directory and activate its Python3 virtual environment via the command (on Windows' cmd):

.\poc_env\Scripts\activate

Then execute the script through python .\poc.py

Then, on Windows, start the CS:GO game and activate the developer console:

  1. Start the game and within the game settings enable the developer console. Game-> Enable Develoepr Console-> yes
  2. Then, within the settings go to Mouse / Keyboard-> UI keys -> Toggle Developer Consoleand set it to your preferred key

Finally, open the developer console and connect to the fake server via the command:

connect YOUR_IP:1337

Replace YOUR_IP with your local LAN IP (192.*)

A calculator should be opened. If the exploit fails for some reason, just try again. Please do not hesitate to point out exploit failures or questions on reproduction. We have tested the exploit highly successfully against 3 different Windows 10 machines.

Impact

This exploit allows an attacker in control of a malicious CS:GO server to execute arbitrary code, including malware, on any client that connects to the server. An attacker could steal Steam credentials or take over the machine and use it for further malicious purposes. These two vulnerabilities can be exploited extremely reliable on both Windows and Linux clients.

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

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 11 min read.

Context

CS:GO dedicated servers can host custom maps and game modes, and those depend on custom files. A client that connects to such a server downloads the required files dynamically. Normally the server maintainer writes a list of required files into a .res file that has the same name as the map the server is running on. The client-side HTTP download of those files is therefore one more place where a game client talks to an untrusted server, and it is where the first of the two bugs in this report lives.

The second bug is in the Source engine's splitscreen support. The engine exposes a protobuf message, CSVCMsg_SplitScreen, that carries a slot index, and that index is used without checks to reach into a statically sized global array in engine.dll.

Chained together, the two bugs gave an extremely reliable exploit for CS:GO on Windows: an out-of-bounds access that leads to RIP control, plus an information leak that breaks ASLR. The memory leak was initially reported separately, and the OOB access in another report; this report puts both bugs in one place because they are two completely unique bugs. The program rated the report Critical (9.6).

Setup

The exploit was written against CS:GO clients on Windows, with the client-side download code also reversed on Linux. The PoC ships as a poc.zip containing all required files, including a Python 3 virtual environment. The attacker runs a fake server from that package and the victim connects to it from the game's developer console. The exploit was tested against 3 different Windows 10 machines.

Finding it

The starting point was the custom file download. After reversing the code that handles the HTTP download on the client side on Linux, the researchers found it was handled by curl, with logic along these lines:

  1. Create a CURL object and set all necessary options (URL, timeout, User-Agent etc).
  2. Register a callback that is called for every HTTP header the server sends.
  3. Register a callback that is called when the data of the body of the HTTP response is received.

The callbacks themselves do the following:

  1. The header callback looks for the Content-Length header and uses its value to allocate a buffer to fit the file into. It does so through a case-sensitive string search.
  2. The write callback then writes the data that is received into the buffer.
  3. After the download finished, it is written to the destination file.

The case-sensitive search is the flaw. If two Content-Length headers are sent, one written as Content-Length and the other as content-length, the CS:GO code recognises only the first and allocates a buffer of whatever size that field holds. The second header is missed by the CS:GO code but not by curl.

The second bug was spotted while looking through the available protobuf messages for CS:GO clients. The splitscreen message stood out because it contains an index:

Text
message CSVCMsg_SplitScreen {
    optional .ESplitScreenMessageType type = 1 [default = MSG_SPLITSCREEN_ADDUSER];
    optional int32 slot = 2;
    optional int32 player_index = 3;
}

As it turns out, it is not the player_index but the slot field that is used as an array index into a statically sized, global array based in engine.dll, and no checks are made on the value.

Exploitation

Step 1: leak uninitialised heap memory through the download

Send an HTTP response with two Content-Length headers that differ only in case:

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

With this response, a buffer of size 1337 is allocated. The second Content-Length header tells curl that no data will follow, so no data is ever written into the file buffer. CS:GO does not check whether the data received matches the size of the buffer, and still writes the allocated buffer into a file. Since nothing was written, an attacker-controlled size of uninitialised heap memory ends up in the file.

The attacker then uses the NETMsg_File message to have the client upload the just created file containing uninitialised memory back to the server. That exposes memory contents of the user's process that had been freed before. The researchers parsed the file and searched for pointers that they used to break ASLR in the client's game process.

Step 2: turn the splitscreen slot into a controlled pointer

The OOB access happens in a function where ecx points to a global array in the .data section of engine.dll, and edx is controlled by the attacker and corresponds to the slot field. A pointer to some object, probably an object representing a splitscreen user, is fetched from the array, and the first byte of that object is tested for a NULL byte. If the first byte of whatever the object points to is 0, execution continues to the interesting part: a vtable is dereferenced at offset 8 from ebx, and that vtable is then used to jump to a dynamic location. ebx was derived through the OOB access and could be attacker controlled.

So if an attacker can control the contents of what ebx points to, they can point to a fake vtable under their control and ultimately control the Program Counter, which gives remote code execution.

Step 3: break ASLR

Breaking ASLR happens in two steps:

  1. Allocate and deallocate an object containing a pointer to engine.dll thousands of times on the heap.
  2. Have the client write multiple files of uninitialised memory of the same size as the object created in the previous step to disk and upload them to the server. By abusing known behaviour of the Windows heap allocator and of the objects, it is extremely likely that one of the objects containing a pointer to engine.dll can be found in the file.

During testing this step fails around 2/100 times.

The object used for the spray is a sendprop_t. The message CSVCMsg_SendTable can be sent a variable amount of times to the client, and each message allocates a buffer of a variable number of sendprop_t objects on the heap. That object contains a function pointer into engine.dll:

Text
message CSVCMsg_SendTable
{
	message sendprop_t
	{
		optional int32 type = 1;				// SendPropType
		optional string var_name = 2;
		optional int32 flags = 3;
		optional int32 priority = 4;
		optional string dt_name = 5;			// if pProp->m_Type == DPT_DataTable || IsExcludeProp
		optional int32 num_elements = 6;		// else if pProp->m_Type == DPT_Array
		optional float low_value = 7;			// else ...
		optional float high_value = 8;			// 		...
		optional int32 num_bits = 9;			//		...
	};

	optional bool is_end = 1;
	optional string net_table_name = 2;
	optional bool needs_decoder = 3;
	repeated sendprop_t props = 4;
}

The message is created and sent 256 times with some unique values:

Python
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)

The unique values are there so they can be searched for in the files the client uploads. If they are found, it is certain that a sendprop_t object, along with a function pointer, has been included in the info leak files. The parsing code looks for exactly those markers:

Python
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

By simply subtracting the offset of the vtable within engine.dll, it was possible to leak the client's engine.dll base address in memory.

Step 4: hijack RIP

Because the array where the OOB access occurs is a global variable in the .data section of engine.dll, the plan was to search for a controlled value within that DLL so that the pointer contained in ebx points to an attacker-controlled fake object containing a fake vtable.

One of the mechanisms through which server and client set up a game are convars, which hold information such as the URL from which to download files or any other configuration settings of a server or client. They are sent through the CMsg_CVars message:

Text
message CMsg_CVars
{
	message CVar
	{
		optional string name = 1;
		optional string value = 2;
		optional uint32 dictionary_name = 3;		// In order to save on connect packet size convars that are known will have their dictionary name index sent here
	}

	repeated CVar cvars = 1;
}

message CNETMsg_SetConVar
{
	optional CMsg_CVars convars = 1;
}

A variable amount of convars is sent to the client by the server, each with a controlled name and value field. These convars are global objects located within engine.dll. When a server sends a convar, the string value is copied to the heap and a pointer to it is saved within the global convar's object. So if the exploit sets up a fake object by crafting a string value containing a fake object and vtable, a pointer to it is stored at a known offset within the global binary.

The chain of pointers works like this: the splitscreen array OOB is used to interpret the pointer to the string value of a convar as an object. The fake object's vtable pointer points back into engine.dll into another convar. The convars turned out to be a very powerful gadget, as they could take both string and integer values and store them each into their object's memory.

Back in the dereference code, ebx, if the slot field is set accordingly, contains the pointer to the controlled string value of a convar. It dereferences it at offset 8 and moves the result into eax, which corresponds to the fake vtable pointer pointing back at the convar. eax is then dereferenced at offset 0xAC. By setting up another convar with an integer value, the result of this pointer dereference can be controlled, and it is then call'd, giving arbitrary RIP control. Since all offsets are known, this step of the exploit chain is 100% reliable.

Step 5: ROP and shell

A technique called ROP chaining was used to set up an attacker-controlled stack and finally execute the ShellExecuteA() Windows standard library function to execute arbitrary system commands. In this case the exploit simply spawned a calculator.

Reproduction

Unpack poc.zip into a directory and activate its Python 3 virtual environment (on Windows' cmd):

.\poc_env\Scripts\activate

Then execute the script through python .\poc.py.

On Windows, start the CS:GO game and activate the developer console:

  1. Start the game and within the game settings enable the developer console. Game-> Enable Develoepr Console-> yes
  2. Then, within the settings go to Mouse / Keyboard-> UI keys -> Toggle Developer Consoleand set it to your preferred key

Finally, open the developer console and connect to the fake server via the command:

connect YOUR_IP:1337

Replace YOUR_IP with your local LAN IP (192.*). A calculator should be opened. If the exploit fails for some reason, just try again.

Root cause

Two independent mistakes combine here.

In the download path, the client parses HTTP headers itself with a case-sensitive search for Content-Length, while curl, which actually performs the transfer, treats header names case-insensitively. The two disagree about which length applies, so the client allocates a buffer from one header while curl follows the other and delivers no body. On top of that, the client never verifies that the number of bytes received matches the size of the buffer before writing the buffer to disk, so uninitialised heap memory is persisted and can be exfiltrated with NETMsg_File.

In the splitscreen path, the slot field of CSVCMsg_SplitScreen is used directly as an index into a statically sized global array in engine.dll with no bounds check. The fetched pointer is only tested for a NULL first byte, and the object it points to is then dereferenced for a vtable at offset 8 and called. An out-of-bounds slot therefore turns into control of a pointer that is later used as an object, and from there into control of the Program Counter. The info leak breaks ASLR, giving the base address needed for the RIP hijack.

Impact

An attacker in control of a malicious CS:GO server can execute arbitrary code, including malware, on any client that connects to the server. An attacker could steal Steam credentials or take over the machine and use it for further malicious purposes. The report states the two vulnerabilities can be exploited extremely reliably on both Windows and Linux clients.

Fix

The report does not describe any fix or vendor response. What the code needs is a case-insensitive comparison for Content-Length (or deferring entirely to the HTTP library's parsing), a check that the received body length matches the allocated buffer before the file is written, and a bounds check on the slot field before it is used to index the splitscreen array.

Variants to test

  • Duplicate headers with different casing on any client that parses HTTP itself while delegating the transfer to a library: send Content-Length and content-length with different values and see whether the resulting file contains uninitialised memory or is truncated.
  • Other length-bearing headers (Transfer-Encoding, Content-Range) parsed by hand next to a library that parses them differently.
  • Any protobuf field used as an array index, such as slot here: send negative and very large values and watch for reads outside the array.
  • Object pointers reachable from global state, such as convar string values, used as fake objects when an OOB read can be turned into a dereference.
  • File upload messages such as NETMsg_File on other clients, to see whether a server can pull arbitrary client-side files back.

Hunting notes

This kind of bug hides where a game client or any other application talks to an untrusted server: custom content download, server-provided configuration, and the protobuf or binary messages exchanged during connection. The signals are hand-rolled parsing next to a mature library (here curl), fields that look like indices, and global arrays in .data. The researchers showed impact by chaining the leak into a full exploit that spawned a calculator, and by demonstrating reliability (around 2/100 failures for the ASLR step, 100% for the RIP control step) across 3 Windows 10 machines, .

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 30 min read.

What happened, in plain words

A security researcher found two separate bugs in the game Counter-Strike: Global Offensive (CS:GO), made by Valve, and showed that putting them together lets a malicious game server run any program it likes on the computer of anyone who connects to it. The two bugs are:

  1. A memory leak in the file download feature. When you join a CS:GO server, the server can tell your game to download extra files (custom maps, game modes and so on). The game asks the server for those files over HTTP, the same protocol your browser uses. A mistake in how the game reads one particular HTTP header lets a malicious server make the game save a chunk of the computer's memory to a file, and then upload that file back to the server. That memory can contain addresses the attacker needs for the second bug.
  2. An out-of-bounds read in the splitscreen feature. The game engine has a message that carries a number called slot, meant to pick one of the splitscreen players. The game uses that number to look up an entry in a fixed-size list without checking whether the number is inside the list. A malicious server can send a number that points outside the list, and from there steer the game into running code the attacker chose.

Neither bug alone is enough. The first one tells the attacker where things are in memory (defeating a protection called ASLR, explained below). The second one lets the attacker take control of what the processor does next. Together they gave an exploit that worked on almost every try. The report was rated Critical with a score of 9.6.

A few words you will meet constantly below:

  • Server and client. The server is the computer that hosts the game; the client is your copy of the game on your own machine. In a normal match the server is trusted. Here the attacker runs the server, so everything the server sends is hostile.
  • Exploit. A concrete set of steps that turns a bug into an actual effect, here running a program of the attacker's choice.
  • Memory. The working space where a running program keeps its data. It is divided into regions, and the game's code and data live in files loaded into it, such as engine.dll.
  • Pointer. A number that is the address of something in memory, like a house number telling you where to find a building. Programs use pointers constantly to find their own data.
  • Heap. The part of memory a program uses for data it creates while running, as opposed to its fixed code. When a program frees a heap object, the contents usually stay there until something else overwrites them, which is why a leak can expose old data.
  • ASLR. Address Space Layout Randomisation. Each time a program starts, the operating system places its code and data at unpredictable addresses, so an attacker who does not know those addresses cannot point at them. Breaking ASLR means finding out the addresses anyway.
  • RIP / Program Counter. The register (a small slot inside the processor) that holds the address of the next instruction to run. Controlling it means controlling what the program does next.
  • Protobuf. A way of encoding structured messages (named fields with values) so two programs can exchange them. The game's network messages are defined this way.

Context

CS:GO dedicated servers can host custom maps and game modes, and those depend on custom files. A client that connects to such a server downloads the required files dynamically. Normally the server maintainer writes a list of required files into a .res file that has the same name as the map the server is running on. The client-side HTTP download of those files is therefore one more place where a game client talks to an untrusted server, and it is where the first of the two bugs in this report lives.

In plain terms: a CS:GO server can hand your game a shopping list of extra files, and your game fetches them over the network without you doing anything. That is convenient for custom content, but it means a stranger's server can feed your game data it did not expect. Any feature where your program accepts input from someone you do not trust is a place to look for bugs.

The second bug is in the Source engine's splitscreen support. The engine exposes a protobuf message, CSVCMsg_SplitScreen, that carries a slot index, and that index is used without checks to reach into a statically sized global array in engine.dll.

Unpacking that: the Source engine is the software framework the game is built on. Splitscreen means two or more players sharing one screen and one computer. engine.dll is the engine's main code file on Windows (a DLL is a library of code that programs load and use). A global array is a fixed-size list stored in one known place in the program's memory; "statically sized" means its length is decided when the program is built and never changes. Using a number from the network to pick an entry in such a list, without checking the number is in range, is the classic out-of-bounds bug.

Chained together, the two bugs gave an extremely reliable exploit for CS:GO on Windows: an out-of-bounds access that leads to RIP control, plus an information leak that breaks ASLR. The memory leak was initially reported separately, and the OOB access in another report; this report puts both bugs in one place because they are two completely unique bugs. The program rated the report Critical (9.6) with a bounty of 7500.00 USD, and it was disclosed on 2021-05-17.

An information leak is any bug that lets an attacker see data they should not see, here the contents of the game's memory. RIP control means the attacker can decide the next instruction the processor runs. Chaining means using one bug to set up the next, like using a first key to open a drawer that holds a second key.

Setup

The exploit was written against CS:GO clients on Windows, with the client-side download code also reversed on Linux. The PoC ships as a poc.zip containing all required files, including a Python 3 virtual environment. The attacker runs a fake server from that package and the victim connects to it from the game's developer console. The exploit was tested against 3 different Windows 10 machines.

Some terms here:

  • Reversing means taking a compiled program and working out what it does, usually by reading its machine code in a tool called a disassembler. The researcher did this to the download code to understand its logic.
  • PoC stands for proof of concept: a small demonstration that the bug is real and exploitable.
  • Python is a programming language often used for quick tooling. A virtual environment is a private folder holding the exact Python packages a project needs, so it does not interfere with the rest of the computer.
  • Developer console is a text window inside the game where you can type commands, including the command to connect to a server by address.

The attacker's fake server is the important part: it pretends to be a normal game server but sends crafted messages. The victim only has to connect to it.

Finding it

The starting point was the custom file download. After reversing the code that handles the HTTP download on the client side on Linux, the researchers found it was handled by curl, with logic along these lines:

  1. Create a CURL object and set all necessary options (URL, timeout, User-Agent etc).
  2. Register a callback that is called for every HTTP header the server sends.
  3. Register a callback that is called when the data of the body of the HTTP response is received.

What this means step by step:

  1. curl is a very widely used library for making HTTP requests; your browser and countless programs use similar code. The game does not write its own HTTP client, it borrows curl. A CURL object is curl's bundle of settings for one transfer. The URL is the address to fetch, the timeout is how long to wait before giving up, and the User-Agent is a label the client sends to say what program it is.
  2. A callback is a function you hand to a library and say "call this when something happens". Here the game registers one callback for headers and one for body data, so it can process the response as it arrives instead of waiting for the whole thing.
  3. The body is the actual file content; the headers are the small lines of metadata that come before it, such as the file's length.

The callbacks themselves do the following:

  1. The header callback looks for the Content-Length header and uses its value to allocate a buffer to fit the file into. It does so through a case-sensitive string search.
  2. The write callback then writes the data that is received into the buffer.
  3. After the download finished, it is written to the destination file.

In everyday terms: Content-Length is the header a web server uses to announce how big the file is, so the client can reserve exactly the right amount of memory (the buffer) before the data arrives. Case-sensitive means uppercase and lowercase letters count as different, so Content-Length and content-length are two different strings to this code. HTTP itself says header names are case-insensitive, which is the mismatch that matters in a moment.

The case-sensitive search is the flaw. If two Content-Length headers are sent, one written as Content-Length and the other as content-length, the CS:GO code recognises only the first and allocates a buffer of whatever size that field holds. The second header is missed by the CS:GO code but not by curl.

So the game and curl end up reading two different instructions from the same response. The game believes the file is one size; curl believes it is another. Whenever two pieces of software disagree about the same input, an attacker can usually make the disagreement work in their favour.

The second bug was spotted while looking through the available protobuf messages for CS:GO clients. The splitscreen message stood out because it contains an index:

Text
message CSVCMsg_SplitScreen {
    optional .ESplitScreenMessageType type = 1 [default = MSG_SPLITSCREEN_ADDUSER];
    optional int32 slot = 2;
    optional int32 player_index = 3;
}

Line by line:

  • message CSVCMsg_SplitScreen { starts the definition of a network message named CSVCMsg_SplitScreen. The CSVC prefix marks it as a server-to-client message in the Source engine.
  • optional .ESplitScreenMessageType type = 1 [default = MSG_SPLITSCREEN_ADDUSER]; is a field called type that says what kind of splitscreen action this is, for example adding a user. optional means the sender may leave it out, and the default is used then. The = 1 is the field's number on the wire, not its value.
  • optional int32 slot = 2; is a whole number called slot, field number 2. This is the one that turned out to be dangerous.
  • optional int32 player_index = 3; is another whole number, player_index, field number 3. You might expect this to be the one used to pick a player, but it is not.
  • } closes the message.

As it turns out, it is not the player_index but the slot field that is used as an array index into a statically sized, global array based in engine.dll, and no checks are made on the value.

An array index is a position in a list: index 0 is the first entry, index 1 the second, and so on. If the list has, say, ten entries and the program accepts index 5000, it will read memory far past the end of the list. That is an out-of-bounds read: reading outside the area the program meant to read. The value read is then treated as if it were a legitimate list entry, which is where things get dangerous.

Exploitation

Step 1: leak uninitialised heap memory through the download

Send an HTTP response with two Content-Length headers that differ only in case:

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

Line by line:

  • HTTP/1.1 200 OK is the status line: the server says it speaks HTTP version 1.1 and that the request succeeded (200).
  • Content-Type: text/html says the body is HTML text. It is irrelevant to the bug but makes the response look ordinary.
  • Content-Length: 1337 is the first length header, with an uppercase C and L. The game's case-sensitive search finds this one and reserves 1337 bytes.
  • content-length: 0 is the second length header, all lowercase. The game's search does not find it, but curl does, and curl concludes the body is zero bytes long.
  • Connection: closed is a header about connection handling, copied as it appears in the report.

With this response, a buffer of size 1337 is allocated. The second Content-Length header tells curl that no data will follow, so no data is ever written into the file buffer. CS:GO does not check whether the data received matches the size of the buffer, and still writes the allocated buffer into a file. Since nothing was written, an attacker-controlled size of uninitialised heap memory ends up in the file.

Uninitialised memory is memory that was reserved but never filled in. It still holds whatever the previous user of that memory left behind, which may be passwords, keys, or, as here, pointers. The attacker chooses the size (1337 in the example), so they choose how much of that leftover memory gets saved to disk.

The attacker then uses the NETMsg_File message to have the client upload the just created file containing uninitialised memory back to the server. That exposes memory contents of the user's process that had been freed before. The researchers parsed the file and searched for pointers that they used to break ASLR in the client's game process.

NETMsg_File is a network message the game uses to move files between client and server. Normally it serves a legitimate purpose; here the attacker abuses it to pull the leaked file back. Parsed means the researchers wrote code to walk through the file's bytes looking for patterns. Freed memory is memory the program has given back for reuse; its old contents often remain until overwritten, which is exactly what makes this leak useful.

Step 2: turn the splitscreen slot into a controlled pointer

The OOB access happens in a function where ecx points to a global array in the .data section of engine.dll, and edx is controlled by the attacker and corresponds to the slot field. A pointer to some object, probably an object representing a splitscreen user, is fetched from the array, and the first byte of that object is tested for a NULL byte. If the first byte of whatever the object points to is 0, execution continues to the interesting part: a vtable is dereferenced at offset 8 from ebx, and that vtable is then used to jump to a dynamic location. ebx was derived through the OOB access and could be attacker controlled.

This paragraph is dense, so here is each piece:

  • ecx, edx, ebx, eax, eip are names of processor registers: tiny storage slots inside the CPU. Machine code moves values between them and memory. eip (called RIP on 64-bit processors) holds the address of the next instruction.
  • .data section is the part of a program file that holds global variables, values that exist for the whole run of the program. Because it is part of engine.dll, its position relative to the start of engine.dll is fixed and known.
  • Object here means a bundle of related data in memory, in this case the data describing one splitscreen user.
  • NULL byte is a byte with value zero. Testing the first byte for zero is a crude way of checking whether the entry looks empty.
  • vtable (virtual method table) is a list of function addresses that object-oriented programs use to decide which function to call for an object. Calling through a vtable means reading an address from that list and jumping to it. If an attacker can supply a fake vtable, they can make the program jump wherever they like.
  • Offset is a distance from a starting point. "Offset 8 from ebx" means the address 8 bytes after the address in ebx.

So if an attacker can control the contents of what ebx points to, they can point to a fake vtable under their control and ultimately control the Program Counter, which gives remote code execution.

Remote code execution (RCE) means an attacker somewhere else on the network gets their own code running on your machine. That is the worst class of bug, because from there they can do anything your user account can do.

Step 3: break ASLR

Breaking ASLR happens in two steps:

  1. Allocate and deallocate an object containing a pointer to engine.dll thousands of times on the heap.
  2. Have the client write multiple files of uninitialised memory of the same size as the object created in the previous step to disk and upload them to the server. By abusing known behaviour of the Windows heap allocator and of the objects, it is extremely likely that one of the objects containing a pointer to engine.dll can be found in the file.

Why this works: the heap allocator is the part of the operating system that hands out and takes back chunks of memory. It reuses freed chunks, often for the next request of a similar size. If the attacker fills the heap with objects that contain a pointer into engine.dll, then frees them, and then asks for a leak of the same size, the leak is likely to land on one of those freed chunks and contain the pointer. This is called a spray: filling memory with many copies of something so that at least one copy ends up where you want it.

During testing this step fails around 2/100 times.

The object used for the spray is a sendprop_t. The message CSVCMsg_SendTable can be sent a variable amount of times to the client, and each message allocates a buffer of a variable number of sendprop_t objects on the heap. That object contains a function pointer into engine.dll:

Text
message CSVCMsg_SendTable
{
	message sendprop_t
	{
		optional int32 type = 1;				// SendPropType
		optional string var_name = 2;
		optional int32 flags = 3;
		optional int32 priority = 4;
		optional string dt_name = 5;			// if pProp->m_Type == DPT_DataTable || IsExcludeProp
		optional int32 num_elements = 6;		// else if pProp->m_Type == DPT_Array
		optional float low_value = 7;			// else ...
		optional float high_value = 8;			// 		...
		optional int32 num_bits = 9;			//		...
	};

	optional bool is_end = 1;
	optional string net_table_name = 2;
	optional bool needs_decoder = 3;
	repeated sendprop_t props = 4;
}

Line by line:

  • message CSVCMsg_SendTable defines a server-to-client message that describes a table of network properties. The game uses such tables to know how to encode and decode values sent over the network.
  • message sendprop_t defines a nested message, one property in the table.
  • optional int32 type = 1; is the property's type, a whole number.
  • optional string var_name = 2; is the property's name, text.
  • optional int32 flags = 3; holds option flags.
  • optional int32 priority = 4; holds a priority.
  • optional string dt_name = 5; is a data-table name, used in some property types as the comment explains.
  • optional int32 num_elements = 6; is how many elements an array property has.
  • optional float low_value = 7; and optional float high_value = 8; are numeric bounds; float is a decimal number.
  • optional int32 num_bits = 9; is how many bits the value uses on the wire.
  • }; closes the nested message.
  • optional bool is_end = 1; marks the last table in a series; bool is true or false.
  • optional string net_table_name = 2; is the table's name.
  • optional bool needs_decoder = 3; says whether a decoder is needed.
  • repeated sendprop_t props = 4; is the list of properties; repeated means zero or more of them.
  • } closes the outer message.

The message is created and sent 256 times with some unique values:

Python
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)

Line by line:

  • def spray_send_table(s, addr, nprops): defines a function that takes a network socket s, a destination address addr, and how many properties nprops to include.
  • table = nmsg.CSVCMsg_SendTable() creates an empty message of the type defined above. nmsg is the module holding the message definitions.
  • table.is_end = False says this is not the last table.
  • table.net_table_name = "abctable" gives the table a name.
  • table.needs_decoder = False says no decoder is needed.
  • for i in range(nprops): repeats the next block once per property.
  • prop = table.props.add() adds a new property to the list and gives us a handle to fill it in.
  • prop.type = 0x1337ee00 sets the type to a distinctive number. The 0x prefix means hexadecimal, a base-16 way of writing numbers.
  • 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 fill the remaining fields with ordinary values.
  • prop.num_bits = 0x00ff00ff sets another distinctive number, used as a second marker.
  • tosend = prepare_payload(table, 9) turns the message into bytes ready for the network; 9 identifies the message type.
  • s.sendto(tosend, addr) sends those bytes to the server address.

The unique values are there so they can be searched for in the files the client uploads. If they are found, it is certain that a sendprop_t object, along with a function pointer, has been included in the info leak files. The parsing code looks for exactly those markers:

Python
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

Line by line:

  • for i in range(len(data) - 0x54): walks a position i through the leaked file, stopping a little before the end so the reads below stay inside the data. data is the file's bytes.
  • vtable_ptr = struct.unpack('<I', data[i:i+4])[0] reads four bytes at position i and interprets them as a 32-bit unsigned integer, little-endian (<I). This is the candidate pointer to the vtable.
  • table_type = struct.unpack('<I', data[i+8:i+12])[0] reads four bytes eight bytes further on, where the type field of a sendprop_t would sit.
  • table_nbits = struct.unpack('<I', data[i+12:i+16])[0] reads four bytes twelve bytes in, where num_bits would sit.
  • if table_type == 0x1337ee00 and table_nbits == 0x00ff00ff: checks whether both markers match. If they do, this really is one of the sprayed objects, not random memory.
  • engine_base = vtable_ptr - OFFSET_VTABLE subtracts the known distance from the start of engine.dll to that vtable, giving the address where engine.dll was loaded this run.

By simply subtracting the offset of the vtable within engine.dll, it was possible to leak the client's engine.dll base address in memory.

The base address is where a file's code was placed in memory this time. Once you know it, every function and variable inside that file has a known address, because their distances from the base are fixed. That is exactly what ASLR was hiding, and the leak hands it over.

Step 4: hijack RIP

Because the array where the OOB access occurs is a global variable in the .data section of engine.dll, the plan was to search for a controlled value within that DLL so that the pointer contained in ebx points to an attacker-controlled fake object containing a fake vtable.

In other words: the attacker needs the out-of-bounds index to land on a spot in memory whose contents they control. Since the array lives inside engine.dll at a known place, they can look through the DLL for a value they can influence, and use that as the stepping stone.

One of the mechanisms through which server and client set up a game are convars, which hold information such as the URL from which to download files or any other configuration settings of a server or client. They are sent through the CMsg_CVars message:

Text
message CMsg_CVars
{
	message CVar
	{
		optional string name = 1;
		optional string value = 2;
		optional uint32 dictionary_name = 3;		// In order to save on connect packet size convars that are known will have their dictionary name index sent here
	}

	repeated CVar cvars = 1;
}

message CNETMsg_SetConVar
{
	optional CMsg_CVars convars = 1;
}

Line by line:

  • message CMsg_CVars defines a message carrying a list of settings.
  • message CVar defines one setting: a name and a value.
  • optional string name = 1; is the setting's name, text.
  • optional string value = 2; is the setting's value, text.
  • optional uint32 dictionary_name = 3; is a number that can stand in for a well-known setting's name, to keep the connection packet small, as the comment says. uint32 is a 32-bit unsigned whole number.
  • repeated CVar cvars = 1; is the list of settings.
  • message CNETMsg_SetConVar is the network message that carries the settings to the client.
  • optional CMsg_CVars convars = 1; is the settings list inside it.

A convar (console variable) is a named setting in the engine, such as a download URL or a gameplay option. The server can set them on the client when the game starts, which is why they are a channel the attacker controls.

A variable amount of convars is sent to the client by the server, each with a controlled name and value field. These convars are global objects located within engine.dll. When a server sends a convar, the string value is copied to the heap and a pointer to it is saved within the global convar's object. So if the exploit sets up a fake object by crafting a string value containing a fake object and vtable, a pointer to it is stored at a known offset within the global binary.

This is the clever part: the attacker cannot write directly into engine.dll, but they can make the game store a pointer to their own text in a known place. The out-of-bounds index then reaches that pointer and treats the attacker's text as if it were a real object.

The chain of pointers works like this: the splitscreen array OOB is used to interpret the pointer to the string value of a convar as an object. The fake object's vtable pointer points back into engine.dll into another convar. The convars turned out to be a very powerful gadget, as they could take both string and integer values and store them each into their object's memory.

A gadget, in exploitation, is a small existing piece of the program that the attacker reuses for their own purpose. Here the convar machinery is the gadget: it lets the attacker place both text and numbers at chosen places in memory.

Back in the dereference code, ebx, if the slot field is set accordingly, contains the pointer to the controlled string value of a convar. It dereferences it at offset 8 and moves the result into eax, which corresponds to the fake vtable pointer pointing back at the convar. eax is then dereferenced at offset 0xAC. By setting up another convar with an integer value, the result of this pointer dereference can be controlled, and it is then call'd, giving arbitrary RIP control. Since all offsets are known, this step of the exploit chain is 100% reliable.

Walking through it: the program reads a pointer from the fake object (offset 8), which lands on the attacker's second convar, then reads another pointer from that (offset 0xAC, which is 172 in decimal), and finally calls it. Each hop is a known distance, so the attacker can lay out their convars to make the final call go exactly where they want. Dereference means follow a pointer to the thing it points at. call is the processor instruction that jumps to a function and comes back afterwards.

Step 5: ROP and shell

A technique called ROP chaining was used to set up an attacker-controlled stack and finally execute the ShellExecuteA() Windows standard library function to execute arbitrary system commands. In this case the exploit simply spawned a calculator.

ROP (Return-Oriented Programming) is a way of making a program do things without injecting new code. The attacker strings together small snippets of code that already exist in the program, each ending in a return instruction, so that each snippet hands control to the next. The stack is the area of memory the processor uses to keep track of function calls and local data; controlling it lets the attacker line up the snippets in order. ShellExecuteA() is a standard Windows function that launches a program or opens a file, so calling it with the right arguments runs any command. Opening the calculator is the harmless demonstration that code execution worked.

Reproduction

Unpack poc.zip into a directory and activate its Python 3 virtual environment (on Windows' cmd):

.\poc_env\Scripts\activate

This runs the activation script inside the virtual environment folder, which makes the current command window use that environment's Python and packages.

Then execute the script through python .\poc.py.

This starts the fake server from the proof-of-concept script.

On Windows, start the CS:GO game and activate the developer console:

  1. Start the game and within the game settings enable the developer console. Game-> Enable Develoepr Console-> yes
  2. Then, within the settings go to Mouse / Keyboard-> UI keys -> Toggle Developer Consoleand set it to your preferred key

These are the menu steps to switch on the in-game console and bind a key to open it. The wording is copied as it appears in the report.

Finally, open the developer console and connect to the fake server via the command:

connect YOUR_IP:1337

This is the game's console command to join a server at the given address and port. YOUR_IP is a placeholder for the attacker machine's address and 1337 is the port the fake server listens on.

Replace YOUR_IP with your local LAN IP (192.*). A calculator should be opened. If the exploit fails for some reason, just try again.

A LAN IP is the address of a machine on the local network, typically starting with 192.168. Using it means the test stays inside the home or office network.

Root cause

Two independent mistakes combine here.

In the download path, the client parses HTTP headers itself with a case-sensitive search for Content-Length, while curl, which actually performs the transfer, treats header names case-insensitively. The two disagree about which length applies, so the client allocates a buffer from one header while curl follows the other and delivers no body. On top of that, the client never verifies that the number of bytes received matches the size of the buffer before writing the buffer to disk, so uninitialised heap memory is persisted and can be exfiltrated with NETMsg_File.

Exfiltrated means stolen and sent out, here from the victim's machine back to the attacker's server.

In the splitscreen path, the slot field of CSVCMsg_SplitScreen is used directly as an index into a statically sized global array in engine.dll with no bounds check. The fetched pointer is only tested for a NULL first byte, and the object it points to is then dereferenced for a vtable at offset 8 and called. An out-of-bounds slot therefore turns into control of a pointer that is later used as an object, and from there into control of the Program Counter. The info leak breaks ASLR, giving the base address needed for the RIP hijack.

A bounds check is the simple test "is this number between the smallest and largest valid index?" that the code was missing. It is the difference between a safe lookup and reading whatever happens to sit next to the list.

Impact

An attacker in control of a malicious CS:GO server can execute arbitrary code, including malware, on any client that connects to the server. An attacker could steal Steam credentials or take over the machine and use it for further malicious purposes. The report states the two vulnerabilities can be exploited extremely reliably on both Windows and Linux clients.

Credentials are the username and password (or session data) that prove who you are. Stealing Steam credentials means taking over the victim's game account and anything tied to it.

Fix

The report does not describe any fix or vendor response. What the code needs is a case-insensitive comparison for Content-Length (or deferring entirely to the HTTP library's parsing), a check that the received body length matches the allocated buffer before the file is written, and a bounds check on the slot field before it is used to index the splitscreen array.

In everyday terms: agree with the library on what the headers mean, do not save a file whose contents do not match its declared size, and never trust a number from the network to be a valid position in a list.

Variants to test

  • Duplicate headers with different casing on any client that parses HTTP itself while delegating the transfer to a library: send Content-Length and content-length with different values and see whether the resulting file contains uninitialised memory or is truncated.
  • Other length-bearing headers (Transfer-Encoding, Content-Range) parsed by hand next to a library that parses them differently.
  • Any protobuf field used as an array index, such as slot here: send negative and very large values and watch for reads outside the array.
  • Object pointers reachable from global state, such as convar string values, used as fake objects when an OOB read can be turned into a dereference.
  • File upload messages such as NETMsg_File on other clients, to see whether a server can pull arbitrary client-side files back.

Truncated means cut short. Transfer-Encoding and Content-Range are other HTTP headers that describe how much data is coming or which part of a file it is, so they are natural places to look for the same kind of disagreement.

Hunting notes

This kind of bug hides where a game client or any other application talks to an untrusted server: custom content download, server-provided configuration, and the protobuf or binary messages exchanged during connection. The signals are hand-rolled parsing next to a mature library (here curl), fields that look like indices, and global arrays in .data. The researchers showed impact by chaining the leak into a full exploit that spawned a calculator, and by demonstrating reliability (around 2/100 failures for the ASLR step, 100% for the RIP control step) across 3 Windows 10 machines, .

Hand-rolled parsing means code written by hand to read a format, instead of using a well-tested library. It is a common source of bugs because the hand-written code rarely handles every odd case the way the standard says it should.

Glossary

  • ASLR (Address Space Layout Randomisation): an operating system defence that loads a program's code and data at unpredictable addresses each run, so attackers cannot hard-code addresses.
  • Array index: a number that selects a position in a list; index 0 is the first entry.
  • Base address: the memory address where a loaded file (such as engine.dll) starts this run; everything inside it is at a fixed distance from there.
  • Bounds check: a test that a number used as an index lies within the valid range of a list.
  • Buffer: a reserved block of memory used to hold data, here a downloaded file.
  • Callback: a function you give to a library so it can call you when something happens, such as a header arriving.
  • Case-sensitive: treating uppercase and lowercase letters as different characters.
  • Chaining: using one bug to enable the next, so small bugs combine into a serious attack.
  • Client: the program on your own computer, here your copy of the game.
  • Convar (console variable): a named setting in the game engine, such as a download URL, that the server can send to the client.
  • Credentials: the data that proves your identity, such as a username and password or a login session.
  • curl: a widely used library and tool for making HTTP requests.
  • .data section: the part of a program file holding global variables that exist for the whole run.
  • Dereference: follow a pointer to read or use the thing it points at.
  • Developer console: a text window inside the game where commands can be typed.
  • DLL: a library of code on Windows that programs load and use.
  • Exfiltrate: steal data and send it out to the attacker.
  • Exploit: concrete steps that turn a bug into a real effect, such as running code.
  • Float: a number with a decimal part.
  • Gadget: a small existing piece of a program that an attacker reuses for their own purpose.
  • Global array: a fixed-size list stored in one known place in a program's memory.
  • Heap: the part of memory a program uses for data created while it runs; freed chunks often keep their old contents.
  • Heap allocator: the operating system component that hands out and reclaims heap memory.
  • HTTP: the protocol browsers and many programs use to fetch files and pages over a network.
  • Information leak: a bug that lets an attacker see data they should not see, such as memory contents.
  • LAN IP: the address of a machine on a local network, often starting with 192.168.
  • NULL byte: a byte with value zero.
  • Object: a bundle of related data in memory, such as the data describing one splitscreen user.
  • Offset: a distance, in bytes, from a starting address.
  • Out-of-bounds read: reading memory outside the area a program meant to read, usually because an index was not checked.
  • Pointer: a number that is the memory address of something, like a house number.
  • PoC (proof of concept): a small demonstration that a bug is real and exploitable.
  • Program Counter (RIP / eip): the processor register holding the address of the next instruction to run.
  • Protobuf: a way of encoding structured messages with named fields so two programs can exchange them.
  • Register: a tiny storage slot inside the processor, such as eax, ebx, ecx, edx or eip.
  • Remote code execution (RCE): an attacker elsewhere on the network gets their own code running on your machine.
  • Reversing: working out what a compiled program does by reading its machine code.
  • ROP (Return-Oriented Programming): building behaviour out of small existing code snippets that each end in a return, so control passes from one to the next.
  • Server: the computer hosting the game, here controlled by the attacker.
  • Spray: filling memory with many copies of a value so at least one lands where the attacker needs it.
  • Stack: the memory area the processor uses to track function calls and local data.
  • Truncated: cut short, here a file smaller than expected.
  • Uninitialised memory: memory that was reserved but never filled in, so it still holds whatever was there before.
  • User-Agent: a label a client sends to say which program it is.
  • Virtual environment: a private folder holding the exact Python packages a project needs.
  • vtable (virtual method table): a list of function addresses an object uses to decide which function to call; a fake vtable lets an attacker choose where the program jumps.
  • engine.dll: the Source engine's main code library on Windows, where the splitscreen array lives.

More by simonscannell

View all

13 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.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.