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/README.md
+65Lines changed: 65 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -233,6 +233,53 @@ top -n 1
233
233
Always check for possible [**electron/cef/chromium debuggers** running, you could abuse it to escalate privileges](electron-cef-chromium-debugger-abuse.md). **Linpeas** detect those by checking the `--inspect` parameter inside the command line of the process.\
234
234
Also **check your privileges over the processes binaries**, maybe you can overwrite someone.
235
235
236
+
### Cross-user parent-child chains
237
+
238
+
A child process running under a **different user** than its parent is not automatically malicious, but it is a useful **triage signal**. Some transitions are expected (`root` spawning a service user, login managers creating session processes), but unusual chains can reveal wrappers, debug helpers, persistence, or weak runtime trust boundaries.
239
+
240
+
Quick review:
241
+
242
+
```bash
243
+
ps -eo pid,ppid,user,comm,args --sort=ppid
244
+
pstree -alp
245
+
```
246
+
247
+
If you find a surprising chain, inspect the parent command line and all files that influence its behavior (`config`, `EnvironmentFile`, helper scripts, working directory, writable arguments). In several real privesc paths the child itself was not writable, but the **parent-controlled config** or helper chain was.
248
+
249
+
### Deleted executables and deleted-open files
250
+
251
+
Runtime artifacts are often still accessible **after deletion**. This is useful both for privilege escalation and for recovering evidence from a process that already has sensitive files open.
252
+
253
+
Check for deleted executables:
254
+
255
+
```bash
256
+
pid=<PID>
257
+
ls -l /proc/$pid/exe
258
+
readlink /proc/$pid/exe
259
+
tr '\0' ' ' </proc/$pid/cmdline; echo
260
+
```
261
+
262
+
If `/proc/<PID>/exe` points to `(deleted)`, the process is still running the old binary image from memory. That is a strong signal to investigate because:
263
+
264
+
- the removed executable may contain interesting strings or credentials
265
+
- the running process may still expose useful file descriptors
266
+
- a deleted privileged binary can indicate recent tampering or attempted cleanup
267
+
268
+
Collect deleted-open files globally:
269
+
270
+
```bash
271
+
lsof +L1
272
+
```
273
+
274
+
If you find an interesting descriptor, recover it directly:
275
+
276
+
```bash
277
+
ls -l /proc/<PID>/fd
278
+
cat /proc/<PID>/fd/<FD>
279
+
```
280
+
281
+
This is especially valuable when a process still has a deleted secret, script, database export, or flag file open.
282
+
236
283
### Process monitoring
237
284
238
285
You can use tools like [**pspy**](https://github.com/DominicBreuker/pspy) to monitor processes. This can be very useful to identify vulnerable processes being executed frequently or when a set of requirements are met.
Services marked as **`(activatable)`** are especially interesting because they are **not running yet**, but a bus request can start them on demand. Do not stop at `busctl list`; map those names to the actual binaries they would execute.
68
+
69
+
```bash
70
+
ls -la /usr/share/dbus-1/system-services/ /usr/share/dbus-1/services/ 2>/dev/null
That quickly tells you which `Exec=` path will start for an activatable name and under which identity. If the binary or its execution chain is weakly protected, an inactive service can still become a privilege-escalation path.
75
+
61
76
#### Connections
62
77
63
78
[From wikipedia:](https://en.wikipedia.org/wiki/D-Bus) When a process sets up a connection to a bus, the bus assigns to the connection a special bus name called _unique connection name_. Bus names of this type are immutable—it's guaranteed they won't change as long as the connection exists—and, more importantly, they can't be reused during the bus lifetime. This means that no other connection to that bus will ever have assigned such unique connection name, even if the same process closes down the connection to the bus and creates a new one. Unique connection names are easily recognizable because they start with the—otherwise forbidden—colon character.
Note the method `.Block` of the interface `htb.oouch.Block` (the one we are interested in). The "s" of the other columns may mean that it's expecting a string.
164
189
190
+
Before trying anything dangerous, validate a **read-oriented** or otherwise low-risk method first. This separates three cases cleanly: wrong syntax, reachable but denied, or reachable and allowed.
0 commit comments