Use after free in WebRTC (CVE-2025-7657)
A use-after-free occurs in WebRTC's P2P TCP socket handling because SendBatch does not detect that the P2PSocket object has been freed, leading to access to freed memory. An attacker could potentially exploit this to cause a crash or possibly execute arbitrary code in the network service.
- Fix shipped in 21 days
Steps to reproduce the problem
Access poc.html after applying diff
Problem Description
Access to the freed object starts at: https://source.chromium.org/chromium/chromium/src/+/main:services/network/p2p/socket_tcp.cc;l=391
return true: https://source.chromium.org/chromium/chromium/src/+/main:services/network/p2p/socket_tcp.cc;l=377
The object is freed at: https://source.chromium.org/chromium/chromium/src/+/main:services/network/p2p/socket_tcp.cc;l=305
In the SendPacket function called by SendBatch, as in the first link, the iterator is stopped via return false when this object is freed.
In the third link, this object is freed, but if you look at the second link, return true is returned, so SendBatch does not detect that this object is freed, and Use-After-Free occurs.
Summary
P2PSocket(this) object is freed, causing Use-After-Free vulnerability
Custom Questions
Type of crash:
Network Service
Crash state:
Access to this object that has been freed
Reporter credit:
jakebiles
Additional Data
Category: Security
Chrome Channel: Not sure
Regression: N/A \
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
Likely the SendBatch function does not correctly detect that the P2PSocket object was freed because a callback returns true instead of false, so it continues to use the dangling pointer.
What the attacker needed
Victim visits a malicious page; Chrome with WebRTC P2P enabled
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 use-after-free is a bug where a program keeps using memory after it has been freed, which can let an attacker control what happens next. Here, a networking component in Chrome frees an object but a batch-sending function fails to notice, so it keeps using the stale pointer. This could crash the browser or, in theory, let an 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.