Exploit database

GH-e82e7d9fadfd9346a89f79fe29fc0c30

anuththara2007-w/cve-2025-55182-exploit-extension

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

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

content.js

JavaScript · 4,320 bytes
// content.js
// Content script that scans pages for RSC indicators and reports results to background
// ADDED FOR FEATURE 3: dynamicRules support and runtime handlers

let dynamicRules = []; // array of { pattern, description, regex }

// Helper: safe regex creation
function makeRegex(str) {
  try {
    // allow leading/trailing slashes with flags like /foo/i
    const m = str.match(/^\/(.+)\/(\w*)$/i);
    if (m) return new RegExp(m[1], m[2]);
    return new RegExp(str);
  } catch (err) {
    console.warn('Invalid regex', str, err);
    return null;
  }
}

// Existing detection function (example)
function scanForRSCIndicators() {
  try {
    const results = {
      url: location.href,
      title: document.title,
      indicators: []
    };

    // Existing heuristics (examples)
    // 1) Presence of <link rel="modulepreload"> often used with RSC
    if (document.head && document.head.querySelector('link[rel="modulepreload"]')) {
      results.indicators.push({ name: 'modulepreload', reason: 'modulepreload link present' });
    }

    // 2) Server component signature in response inlined as script[type="text/x-component"]
    const rscScripts = Array.from(document.querySelectorAll('script[type="text/x-component"], script[type="text/x-component;charset=UTF-8"]'));
    if (rscScripts.length) {
      results.indicators.push({ name: 'script-x-component', reason: `Found ${rscScripts.length} text/x-component scripts` });
    }

    // 3) Look for server-only markers in DOM (simple example)
    if (document.body && document.body.innerHTML && document.body.innerHTML.includes('__RSC__')) {
      results.indicators.push({ name: '__RSC__ marker', reason: 'Page contains __RSC__ marker' });
    }

    // ADDED FOR FEATURE 3: evaluate dynamicRules
    for (const r of dynamicRules) {
      try {
        const re = makeRegex(r.regex);
        if (!re) continue;
        // Search in HTML and in scripts text
        const hay = document.documentElement && document.documentElement.outerHTML || '';
        if (re.test(hay)) {
          results.indicators.push({ name: r.pattern || 'dynamic', reason: r.description || 'dynamic rule matched' });
        } else {
          // Also check textContent of scripts for matches
          const scripts = Array.from(document.scripts || []);
          for (const s of scripts) {
            const txt = s.textContent || '';
            if (re.test(txt)) {
              results.indicators.push({ name: r.pattern || 'dynamic', reason: r.description || 'dynamic rule matched in script' });
              break;
            }
          }
        }
      } catch (err) {
        console.warn('dynamic rule evaluation failed', err);
      }
    }

    // Post detection to background
    chrome.runtime.sendMessage({ type: 'detection', payload: results }, () => { /* ignore */ });

    // Also expose in window for headless audits
    try {
      window.__rsc_detector_results = window.__rsc_detector_results || [];
      window.__rsc_detector_results.push(results);
    } catch (e) {}

    return results;
  } catch (err) {
    console.error('scanForRSCIndicators error', err);
    return null;
  }
}

// Expose a message listener for adding dynamic rules and running probe
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
  (async () => {
    try {
      const { action, rules } = message || {};
      if (action === 'addDynamicRules') {
        if (Array.isArray(rules)) {
          // Normalize and store in-memory
          dynamicRules = dynamicRules.concat(rules.map((r) => ({ pattern: r.pattern, description: r.description, regex: r.regex })));
          sendResponse({ ok: true });
        } else {
          sendResponse({ ok: false, error: 'rules must be array' });
        }
      } else if (action === 'runProbe') {
        const res = scanForRSCIndicators();
        sendResponse({ ok: true, result: res });
      } else {
        sendResponse({ ok: false, error: 'unknown action' });
      }
    } catch (err) {
      console.error('content script onMessage handler error', err);
      sendResponse({ ok: false, error: err.message });
    }
  })();
  return true;
});

// Run an initial scan on load
try {
  setTimeout(() => {
    scanForRSCIndicators();
  }, 500);
} catch (err) {
  console.error('initial scan failed', err);
}