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/generic-methodologies-and-resources/basic-forensic-methodology/linux-forensics.md
+101-1Lines changed: 101 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -195,6 +195,104 @@ head -1 maps #Get address of the file. It was 08048000-08049000
195
195
dd if=mem bs=1 skip=08048000 count=1000 of=/tmp/exec2 #Recorver it
196
196
```
197
197
198
+
## Syscall Trace Triage with SQLite and FTS5
199
+
200
+
When a process is still running or can be re-executed in a lab, **`strace`** can provide a fast behavioral trace without needing kernel modules or full EDR telemetry. For large traces, avoid reading the raw log directly or pasting it into an LLM: store it in a **SQLite** database and query only the minimal subset you need.
201
+
202
+
> [!WARNING]
203
+
> Attaching `strace` changes process timing and may affect race conditions or other fragile bugs. Prefer reproducing on a copy/lab system when possible.
-**PATH hijacking / fake sudo**: search for writes and `chmod`/`rename` activity under `~/.local/bin/`, then correlate with later `execve` of privileged-looking names such as `sudo`.
278
+
-**TOCTOU on temporary files**: pivot on the same `/tmp/...` path across `stat`, `access`, `openat`, `rename`, `unlink`, `link`, `symlink`, and `execve` to identify check/use gaps.
279
+
-**Crash root cause**: correlate `mmap` of a file with writes or truncation of the same inode/path by another process, then inspect the signal/exit sequence for `SIGBUS`.
280
+
-**Network destination recovery**: filter `connect`, `sendto`, `sendmsg`, `recvfrom`, and socket-related arguments to extract peer IPs and ports.
281
+
282
+
### LLM-assisted trace analysis
283
+
284
+
If you want an LLM to assist, expose a **read-only** SQLite handle and give it the full schema. Let it issue raw SQL instead of wrapping the database behind narrow helper functions. This usually works better for joins, temporal correlation, and FTS lookups.
285
+
286
+
Practical rules:
287
+
288
+
- Keep the database read-only, for example with `sqlite3 'file:trace.db?mode=ro'`.
289
+
- Give the model examples of valid `JOIN` and `FTS5 MATCH` queries.
290
+
- Do **not** paste raw multi-GB `strace` logs into the prompt.
291
+
- Ask focused questions such as:
292
+
- "List persistent files written by this program."
293
+
- "Did it create or replace executables in user-controlled PATH directories?"
-[Red Canary – Patching for persistence: How DripDropper Linux malware moves through the cloud](https://redcanary.com/blog/threat-intelligence/dripdropper-linux-malware/)
557
655
-[Forensic Analysis of Linux Journals](https://stuxnet999.github.io/dfir/linux-journal-forensics/)
558
656
-[Red Hat Enterprise Linux 9 - Auditing the system](https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/9/html/security_hardening/auditing-the-system_security-hardening)
657
+
-[Say hi to Pike!](https://www.synacktiv.com/en/publications/say-hi-to-pike.html)
0 commit comments