Exploit database

GH-a8fe5dadaf59969a0724a9d69efb95d4

johnlodan/wp2shell-rce

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-63030

50 sources

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

Repository files6
johnlodan/wp2shell-rceRevision dbf6db4071b3

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

src/cli.ts

Suggested starting fileTypeScript · 8,158 bytes
import { readFile } from 'node:fs/promises'
import { scanMany, scanTarget, type ScanOptions, type ScanResult } from './scanner.ts'
import { mainMenu } from './menu.ts'

interface CliArgs extends ScanOptions { target: string | null; file: string | null; timeoutMs: number; concurrency: number; json: boolean; help: boolean }
const colorEnabled = Boolean(process.stdout.isTTY && !process.env.NO_COLOR) || Boolean(process.env.FORCE_COLOR)
export const style = (open: string, value: unknown): string => colorEnabled ? `\x1b[${open}m${String(value)}\x1b[0m` : String(value)
export const ui = {
  lime: (v: unknown) => style('92', v),
  bgGreen: (v: unknown) => style('42', v),
  black: (v: unknown) => style('30', v),
  bold: (v: unknown) => style('1', v), dim: (v: unknown) => style('2', v), red: (v: unknown) => style('31', v),
  green: (v: unknown) => style('32', v), yellow: (v: unknown) => style('33', v), cyan: (v: unknown) => style('36', v), brightCyan: (v: unknown) => style('1;36', v),
}
function showBanner(): void {
  const border = ui.yellow('─'.repeat(70));
  console.log(`┌${border}┐`);
  console.log(`│ ${ui.yellow('AUTHORIZATION NOTICE:')} Authorized testing & research only.            │`);
  console.log(`│ Unconsented scanning or exploitation is strictly prohibited.         │`);
  console.log(`└${border}┘`);
  console.log(
    `
  [${ui.yellow('★')}] ${ui.bold('Module:')} ${ui.yellow('WP2SHELL CLI - NODE VERSION')}
  [${ui.yellow('★')}] ${ui.bold('CVEs:')}   ${ui.red('CVE-2026-63030')} ${ui.dim('&')} ${ui.red('CVE-2026-60137')}
  [${ui.yellow('★')}] ${ui.bold('Impact:')} ${ui.red('Full Remote Code Execution (RCE) Chain')}
`
  );
}
const HELP = `
WebScan CLI - safe website availability and security-header scanner

Usage:
  npm run scan -- -t example.com
  npm run scan -- -t example.com,example.org
  npm run scan -- -f targets.txt

Options:
  -t, --target        One target or a comma-separated target list
  -f, --file          Text file containing one target per line
  --timeout           Request timeout in milliseconds (default: 10000)
  -c, --concurrency   Simultaneous requests (default: 4, maximum: 20)
  --json              Print machine-readable JSON
  -h, --help          Show this help
`
function takeValue(values: string[], flag: string): string {
  const value = values.shift()
  if (!value) throw new Error(`${flag} requires a value`)
  return value
}
function parseArgs(argv: string[]): CliArgs {
  const args: CliArgs = { target: null, file: null, timeoutMs: 10000, concurrency: 4, json: false, help: false }
  const values = [...argv]
  while (values.length) {
    const flag = values.shift()
    if (flag === '-h' || flag === '--help') args.help = true
    else if (flag === '--json') args.json = true
    else if (flag === '-t' || flag === '--target') args.target = takeValue(values, flag)
    else if (flag === '-f' || flag === '--file') args.file = takeValue(values, flag)
    else if (flag === '--timeout') args.timeoutMs = Number(takeValue(values, flag))
    else if (flag === '-c' || flag === '--concurrency') args.concurrency = Number(takeValue(values, flag))
    else throw new Error(`Unknown option: ${flag}`)
  }
  return args
}
function showResult(result: ScanResult): void {

  if (result.status) {
    console.log(`\n${ui.bold('Target:')} ${ui.bold(ui.cyan(result.target))}`)
    if (result.error) { console.log(`  ${ui.red('Error:')} ${result.error}`); return }
    const status = result.status ?? 0
    console.log(`${ui.bold('Status:')} ${status ? ui.red('VULNERABLE') : ui.green('NOT VULNERABLE')}`)

    console.log(`${ui.bold('Info:  ')} ${ui.green('Administrator account created successfully.')}`);
    const fields = [
      { label: 'Username', rawVal: result.username || '', styleFn: (str: string) => ui.cyan(str) },
      { label: 'Email', rawVal: result.email || '', styleFn: (str: string) => ui.cyan(str) },
      {
        label: 'Password',
        rawVal: result.password ? `${result.password} (EXPOSED)` : '',
        styleFn: (str: string) => {
          return str.includes('(EXPOSED)')
            ? str.replace(/^(.*?)(\s*\(EXPOSED\).*)$/, (_, pwd, exp) => `${ui.red(pwd)}${ui.dim(exp)}`)
            : ui.red(str);
        }
      },
      { label: 'Shell', rawVal: result.shell || '', styleFn: (str: string) => ui.cyan(str) },
    ].filter(f => f.rawVal !== '');

    if (fields.length > 0) {
      const labelColWidth = 10;
      const valueColWidth = 55;

      const topBorder = ui.lime(`┌${'─'.repeat(labelColWidth + 2)}┬${'─'.repeat(valueColWidth + 2)}┐`);
      const middleBorder = ui.lime(`├${'─'.repeat(labelColWidth + 2)}┼${'─'.repeat(valueColWidth + 2)}┤`);
      const bottomBorder = ui.lime(`└${'─'.repeat(labelColWidth + 2)}┴${'─'.repeat(valueColWidth + 2)}┘`);
      const pipe = ui.lime('│');

      console.log(topBorder);
      const headLabel = ui.bold('Field'.padEnd(labelColWidth));
      const headVal = ui.bold('Value'.padEnd(valueColWidth));
      console.log(`${pipe} ${headLabel} ${pipe} ${headVal} ${pipe}`);
      console.log(middleBorder);

      const wrapValue = (rawStr: any, styleFn: any, width: any) => {
        if (!rawStr) return [''.padEnd(width)];
        const chunks = [];
        for (let i = 0; i < rawStr.length; i += width) {
          const chunk = rawStr.slice(i, i + width);
          const paddingNeeded = Math.max(0, width - chunk.length);
          chunks.push(styleFn(chunk) + ' '.repeat(paddingNeeded));
        }
        return chunks;
      };

      for (const item of fields) {
        const valueLines = wrapValue(item.rawVal, item.styleFn, valueColWidth);

        const paddedLabel = ui.bold(item.label.padEnd(labelColWidth));
        console.log(`${pipe} ${paddedLabel} ${pipe} ${valueLines[0]} ${pipe}`);

        const emptyLabel = ' '.repeat(labelColWidth);
        for (let i = 1; i < valueLines.length; i++) {
          console.log(`${pipe} ${emptyLabel} ${pipe} ${valueLines[i]} ${pipe}`);
        }
      }
      console.log(bottomBorder + '\n');
    }
  }
}
async function loadTargets(args: CliArgs): Promise<string[]> {
  const targets: string[] = []
  if (args.target) targets.push(...args.target.split(',').map((item) => item.trim()).filter(Boolean))
  if (args.file) {
    const content = await readFile(args.file, 'utf8')
    targets.push(...content.split(/\r?\n/).map((line) => line.trim()).filter((line) => line && !line.startsWith('#')))
  }
  return [...new Set(targets)]
}
async function main(): Promise<void> {
  const args = parseArgs(process.argv.slice(2));

  if (args.help) {
    if (!args.json) showBanner();
    console.log(HELP);
    return;
  }

  if (!Number.isFinite(args.timeoutMs) || args.timeoutMs < 100) {
    throw new Error("--timeout must be at least 100ms");
  }

  if (
    !Number.isFinite(args.concurrency) ||
    args.concurrency < 1 ||
    args.concurrency > 20
  ) {
    throw new Error("--concurrency must be between 1 and 20");
  }

  const targets = await loadTargets(args);

  if (!targets.length) {
    throw new Error("Provide a target with -t or a target file with -f");
  }

  if (!args.json) {
    showBanner();
  }

  const results: any =
    targets.length === 1
      ? [await scanTarget(targets[0], args)]
      : await scanMany(targets, args);

  if (args.json) {
    console.log(
      JSON.stringify(results.length === 1 ? results[0] : results, null, 2),
    );
  } else {
    results.forEach(showResult);

    const vulnList = results?.filter((r: any) => r.status)
    if (vulnList.length) await mainMenu(vulnList);

    const passed = results.filter((result: any) => result.ok).length;
    const summary = `${passed}/${results.length}`;

    console.log(
      `\n${ui.bold("Completed:")} ${passed === results.length
        ? ui.green(summary)
        : ui.yellow(summary)
      } targets reachable without an error.`,
    );
  }

  if (results.some((result: any) => !result.ok)) {
    process.exitCode = 2;
  }
}
main().catch((error: unknown) => {
  console.error(`${ui.red(ui.bold('Error:'))} ${error instanceof Error ? error.message : String(error)}`)
  console.log(HELP); process.exitCode = 1
})