Game On – Finding vulnerabilities in Valve’s “Steam Sockets”
A signed/unsigned mismatch in Valve's Game Networking Sockets library allowed a negative segment offset to be interpreted as a large unsigned value, leading to a heap-based buffer underflow when reassembling unreliable message fragments. An attacker could crash a game client or server, and in some third-party games potentially execute arbitrary code.
Published on research.checkpoint.com
The beautiful thing about video games is that there’s something for everyone. You can play as a 19-year-old Canadian redhead trying to climb a difficult mountain; or as an insurance inspector sent to decipher the fate of a doomed merchant ship; or as an amnesiac detective juggling a murder case, a workers’ strike and…
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The segment offset was parsed as an unsigned 32-bit integer but later treated as a signed 32-bit integer, so a large unsigned value became a negative offset that bypassed sanity checks and caused a buffer underflow during reassembly.
Impact
An attacker could remotely crash a game client or server, and in third-party games using the library, potentially execute arbitrary code on the server and then on connected clients; however, in the tested Valve game (CS:GO), the invalid free caused a crash rather than code execution due to the heap implementation.
What the attacker needed
Network access to game server or client; ability to send crafted GNS segments
The fix
Valve patched the vulnerabilities in version v1.2.0 of the library, and binary updates were shipped to game clients and servers.
How it was found
- Send an unreliable segment with a large offset value that overflows to a negative number when interpreted as signed.
- Ensure the segment is marked as the last segment and has a size larger than the absolute value of the negative offset.
- The library calculates the message size as segment size plus offset, which passes checks.
- The segment is copied to the negative offset in a heap buffer, causing a heap-based buffer underflow.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
The networking library that many Steam games use to send messages had a flaw in how it pieced together large messages split into smaller parts. By sending a specially crafted part with a negative position, an attacker could make the game write data before the intended memory buffer, which could crash the game or, in some cases, let the attacker run their own code.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.