Exploit database

GH-d059d9fe3875c7e7781f6830815706b0

fortbridge/cve-2026-108097-research

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-108097

1 source

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

Repository files6

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

gadget-inventory/probe_batch.php

PHP · 4,928 bytes
<?php
// probe_batch.php — dynamically probe candidate callables the way the sink
// would: call_user_func_array($candidate, [&$row]) with the lab row shape.
// CLI only. Read-only except /tmp/lab-probe (scratch + out). No HTTP, no
// Drupal bootstrap, no network. Marker strings are inert data.
//
// usage: php probe_batch.php IN.jsonl OFFSET LIMIT OUT.jsonl

$SCRATCH = '/tmp/lab-probe/scratch';
chdir($SCRATCH);
ini_set('session.save_path', $SCRATCH);
ini_set('sys_temp_dir', $SCRATCH);
putenv('TMPDIR=' . $SCRATCH);

require '/opt/drupal/vendor/autoload.php';
spl_autoload_register(function ($class) {
  if (!str_starts_with($class, 'Drupal\\')) {
    return;
  }
  $parts = explode('\\', $class);
  $mod = $parts[1] ?? '';
  if ($mod === 'lab_bridge') {
    return;
  }
  $rel = implode('/', array_slice($parts, 2)) . '.php';
  foreach (['/opt/drupal/web/core/modules/', '/opt/drupal/web/modules/contrib/', '/opt/drupal/web/modules/'] as $root) {
    $p = $root . $mod . '/src/' . $rel;
    if (is_file($p)) {
      require $p;
      return;
    }
  }
});

// Lab row shape carrying only benign markers: a /tmp/lab-probe path, the
// literal 'whoami', sub-array callable names, a serialized stdClass marker.
function probe_row(): array {
  return [
    '#region_callback' => 'print_r',
    '#attributes' => [],
    'name' => ['#markup' => 'Harmless lab row GADGETPROBE'],
    'cmd' => ['#markup' => 'whoami'],
    'command' => 'whoami',
    'callback' => 'print_r',
    'function' => 'print_r',
    'callable' => 'print_r',
    'method' => 'print_r',
    'path' => '/tmp/lab-probe/scratch/marker-path.txt',
    'file' => '/tmp/lab-probe/scratch/marker-file.txt',
    'filename' => '/tmp/lab-probe/scratch/marker-filename.txt',
    'data' => 'O:8:"stdClass":0:{}',
    'serialized' => 'O:8:"stdClass":0:{}',
    'input' => 'GADGETPROBE-INPUT',
    'value' => 'GADGETPROBE-VALUE',
    'code' => 'GADGETPROBE-CODE',
    'options' => ['whoami'],
    'arguments' => ['GADGETPROBE-ARG'],
    'query' => 'GADGETPROBE-QUERY',
    0 => 'whoami',
    1 => '/tmp/lab-probe/scratch/marker-idx1.txt',
    'parent_wrapper' => ['parent' => ['#value' => '']],
    'weight' => ['#value' => 0],
    'region' => ['#value' => 'content'],
  ];
}

function scan_scratch(string $d): array {
  $map = [];
  if (!is_dir($d)) {
    return $map;
  }
  $it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($d, FilesystemIterator::SKIP_DOTS));
  foreach ($it as $f) {
    $rel = substr($f->getPathname(), strlen($d) + 1);
    $map[$rel] = $f->isFile() ? ($f->getSize() . ':' . $f->getMTime()) : 'dir';
  }
  return $map;
}

function summarize($ret): ?string {
  if ($ret === null) {
    return 'null';
  }
  if (is_bool($ret)) {
    return $ret ? 'bool(true)' : 'bool(false)';
  }
  if (is_scalar($ret)) {
    $s = (string) $ret;
    return gettype($ret) . ' len=' . strlen($s) . ' "' . substr($s, 0, 120) . '"';
  }
  if (is_array($ret)) {
    return 'array count=' . count($ret);
  }
  if (is_object($ret)) {
    return 'object ' . get_class($ret);
  }
  return gettype($ret);
}

[$in, $off, $lim, $outFile] = [$argv[1], (int) $argv[2], (int) $argv[3], $argv[4]];
$lines = array_slice(file($in, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES), $off, $lim);
$out = fopen($outFile, 'ab');
$MARKERS = ['GADGETPROBE', 'whoami', '/tmp/lab-probe', 'print_r', 'stdClass', 'www-data'];

foreach ($lines as $line) {
  $c = json_decode($line, true);
  $cb = $c['callable'];
  $before = scan_scratch($SCRATCH);
  ob_start();
  $outcome = 'returned';
  $err = null;
  $retSummary = null;
  try {
    $row = probe_row();
    $ret = call_user_func_array($cb, [&$row]);
    $retSummary = summarize($ret);
  }
  catch (ArgumentCountError $e) {
    $outcome = 'ArgumentCountError';
    $err = substr($e->getMessage(), 0, 300);
  }
  catch (TypeError $e) {
    $outcome = 'TypeError';
    $err = substr($e->getMessage(), 0, 300);
  }
  catch (Throwable $e) {
    $outcome = get_class($e);
    $err = substr($e->getMessage(), 0, 300);
  }
  $output = ob_get_clean();
  $after = scan_scratch($SCRATCH);
  $newFiles = array_keys(array_diff_key($after, $before));
  $changed = [];
  foreach ($after as $k => $v) {
    if (isset($before[$k]) && $before[$k] !== $v) {
      $changed[] = $k;
    }
  }
  $markers = [];
  foreach ($MARKERS as $mk) {
    if ($output !== '' && str_contains($output, $mk)) {
      $markers[] = $mk;
    }
  }
  fwrite($out, json_encode([
    'callable' => $cb,
    'kind' => $c['kind'],
    'file' => $c['file'] ?? null,
    'line' => $c['line'] ?? null,
    'outcome' => $outcome,
    'error' => $err,
    'return' => $retSummary,
    'output_len' => strlen($output),
    'output_head' => substr($output, 0, 300),
    'markers_in_output' => $markers,
    'new_files' => $newFiles,
    'changed_files' => $changed,
  ]) . "\n");
  fflush($out);
  foreach ($newFiles as $f) {
    @unlink($SCRATCH . '/' . $f);
  }
}
fclose($out);