View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0009711 | Kali Linux | Kali Package Bug | public | 2026-05-26 09:12 | 2026-05-26 09:12 |
| Reporter | federico.brasili | Assigned To | |||
| Priority | normal | Severity | minor | Reproducibility | have not tried |
| Status | new | Resolution | open | ||
| Summary | 0009711: Security issue in Kali nmap package: NSE package.loadlib() enables arbitrary native code execution with CAP_NET_ADMIN/CAP_NET_RA | ||||
| Description | Hello Kali Security Team, I would like to responsibly report a local privilege-boundary issue in the Kali nmap package. Summary On my Kali system, the nmap package installs /usr/lib/nmap/nmap with broad Linux file capabilities: /usr/lib/nmap/nmap cap_net_bind_service,cap_net_admin,cap_net_raw=eip The /usr/bin/nmap wrapper executes /usr/lib/nmap/nmap and automatically adds --privileged for non-root users: #!/usr/bin/env sh set -e if [ "$(id -u)" -eq 0 ] || [ "$1" = "--resume" ]; then Nmap NSE exposes Lua package.loadlib(), allowing an unprivileged local user to load an arbitrary native shared object from a user-controlled path. Because the shared object is loaded inside the file-capability-enabled nmap process, attacker-controlled native code runs with: CAP_NET_ADMIN I was also able to raise those capabilities into the ambient set and execute child processes that inherit them. Affected environment Observed package/capability state: Package: nmap -rwxr-xr-x 1 root root 165 /usr/bin/nmap /usr/lib/nmap/nmap cap_net_bind_service,cap_net_admin,cap_net_raw=eip A non-root local user can execute arbitrary native code with effective network-administration capabilities intended for nmap scanning. Confirmed capabilities inside attacker-controlled native code loaded via NSE: Uid: 1000 1000 1000 1000 0x3400 decodes to: cap_net_bind_service,cap_net_admin,cap_net_raw After raising ambient capabilities from the loaded native code, a child /bin/sh process inherited them: Uid: 1000 1000 1000 1000 This allows non-root users to perform privileged network operations such as: creating and bringing up TUN/TAP interfaces; ip link confirmed the interface was created and brought up: graaltun8194: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN This is not a full root privilege escalation because the attacker does not receive capabilities such as CAP_SYS_ADMIN, CAP_SETUID, CAP_DAC_READ_SEARCH, or CAP_SYS_PTRACE. However, it does allow arbitrary attacker-controlled native code to obtain CAP_NET_ADMIN, CAP_NET_RAW, and CAP_NET_BIND_SERVICE, which is a significant local privilege-boundary break. The issue is especially relevant on multi-user systems, shared Kali workstations, training labs, CI/security automation hosts, and jump boxes where unprivileged users may exist. Root cause The package grants broad file capabilities to an extensible interpreter-like program. Nmap NSE allows loading native shared libraries via Lua package.loadlib(). Therefore, capabilities intended for nmap’s internal network-scanning operations become available to arbitrary user-controlled native code. Suggested mitigations Possible options: Do not grant CAP_NET_ADMIN to /usr/lib/nmap/nmap by default. This report is based on local testing on my own Kali system. No third-party systems were accessed. I have not publicly disclosed the full PoC. Please let me know whether you would like a minimal reproducer archive or additional logs. Best regards, Federico Brasil | ||||
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2026-05-26 09:12 | federico.brasili | New Issue |