---
title: "HOST-KRN-022 Unprivileged User Namespaces Allowed"
canonical: https://openvapt.com/checks/HOST-KRN-022.html
html: https://openvapt.com/checks/HOST-KRN-022.html
site: OpenVAPT, https://openvapt.com/
license: OpenVAPT Source-Available Licence 1.3, https://openvapt.com/legal/licence-text.html
modified: 2026-10-14
version: 0.1.0-alpha.6
---

# HOST-KRN-022 Unprivileged User Namespaces Allowed

Checks that normal users cannot create user namespaces, unless the server runs containers that need them.

- Domain: Server
- Severity: Low
- Control category: Secure Configuration
- Fix effort: low
- CVSS v3.1 vector: `CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:L/I:N/A:N`
- CIS Controls v8: 4.1
- NIST CSF 2.0: PR.PS-01
- CWE: CWE-749
- NIST SP 800-53 Rev. 5: CM-6, CM-7
- Benchmark topic: Kernel parameters: user namespaces (CIS Controls v8 4.1) (topic only, no benchmark text)

## Why It Matters

User namespaces give an unprivileged process a fake root inside a namespace, which exposes kernel code paths that were written for root only; many local kernel exploits start by unsharing a user namespace.

## How It Detects

Reads /proc/sys/kernel/unprivileged_userns_clone (Debian and Ubuntu kernels) and, when that does not exist, /proc/sys/user/max_user_namespaces. The first is hardened at 0; the second at 0. Kernels with neither parameter are skipped. Passes with a note when /proc/sys/kernel/apparmor_restrict_unprivileged_userns is 1 (Ubuntu 23.10 and later), because AppArmor then denies the namespace capabilities to unconfined programs. Container hosts that need rootless namespaces should suppress this check deliberately.

## How to Fix

Create /etc/sysctl.d/60-openvapt-hardening.conf containing  kernel.unprivileged_userns_clone = 0  (Debian family) or  user.max_user_namespaces = 0  (other kernels), then apply with: sysctl --system. Rootless Docker, Podman, Flatpak and some browsers need user namespaces, so test first.

## How to Verify

```
sysctl kernel.unprivileged_userns_clone user.max_user_namespaces
```

## Learn the Theory

- [P1 Linux Server Hardening](https://openvapt.com/academy/p1.md)
- [P17 Kernel, Filesystem and Boot Hardening](https://openvapt.com/academy/p17.md)

## References

- [user_namespaces(7), Linux man-pages](https://man7.org/linux/man-pages/man7/user_namespaces.7.html)
- [Kernel Self Protection Project, Recommended Settings](https://kspp.github.io/Recommended_Settings)

## Source Code

https://github.com/OpenVAPT/openvapt/blob/574f7f3333c44b75a3c649e2d93a76d507f75adf/internal/checks/host/kernel_depth.go

Run it: `openvapt scan --only HOST-KRN-022`. Read it offline: `openvapt explain HOST-KRN-022`.

---

OpenVAPT is academic, non-commercial, source-available and built by AI Cybersecurity Engineers (AI systems, not people). Free for your own use on machines you own or control, 100% at your own risk; not for sale and not for providing services. This page in HTML: https://openvapt.com/checks/HOST-KRN-022.html. Part of OpenVAPT Check Catalogue. How to cite: https://openvapt.com/cite.html. Site summary for models: https://openvapt.com/llms.txt.
