Lightweight Linux memory auditing tool focused on RWX detection and forensic triage.
The name K-Scanner was born from the project's focus on the Kernel (the heart of the Linux Operating System).
The "K" symbolizes the tool's mission to dive deep into system-level configurations, permissions, and sensitive files. It acts as a sentinel, scanning the "foundations" (Kernel-space and System-space) to ensure that the base of the OS is hardened against potential threats.
K-Scanner is a minimal forensic utility designed to audit memory protection flags of active Linux processes.
It analyzes the /proc virtual filesystem to identify memory regions that violate the W^X (Write XOR Execute) security principle β a condition commonly associated with:
- Shellcode injection
- JIT-compiled regions
- Packed executables
- Fileless malware techniques
The project is written in pure C (C99) with emphasis on performance, clarity, and forensic integrity.
Modern Linux systems rely heavily on memory protection mechanisms. However, visibility into runtime RWX memory regions is not centralized.
K-Scanner provides:
- Deterministic RWX detection
- System-wide process inspection
- Live forensic triage support
- Lightweight incident response tooling
It focuses strictly on observable memory metadata.
K-Scanner parses the virtual maps of active processes:
/proc/[PID]/mapsFor each running process, it inspects memory segments and evaluates their permission flags. If a memory segment contains both Write (W) and Execute (X) permissions simultaneously, an RWX alert is triggered.
The scanner operates through read-only metadata inspection and does not rely on intrusive debugging mechanisms such as ptrace.
+--------+----------------------------------+--------------------+--------------------+
| PID | PROCESS NAME | STATUS | INFO / PATH |
+--------+----------------------------------+--------------------+--------------------+
| 102109 | wireshark | RWX ALERT | 01x ANON_BLOB |
| 102174 | Discord | RWX ALERT | 02x MAPPED_FILE |
| 102388 | Discord | RWX ALERT | 05x MAPPED_FILE |
+--------+----------------------------------+--------------------+--------------------+

1 - Initial System Mapping. Startup of the Live Forensic Process Analysis Mode, performing real-time memory scanning of core system processes.

2 - Behavioral Analysis & Contextual Detection. K-Scanner categorizes suspicious regions as ANON_BLOB (common in shellcodes) or MAPPED_FILE (common in JIT engines like Firefox/Discord).

3 - Forensic Workflow via Tmux. Demonstrates memory extraction, integrity verification with SHA256, and inspection via strings/hex.
- System-wide PID scanning
- RWX memory detection engine
- SAFE / ALERT classification
- Clean terminal output
- Low memory footprint
- Designed for forensic triage scenarios
K-Scanner is built for stability and forensic neutrality:
- Simplicity: No kernel modules, no injection, no process suspension
- Forensic Integrity: Does not modify process memory or execution state
- Performance: Optimized C implementation for minimal overhead
- Passive Inspection: Uses read-only metadata via /proc
# 1. Clone & Enter the repository
git clone https://github.com/jeffersoncesarantunes/K-Scanner.git
cd K-Scanner
# 2. Compile the project
make clean && make
# 3. Execute the scanner
sudo ./bin/kscannerAfter detecting an RWX region, analysts may proceed with:
sha256sum /proc/[PID]/exesudo dd if=/proc/[PID]/mem of=dump.bin bs=1 skip=<offset> count=<size>Use strings or hexdump on the generated dump to identify suspicious payloads.
Once K-Scanner identifies a suspicious RWX region, it automatically extracts its raw content to the build/dumps/ directory.
sha256sum build/dumps/*.binsha256sum build/dumps/pid_101554_2dace8f1b000.binstrings build/dumps/pid_*.bin | lessstrings build/dumps/pid_101554_2dace8f1b000.bin | head -n 15hexdump -C build/dumps/pid_101554_2dace8f1b000.bin | head -n 10- Linux OS (Tested on Arch Linux 6.x)
- gcc & make
- sudo privileges
βββ bin/
βββ build/
β βββ obj/
β βββ dumps/
βββ docs/
β βββ architecture.md
β βββ forensic_methodology.md
β βββ performance_and_limitations.md
β βββ threat_model.md
β βββ use_cases.md
βββ examples/
βββ Imagens/
βββ include/
βββ scripts/
βββ src/
β βββ core/
β βββ modules/
β βββ utils/
βββ tests/
βββ .gitignore
βββ LICENSE
βββ Makefile
βββ README.md
- Language: C (C99)
- Data Source: /proc filesystem
- Build Tool: GNU Make
- Target: Linux Kernel 4.x / 5.x / 6.x
- Modular C Engine
- Advanced Build System
- Structured Output
- Automated Memory Dump
- JSON/CSV Export
- Interactive TUI
- Kernel Module (LKM)
This project is licensed under the MIT License.