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/useful-linux-commands.md
+46Lines changed: 46 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -307,6 +307,52 @@ iptables -P FORWARD ACCEPT
307
307
iptables -P OUTPUT ACCEPT
308
308
```
309
309
310
+
## eBPF Telemetry & Rootkit Hunting
311
+
312
+
Modern rootkits (TripleCross, BPFDoor variants, etc.) increasingly persist as hidden eBPF programs. Baseline your fleet with `bpftool`/`eBPFmon` so you can spot unsigned programs, unexpected cgroup hooks, or malicious map contents before detaching them.
313
+
314
+
```bash
315
+
#Enumerate all eBPF programs, attach points, owning PIDs and map IDs
316
+
sudo bpftool prog
317
+
318
+
#Inspect suspicious bytecode + helper calls (replace 835 with the target program id)
319
+
sudo bpftool prog dump xlated id 835 | less
320
+
321
+
#List and dump program maps to reveal covert sockets/credentials (replace 104 accordingly)
322
+
sudo bpftool map show id 104
323
+
sudo bpftool map dump id 104 | hexdump -C
324
+
325
+
#Verify kernel feature support before loading/patching custom probes
326
+
sudo bpftool feature probe | less
327
+
328
+
#TUI wrapper that tracks program/map diffs in real time (wraps bpftool perf/net output)
329
+
sudo ebpfmon
330
+
```
331
+
332
+
Correlate the bpftool output with expected NIC/cgroup attachments; a sudden `xdp` or `kprobe` program owned by an unapproved PID is a strong indicator of an injected eBPF payload.
333
+
334
+
## Journald Incident Triage
335
+
336
+
systemd-journald keeps structured metadata, so you can pivot by boot, severity, unit, or UID without touching `/var/log/*`. Combine filters with relative timestamps to isolate attack windows or prove log tampering quickly.
337
+
338
+
```bash
339
+
journalctl --list-boots #Enumerate boot IDs with timestamps
Add `--grep 'Invalid user' --case-sensitive` or `-k` (kernel ring buffer only) when you need tighter filters, and remember `_PID`, `_SYSTEMD_UNIT`, `_HOSTNAME`, and `_TRANSPORT` selectors stack together for multi-tenant hunts.
350
+
351
+
## References
352
+
353
+
- [eBPFmon: A new tool for exploring and interacting with eBPF applications](https://redcanary.com/blog/linux-security/ebpfmon/)
354
+
- [How to use the journalctl command to view Linux logs](https://www.hostinger.com/tutorials/journalctl-command)
0 commit comments