Skip to content
Memory corruption Disclosed report Advanced

[Portal 2] Remote Code Execution via voice packets

A stack buffer overflow in the voice data handling of Portal 2 allows a remote attacker to execute arbitrary code on another player's machine by sending a crafted voice packet. The attacker can open the calculator on the victim's computer as proof of code execution.

gamer7112 Follow

Originally disclosed on HackerOne

Bounty$5,000 Critical View original
  • Triaged in 5 days
  • Fixed in 2 months
  • Paid in 2 months
  • Disclosed after 18 months

Summary by the program

#Description RCE can be achieved on other players via voice packets due to the lack of length validation when reading into a stack based buffer.

#POC

  1. As the victim, invite the attacker into a game.
  2. Wait until both players have loaded into the game.
  3. Inject the following DLL into the attackers portal 2 process: (source code: )
  4. View that calc has been opened on the victims computer.

If these steps are followed correctly the outcome should look like so

#Vulnerable Code

C++
bool CGameClient::ProcessVoiceData( CLC_VoiceData *msg )
{
	char voiceDataBuffer[4096];

	msg->m_DataIn.ReadBits( voiceDataBuffer, msg->m_nLength );

	SV_BroadcastVoiceData( this, Bits2Bytes(msg->m_nLength), voiceDataBuffer, msg->m_xuid ); // length is in bits

	return true;
}

Impact

RCE allows arbitrary code execution on the attacker's victim.

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

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The code reads a length-controlled amount of data into a fixed-size stack buffer without validating that the length does not exceed the buffer size.

Impact

An attacker could execute arbitrary code on the victim's computer, as demonstrated by opening the calculator.

What the attacker needed

Victim invites attacker to a game; both players loaded into the game; attacker injects a DLL into their game

How it was found

  1. As the victim, invite the attacker into a game.
  2. Wait until both players have loaded into the game.
  3. Inject the provided DLL into the attacker's Portal 2 process.
  4. Observe that the calculator has opened on the victim's computer.

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 report has not been written yet. The Original tab links to the source.

A stack buffer overflow happens when a program copies more data into a fixed-size memory area than it can hold. Here, the game reads voice data into a 4096-byte buffer without checking the length, so an attacker can send extra data and run their own code, taking control of the victim's computer.

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.

More by gamer7112

View all

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

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.