Exploit database

GH-2ee787fd936f42f16f1d3a737ead8c51

sykeops/cve-2026-115560

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-115560

9 sources

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

Repository files8
sykeops/cve-2026-115560Revision eaf096152996

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

setup.sh

Shell · 8,119 bytes
#!/usr/bin/env bash
#
# Deploy the CVE-2026-115560 lab on the normal port-80 Apache server.
#
# setup.sh and setup-php-binary.sh are the SAME script; they differ only in the
# "lab-specific configuration" block below (the index.php that is deployed and
# the session serializer the lab runs under). Running either one re-points the
# shared /var/www/html lab at that script's variant.
#
# Lab use only. Run as a user with sudo.
set -euo pipefail

DOC_ROOT="${DOC_ROOT:-/var/www/html}"
HOST="${HOST:-127.0.0.1}"
INDEX="$DOC_ROOT/index.php"
URL="http://$HOST/index.php"

# Paths used to scope session.serialize_handler to this lab (written for the
# php_binary variant, removed otherwise).
SERIALIZER_CONF_NAME="cve-2026-115560-php-binary"
SERIALIZER_APACHE_CONF="/etc/apache2/conf-available/$SERIALIZER_CONF_NAME.conf"
SERIALIZER_FPM_POOL="/etc/php-fpm.d/$SERIALIZER_CONF_NAME.conf"
SERIALIZER_FPM_SOCK="/run/php-fpm/$SERIALIZER_CONF_NAME.sock"

# ===================== lab-specific configuration ==========================
# The ONLY difference between setup.sh and setup-php-binary.sh.
LAB_SUMMARY="session-file LFI lab (default serializer)"
LAB_SERIALIZE_HANDLER=""          # "" keeps the system default (php)

write_index() {
    sudo tee "$INDEX" >/dev/null <<'PHP'
<?php
declare(strict_types=1);

if (isset($_GET['file']) && $_GET['file'] !== '') {
    header('Content-Type: text/plain; charset=utf-8');
    include $_GET['file'];
} else {
    echo "hello, world\n";
}
PHP
}

poc_hint() {
    echo "  python3 poc.py --remote '$URL' --filename --lfi '$URL?file={file}' $PLATFORM_FLAG"
}
# ===========================================================================

# ---------------------------------------------------------------- platform
if [[ ! -r /etc/os-release ]]; then
    echo "[!] Cannot identify the operating system: /etc/os-release is missing" >&2
    exit 1
fi
. /etc/os-release
case "$ID" in
    fedora|rhel|centos|rocky|almalinux)
        WEB_SERVICE="httpd"; WEB_USER="apache"; PHP_FPM_SERVICE="php-fpm"; PLATFORM_FLAG="--fedora"
        ;;
    ubuntu|debian)
        WEB_SERVICE="apache2"; WEB_USER="www-data"; PLATFORM_FLAG="--ubuntu"
        # `systemctl list-unit-files` exits 1 when the glob matches nothing (e.g.
        # mod_php installs with no php-fpm unit). With `set -e` + `pipefail` that
        # would abort the script silently, so swallow the status here.
        PHP_FPM_SERVICE="$(systemctl list-unit-files --no-legend 'php*-fpm.service' \
            2>/dev/null | awk 'NR == 1 { print $1 }' || true)"
        ;;
    *)
        echo "[!] Unsupported distribution: $ID" >&2
        echo "    Supported: Fedora/RHEL-family and Debian/Ubuntu." >&2
        exit 1
        ;;
esac

case "${1:-start}" in
    start|reset) ;;
    *) echo "Usage: $0 [start|reset]" >&2; exit 2 ;;
esac

if [[ "$DOC_ROOT" != "/var/www/html" ]]; then
    echo "[!] DOC_ROOT must be /var/www/html" >&2
    exit 1
fi
if ! command -v sudo >/dev/null 2>&1; then
    echo "[!] sudo is required to deploy under $DOC_ROOT" >&2
    exit 1
fi

