Linux Kernel & sysctl Hardening Auditor
A handful of kernel settings decide how much an attacker gets for free. Check yours before they do.
A sysctl hardening audit is a static review of a Linux machine’s kernel runtime settings — the values in sysctl.conf, sysctl.d files or a live sysctl -a dump, plus the build-time options in a kernel .config — checked against known-good hardening practice. Paste yours here and this auditor reads it in your browser — never uploaded — and flags ASLR switched off, kernel pointers and dmesg exposed, unprotected hardlinks and symlinks, ICMP redirect acceptance, missing syncookies and a low vm.mmap_min_addr, with a 0–100 score. The companion article Linux sysctl hardening guide explains each check. Also see the SSH Server Config Auditor and the systemd Unit Auditor.
Last updated:
1. Audit your settings
Results
🔒 The audit runs entirely in your browser: the settings are never uploaded, never stored, and never sent anywhere. A sysctl dump names your hostname, network layout and exactly which defences you run — that is exactly why it stays on your machine.
Two files, two halves of the same posture
sysctl settings are the kernel’s runtime switches, exposed under /proc/sys: each key, like kernel.randomize_va_space, is a file you can read and (as root) write. They are set persistently in /etc/sysctl.conf and /etc/sysctl.d/*.conf, applied at boot by systemd-sysctl, and read back live with sysctl -a — which prints every key, including the ones still at their distribution defaults.
A conf file and a live dump answer different questions. The conf file shows what someone chose to set; the dump shows what is actually in force, defaults included. That is why this auditor treats a missing key differently in each: in a dump, a missing curated key means the feature is at its default or off; in a conf file it only means “not set here” — another file, or the default, may still cover it. The result line states which form was assumed.
The kernel .config is the other half: options chosen when the kernel was compiled, like CONFIG_RANDOMIZE_BASE (KASLR) or CONFIG_FORTIFY_SOURCE. No sysctl can turn on a defence the kernel was built without, so a complete audit reads both. Find yours at /boot/config-$(uname -r) or /proc/config.gz.
Interface families deserve a second look: net.ipv4.conf.all.* applies to every interface, but new interfaces are seeded from net.ipv4.conf.default.*. Setting all correctly while leaving default unsafe means the next interface that appears — a VPN tunnel, a container veth — starts life with the unsafe values. This auditor flags exactly that gap.
What this auditor does — and what it does not
It parses the pasted text in your browser — both key = value and key: value forms, comments and the leading-dash ignore-error marker in conf files, or CONFIG_ lines in a kernel config — and runs the curated rule set over it: memory-exposure switches (ASLR, kptr_restrict, dmesg_restrict, ptrace scope), filesystem link protections, the IPv4/IPv6 redirect and source-route family, syncookies, rp_filter, mmap_min_addr, and the build-time .config options. Scoring starts at 100; each error deducts 10 (capped at 40), each warning 4 (capped at 32), each info 1 (capped at 10). Bands: 90+ Excellent, 70–89 Good, 50–69 Needs work, below 50 Poor.
Some settings are deliberately not scored as faults. net.ipv6.conf.all.disable_ipv6 is never flagged either way — disabling IPv6 is a policy choice, not a defect — and is shown as an unscored note when present. user.max_user_namespaces = 0 is a real hardening option that also breaks rootless containers, so it is reported as an info with the trade-off stated, never an error. net.ipv4.ip_forward = 1 is likewise an info: wrong on a host, required on a router.
The weak demo is a 31-key sysctl -a excerpt with the classic bad values planted — ASLR 0, redirects accepted, syncookies off — and scores 48 (Poor) with 28 findings. The hardened demo sets every curated key correctly and scores 100. The sample .config is a small excerpt with exactly 3 findings, scoring 91.
Be honest about what a pasted dump cannot prove
This audit reads the text you paste. It cannot verify that the running kernel actually holds these values right now (a dump can be old, edited or from another machine), which modules are loaded, whether a firewall ruleset backs the sysctl posture up, or whether the values survive a reboot — a setting applied with sysctl -w but never written to a conf file vanishes at boot, and this tool cannot tell the difference from here.
And hardening is choosing, not maximising: several rules have legitimate exceptions (ip_forward on a router, ptrace scope for developers debugging their own processes, user namespaces for rootless containers). A finding is a prompt to decide deliberately, not an order. A score of 100 means no risky pattern was found in this text — not that the machine is secure.
Key facts
| kernel.randomize_va_space | Address space layout randomisation (ASLR) for user processes: 2 randomises the heap as well as the stack and mmap base; 0 turns randomisation off entirely and makes memory-corruption exploits reliable. |
| kernel.kptr_restrict | Controls whether unprivileged users can read kernel pointers from /proc/kallsyms and similar interfaces — pointers that hand an attacker the kernel’s memory layout. |
| fs.protected_hardlinks / symlinks | Stop users creating hardlinks to files they do not own, and stop symlinks in sticky world-writable directories (like /tmp) being followed across owners — classic local privilege-escalation building blocks. |
| net.ipv4.tcp_syncookies | Lets the kernel answer SYN floods with stateless cookies instead of half-open connection entries, so a flood cannot exhaust the connection table. |
| net.ipv4.conf.all.rp_filter | Reverse-path filtering: drops packets arriving on an interface that the routing table would never use to reply — a basic anti-spoofing control. |
| vm.mmap_min_addr | The lowest address a process may mmap. Keeping it at 65536 or above blocks the null-pointer-dereference exploit class that maps page zero. |
| KSPP | The Kernel Self Protection Project — the upstream effort whose recommended settings list is the reference most hardening guides, and this rule set, are built from. |
| Format reference | Kernel sysctl documentation — kernel.org |
Frequently asked questions
Why does the audit run in my browser instead of on a server?
Because a sysctl dump is a map of your defences: it names your hostname, shows your network posture and lists exactly which protections are off. Sending that to a server to audit it would create the exact exposure the audit is meant to catch. Parsing it locally means the dump never leaves your machine.
Should I paste a conf file or sysctl -a output?
The dump, if you want the truth about the running machine: sysctl -a shows every key including defaults, so a missing protection is visible. A conf file shows intent — what someone chose to set — and is the right input when you are reviewing a file before deploying it. The auditor detects which you pasted and phrases missing-key findings accordingly.
My score is low — where do I start?
With the error and the warnings, in that order: turn ASLR back to 2, set syncookies and rp_filter to 1, stop accepting redirects and source-routed packets, and enable the protected_hardlinks/symlinks pair. The infos are mostly defaults worth setting explicitly so the next admin can see the choice was deliberate. Re-check after each change — some settings, like ptrace_scope and user namespaces, have real trade-offs for developers and containers.