CVE-2023-0472 - Breaking Down the Use-After-Free WebRTC Exploit in Chrome (pre-109..5414.119)

In early 2023, a high-severity vulnerability, CVE-2023-0472, was revealed in Google Chrome’s WebRTC implementation. This bug affected versions before 109..5414.119, and allowed remote attackers to exploit heap corruption through a specially crafted HTML page. Let’s unpack what happened, how it could be abused, and why keeping your browser up-to-date is absolutely critical.

What is WebRTC?

WebRTC stands for Web Real-Time Communication. It's what lets you use voice and video chat directly in your browser, no plugins needed. Services like Google Meet, Discord, and Facebook Messenger all rely on WebRTC components to work.

What is a Use-After-Free Vulnerability?

A use-after-free bug occurs when a program continues to use a chunk of memory after it has been freed — usually leading to unpredictable behavior, crashes, or, in the worst case, code execution.

In browsers, this is particularly dangerous. If an attacker can trick the browser into accessing freed memory, they could potentially control what’s at that memory location — opening the door for exploits.

How Did CVE-2023-0472 Happen?

Prior to version 109..5414.119, Chrome’s implementation of WebRTC didn’t correctly handle the freeing and subsequent use of certain audio or video resources. A malicious web page could manipulate these objects, causing Chrome to use data that had already been released.

Here’s the official bug entry from Google:
https://bugs.chromium.org/p/chromium/issues/detail?id=1406595
And the NIST entry: https://nvd.nist.gov/vuln/detail/CVE-2023-0472

Proof-of-Concept (PoC) Example

Let’s look at a simplified (sanitized, non-malicious) code snippet to illustrate what the exploit might look like.
*A real-world exploit would be much more complex, but this gives you the general idea.*

<!DOCTYPE html>
<html>
  <head>
    <title>CVE-2023-0472 WebRTC Demo</title>
  </head>
  <body>
    <script>
      // Step 1: Create a WebRTC connection
      let pc = new RTCPeerConnection();

      // Step 2: Add a fake media track
      let stream = new MediaStream();
      let track = new MediaStreamTrack();
      stream.addTrack(track);

      // Step 3: Attach then quickly detach track
      pc.addTrack(track, stream);
      pc.removeTrack(pc.getSenders()[]);

      // Step 4: Trigger code path that uses freed memory
      // (In actual exploit, timings and actions would be more precise)
      setTimeout(() => {
        // Attacker code controlling timing to exploit use-after-free
        pc.createOffer().then(offer => {
          // Continue WebRTC negotiation, possible to reach freed object
          pc.setLocalDescription(offer);
        });
      }, 10);
    </script>
  </body>
</html>

Note: This simplified example does not actually exploit Chrome. But it shows how abusing the lifecycle of WebRTC objects could lead to use-after-free scenarios.

Lures the victim: User visits a malicious web page.

2. Executes crafted JavaScript: The page uses WebRTC APIs in a weird, unexpected sequence that triggers the bug.

Heap corruption: Freed memory is still accessed by Chrome, causing instability.

4. Possible code execution: With enough skill, an attacker might manipulate the heap so the browser runs their code — potentially installing malware, harvesting data, or even taking over the system.

How was it Fixed?

The Chrome team quickly patched this bug. The fix ensures WebRTC objects’ memory is properly managed and reference-counted, closing the window for use-after-free shenanigans.

Mitigation:
Update to Chrome 109..5414.119 or later.

References

- Google Security Bulletin – Stable Channel Update for Desktop
- NVD Entry for CVE-2023-0472
- Chromium Issue 1406595
- WebRTC Exploitation (Project Zero Blog, background)

Summary

CVE-2023-0472 is another reminder that even the most widely used software is vulnerable to subtle memory management bugs. Use-after-free bugs are dangerous, especially in the context of modern browsers like Chrome. The best thing any user can do to protect themselves? Keep your software up to date.

Stay safe online, and be sure to keep an eye on those security bulletins!

Timeline

Published on: 01/30/2023 09:15:00 UTC
Last modified on: 02/06/2023 21:41:00 UTC