Defensive kernel security · open-source toolkit内核安全检测 · 开源工具库

Test your kernel
before someone else does.
在别人动手之前
先测你自己的内核。

A curated toolkit for detecting known CVEs, hardening config, and auditing code in Linux vendor / Android arm64 kernels. Six categories, three layers, one command to install every dependency. Clone it and you know exactly how to test — no guesswork. 给 Linux vendor / Android arm64 内核做已知 CVE 检测、配置加固、代码审计的一套开源工具编排。六类方法、三层检测、一条命令装齐依赖。拉下来就知道怎么测——不用猜。

Quick start快速上手 How it's built看设计架构
Why this exists为什么做这个

"Detecting kernel vulnerabilities" is not one thing. "检测内核漏洞"其实不是一件事。

It's several — with completely different tools. Mixing "scan for a known CVE" with "rate a bug's impact" is the number-one reason people pick the wrong tool. This repo splits the work into six clear categories and hands you the right tool for each, pre-wired. 它是好几件事,手段完全不同。把"扫已知 CVE"和"给漏洞定影响级别"混为一谈,是选错工具的头号原因。本库把它拆成六个清楚的类别,每类配好对应工具,直接可用。

6
tool categories工具类别
10
open-source tools wired in编排好的开源工具
3
detection layers检测层
1
command to install deps命令装齐依赖
The six categories六个类别

Pick the category, get the tool. 选对类别,拿对工具。

①②③⑤⑥ are what this repo practices — all on kernels you own or are authorized to test, to find and fix. ④ is reference-only: paper impact-rating to prioritize fixes, no attack tooling. ①②③⑤⑥ 是本库实践的——全部对你拥有或获授权的内核做,目的是找出来并修掉。④ 是参考类:纸面影响评级给修复排优先级,不含攻击工具。

01 · CVE

Known CVE detection已知 CVE 检测

Does my kernel carry a published CVE that's unpatched? Static source / git checks — cvehound + kernel-cve-tool.内核里有没有已公开、还没修的 CVE?静态查源码 / git —— cvehound + kernel-cve-tool。

deterministic tools确定性工具主场
02 · HARDEN

Config hardening配置加固检查

Is my kernel config hard enough? Compare .config / cmdline / sysctl against the KSPP baseline — kernel-hardening-checker.内核配置够不够硬?拿 .config / cmdline / sysctl 对照 KSPP 加固基线 —— kernel-hardening-checker。

rule comparison规则比对
03 · DISCOVER

New-bug discovery新漏洞挖掘

Any bug nobody has found yet? LLM synthesizes syscall specs, syzkaller does the fuzzing — KernelGPT.有没有还没人发现的洞?LLM 合成 syscall 规格,syzkaller 实跑 fuzz —— KernelGPT。

LLM + fuzzerLLM 配 fuzzer
04 · RATE

Impact rating (reference)影响评级 (参考类)

How bad is a found bug, fix it first or not? Paper rating from vulnerability-class knowledge. No attack tooling.查到的洞影响多大、要不要先修?靠漏洞类别知识做纸面评级。不放攻击工具。

human judgement人工判断
05 · AUDIT

LLM code / patch auditLLM 审代码 / 补丁

Does this diff have a security issue? Claude reads C semantically — filters ① false positives, reviews backports.这段 diff 有没有安全问题?Claude 语义读 C —— 过滤 ① 假阳性、审 backport。

assists ①③辅助 ①③
06 · REVERSE

Binary reverse-engineering二进制逆向

Only have a .ko / firmware, or must prove the shipped binary carries a bug? Ghidra / radare2 wired to Claude via MCP.只有 .ko / 固件,或要证明出厂二进制含 bug?Ghidra / radare2 经 MCP 接给 Claude。

assembly-level proof汇编级坐实
How it runs怎么跑

Three layers, deepest last. 三层检测,由浅入深。

Each layer runs independently and folds into one report. L1 is deterministic fact; L2 is an LLM hint you verify; L3 is measured behaviour on your own device. 三层各自独立可跑,并进一份报告。L1 是确定性事实;L2 是要你验证的 LLM 提示;L3 是自家设备上的实测行为。

L1 · STATIC — DETERMINISTIC no LLM · bin/ksec scan cvehound source-pattern CVE match kernel-cve-tool git commit cross-check hardening-checker .config vs KSPP baseline L2 · LLM AUDIT — ASSIST needs Claude Code · /kernel-sec-audit c-review semantic C audit of handlers variant-analysis find same-pattern bugs security-review diff-aware patch review L3 · DYNAMIC — ON YOUR DEVICE authorized targets · ksec dynamic ioctl leak probe re-run an error path N times slabmon watch slab growth = leak kmemleak / syzkaller auto-scan the whole class bin/ksec report out/report.md · report.html L1 facts, L2 hints and L3 measurements — kept separate, never conflated. skipped = not run, not "clean" deterministic LLM assist dynamic output
The three detection layers converge into one report via bin/ksec. Deterministic facts, LLM hints and device measurements stay clearly separated. 三层检测经 bin/ksec 汇成一份报告。确定性事实、LLM 提示、设备实测,三者始终分开呈现。
Quick start快速上手

Clone, install, scan. 克隆,装依赖,开扫。

Four commands to a report 四条命令出报告

install-deps.sh detects your package manager and installs coccinelle, the cross-compiler and the pip tools. Then point ksec at your kernel source and read the report. install-deps.sh 认出你的包管理器,装 coccinelle、交叉编译器和 pip 工具。然后把 ksec 指向你的内核源码,读报告。

Full usage guide完整使用指南
# 1) clone
$ git clone …/linux-kernel-security-oss
$ cd linux-kernel-security-oss

# 2) one-command dependency install
$ bash scripts/install-deps.sh

# 3) pull the third-party tools
$ bash scripts/clone-tools.sh

# 4) scan your kernel, read the report
$ export KERNEL=/path/to/your/kernel
$ bin/ksec scan --kernel "$KERNEL"
$ bin/ksec report --html
Go deeper深入

Every function, and the design behind it. 全部功能,以及背后的设计。