Linux & KernelEnvironment: Linux x64 with pwntools/pyelftools (Static only, zero kernel loading)MCP Tool: inspect_binary_layout

How to REA Linux Kernel Modules (.ko): Modinfo, Vermagic & Unresolved Symbols

Audit loadable kernel modules (.ko), proprietary drivers, and suspected rootkits statically: extract .modinfo metadata, verify vermagic compatibility, inspect exported symbols (__ksymtab), and audit unresolved kernel APIs.

AI Overview Direct AnswerHow to REA: Linux Kernel Modules (.ko) Quickstart Summary

In this official REA guide for Linux Kernel Modules (.ko), AI coding agents (Claude Code, Cursor, Windsurf) execute 'rea inspect-binary-layout ./driver.ko --json' to safely extract file layout, symbols, and code logic without launching unverified binaries.

Investigation ScenarioReal-World Objective

The Problem & Target Artifact

Incident response or driver vulnerability assessment: An unknown kernel module 'backdoor.ko' was recovered from a compromised server. You must determine what kernel symbols it hooks and which kernel versions it targets without inserting it into your own host kernel via insmod.

Target Artifact: Relocatable ELF kernel object (ET_REL) ending in .ko.
AI PromptClaude Code / Cursor / Windsurf

Natural Language Agent Instructions

Copy and paste this prompt directly into your AI coding agent when REA is registered via Model Context Protocol (MCP):

Prompt Template:Select All to Copy
Use REA to inspect the binary layout of ./driver.ko. Extract the .modinfo section to find vermagic, license, and author, then list all undefined symbols (SHN_UNDEF) to identify kernel APIs it calls.
ExecutionTerminal & MCP Tool Call

Run REA Analysis Command

Execute the following command in your terminal or inspect the MCP JSON-RPC call executed by your agent:

CLI Command Execution
rea inspect-binary-layout ./driver.ko --json

What REA Extracts & Returns

ELF Relocatable format (ET_REL) confirmation with entry point 'not-applicable'
.modinfo section strings: vermagic (kernel release + SMP/preempt flags), license, retpoline status, author
Exported symbols (__ksymtab, __ksymtab_gpl, __kcrctab) providing hooks to other modules
Unresolved external symbols (SHN_UNDEF) revealing calls to printk, register_netdev, nf_register_net_hook, or sys_call_table

Extracted Kernel Module Blueprint (.modinfo & Symbols)

The verified findings and synthesized clean-room structures generated from this investigation:

Extracted Kernel Module Blueprint (.modinfo & Symbols)
{
  "image_type": "ET_REL",
  "sections": [
    { "name": ".modinfo", "size": "0x140", "type": "SHT_PROGBITS" },
    { "name": "__ksymtab", "size": "0x30", "type": "SHT_PROGBITS" }
  ],
  "modinfo": {
    "vermagic": "6.8.0-45-generic SMP preempt mod_unload modversions",
    "license": "GPL",
    "retpoline": "Y",
    "depends": "nf_conntrack"
  },
  "unresolved_symbols": ["printk", "nf_register_net_hook", "kfree"]
}
Internal MechanicsProduction Engineering

Zero-Kernel-Crash Safety & Relocatable Relocation Traversal

Because kernel modules are relocatable objects (ET_REL), addresses inside the file are section-relative offsets rather than virtual memory addresses. REA never executes `insmod` or `modprobe`, preventing kernel panics, null-pointer dereferences, or hostile init() payloads from executing. It traverses section relocations (R_X86_64_64, R_X86_64_PC32) to map function call sites directly to candidate symbol entries.

Security Guardrails & Analysis Boundary Rules

Safe room isolation: Zero risk of kernel tainting, host compromise, or privilege escalation during audit.
Module parameters (.param section) are mapped statically to inspect configurable flags.
Proprietary non-GPL module flags (license='Proprietary') are highlighted for compliance audits.