# ---------------------------------------------------------------- packages
# Install a web server plus a PHP SAPI Apache can actually execute. On
# Debian/Ubuntu that is mod_php; on the RHEL family mod_php is gone, so
# php-fpm is the packaged option.
install_packages() {
    case "$ID" in
        ubuntu|debian)
            local missing=0
            dpkg-query -W -f='${Status}' apache2 2>/dev/null \
                | grep -q 'install ok installed' || missing=1
            dpkg-query -W -f='${Status}' php 2>/dev/null \
                | grep -q 'install ok installed' || missing=1
            # The installed module is versioned (e.g. libapache2-mod-php8.5),
            # so look for its .load file rather than a fixed package name.
            compgen -G '/etc/apache2/mods-available/php*.load' >/dev/null || missing=1
            if (( missing )); then
                echo "[*] Installing apache2 + PHP (mod_php) ..."
                sudo env DEBIAN_FRONTEND=noninteractive apt-get update -qq || true
                sudo env DEBIAN_FRONTEND=noninteractive NEEDRESTART_MODE=a \
                    apt-get install -y apache2 libapache2-mod-php php
            fi
            # Re-enable a PHP module if none is loaded (only one may be).
            if ! compgen -G '/etc/apache2/mods-enabled/php*.load' >/dev/null; then
                local php_mod
                php_mod="$(find /etc/apache2/mods-available -maxdepth 1 \
                    -name 'php*.load' -printf '%f\n' 2>/dev/null | sort | head -n 1 || true)"
                if [[ -n "$php_mod" ]]; then
                    sudo a2enmod "${php_mod%.load}" >/dev/null
                fi
            fi
            ;;
        fedora|rhel|centos|rocky|almalinux)
            echo "[*] Installing httpd + PHP (php-fpm) ..."
            if command -v dnf >/dev/null 2>&1; then
                sudo dnf install -y httpd php php-fpm
            else
                sudo yum install -y httpd php php-fpm
            fi
            # mod_php is no longer packaged on the RHEL family, so hand .php
            # requests to the php-fpm unix socket instead.
            sudo tee /etc/httpd/conf.d/php.conf >/dev/null <<'CONF'
<FilesMatch \.php$>
    SetHandler "proxy:unix:/run/php-fpm/www.sock|fcgi://localhost"
</FilesMatch>
DirectoryIndex index.php index.html
CONF
            if command -v restorecon >/dev/null 2>&1; then
                sudo restorecon /etc/httpd/conf.d/php.conf
            fi
            sudo systemctl enable --now php-fpm
            ;;
    esac
}

# ---------------------------------------------------------------- serializer
# Clear any previous php_binary scoping (so switching labs is always clean),
# then, if this lab asked for a non-default handler, write it for the active
# PHP SAPI (mod_php -> Apache php_value; php-fpm -> a dedicated pool).
configure_serializer() {
    sudo rm -f "$SERIALIZER_FPM_POOL" "$SERIALIZER_APACHE_CONF"
    if command -v a2disconf >/dev/null 2>&1; then
        sudo a2disconf "$SERIALIZER_CONF_NAME" >/dev/null 2>&1 || true
    fi

    [[ -z "$LAB_SERIALIZE_HANDLER" ]] && return 0

    case "$ID" in
        ubuntu|debian)
            sudo tee "$SERIALIZER_APACHE_CONF" >/dev/null <<CONF
<Directory $DOC_ROOT>
    php_value session.serialize_handler $LAB_SERIALIZE_HANDLER
</Directory>
CONF
            sudo a2enconf "$SERIALIZER_CONF_NAME" >/dev/null
            ;;
        *)
            sudo tee "$SERIALIZER_FPM_POOL" >/dev/null <<CONF
[$SERIALIZER_CONF_NAME]
user = $WEB_USER
group = $WEB_USER
listen = $SERIALIZER_FPM_SOCK
listen.owner = $WEB_USER
listen.group = $WEB_USER
listen.mode = 0660
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
php_value[session.serialize_handler] = $LAB_SERIALIZE_HANDLER
CONF
            # Point the stock .php handler at this lab's pool, still on port 80.
            sudo tee /etc/httpd/conf.d/php.conf >/dev/null <<CONF
<FilesMatch \.php$>
    SetHandler "proxy:unix:$SERIALIZER_FPM_SOCK|fcgi://localhost"
</FilesMatch>
DirectoryIndex index.php index.html
CONF
            if command -v restorecon >/dev/null 2>&1; then
                sudo restorecon "$SERIALIZER_FPM_POOL" /etc/httpd/conf.d/php.conf >/dev/null 2>&1 || true
            fi
            ;;
    esac
}

# ---------------------------------------------------------------- deploy
install_packages
configure_serializer
sudo systemctl enable --now "$WEB_SERVICE"

sudo find "$DOC_ROOT" -mindepth 1 -maxdepth 1 -exec rm -rf -- {} +
write_index
sudo chmod 0644 "$INDEX"
if command -v restorecon >/dev/null 2>&1; then
    sudo restorecon "$INDEX"
fi

if [[ -n "$PHP_FPM_SERVICE" ]] && systemctl is-active --quiet "$PHP_FPM_SERVICE"; then
    sudo systemctl reload "$PHP_FPM_SERVICE"
fi
sudo systemctl reload "$WEB_SERVICE"

echo "[+] Deployed: $INDEX ($LAB_SUMMARY)"
if [[ -n "$LAB_SERIALIZE_HANDLER" ]]; then
    echo "[+] session.serialize_handler = $LAB_SERIALIZE_HANDLER (run the other setup script to switch back)"
fi
echo "[+] Test: curl -s '$URL'"
echo
echo "Run the PoC:"
poc_hint