[Bug] NMAPDEV (nmap) runs unprivileged under UID 20211 ('You are not root -- using TCP pingscan rather than ICMP'), breaking ARP/ICMP discovery and MAC detection
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- Half a day
- Newbie friendliness
- 57/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- docker, linux, python
- Domain
- backend, networking
Research direction
Start by reading the NMAPDEV configuration at server/plugins/nmap_dev_scan/config.json and the container Dockerfile; the report identifies both as possible places to address the privilege detection behavior. Reproduce the default scan under UID 20211 with the listed capabilities and compare its output with a scan using --privileged. Done means the configured scan uses raw ARP and ICMP probes and returns real MAC addresses for local hosts.
Written by the indexing model from the issue text.
Description
What installation are you running?
Production (netalertx) 📦
Is there an existing issue for this?
- I have searched the existing open and closed issues and I checked the docs https://docs.netalertx.com/
The issue occurs in the following browsers. Select at least 2.
- Firefox
- Chrome
- Edge
- Safari (unsupported) - PRs welcome
- N/A - This is an issue with the backend
Current Behavior
Since the container runs as the non-root user netalertx (UID 20211) with Linux capabilities (CAP_NET_RAW, CAP_NET_ADMIN) and /usr/bin/sudo is a pass-through wrapper (#!/bin/sh / "$@"), running NMAPDEV with its default arguments (sudo nmap -sn -PR -oX - ) causes nmap to check geteuid() == 0, assume it is unprivileged, and print:
Warning: You are not root -- using TCP pingscan rather than ICMP
As a result:
- On local subnets:
nmapdoes not perform raw ARP discovery (-PRis ignored) and does not return MAC addresses in the XML output (mac == ''). Consequently,nmap_dev.pyeither skips all local hosts (IP or MAC missing) or, ifNMAPDEV_FAKE_MAC=Trueis enabled, generates duplicatefa:ce:...fake MACs for local devices that actually have real MAC addresses. - On routed/remote subnets:
nmapcannot send raw ICMP echo probes and falls back to unprivileged TCPconnect()on ports 80 and 443 only, missing all hosts (smartphones, tablets, IoT appliances, printers) that do not have port 80/443 open and only reply to ICMP ping.
Expected Behavior
nmap should utilize the container's CAP_NET_RAW / CAP_NET_ADMIN capabilities when running under UID 20211 so that raw ARP (-PR) and ICMP echo (-PE) scans work as intended and local MAC addresses are properly retrieved.
Suggested Fix:
nmap natively supports running with Linux capabilities under non-root UIDs when either:
ENV NMAP_PRIVILEGED=1is set in the container environment (Dockerfile), or--privilegedis added to the defaultNMAPDEV_ARGSinserver/plugins/nmap_dev_scan/config.json(e.g.sudo nmap --privileged -sn -PR -oX -).
Steps To Reproduce
- Run NetAlertX with the recommended hardened
docker-compose.yml(UID 20211,cap_add: NET_RAW, NET_ADMIN). - Enable
NMAPDEVwith defaultNMAPDEV_ARGS='sudo nmap -sn -PR -oX - '. - Observe
Warning: You are not root -- using TCP pingscan rather than ICMPin stderr and missing MAC addresses / missed ICMP-only hosts innmap_dev.pyoutput. - Set
NMAPDEV_ARGS='sudo nmap --privileged -sn -PR -oX - '(orNMAP_PRIVILEGED=1) ->nmapimmediately uses raw sockets, returnsarp-responsewith real MAC addresses on local subnets, andecho-replyon routed subnets.
Relevant app.conf settings
LOADED_PLUGINS=['ARPSCAN', 'NMAPDEV', ...]
NMAPDEV_RUN='schedule'
NMAPDEV_FAKE_MAC=True
# Default (broken under UID 20211):
NMAPDEV_ARGS='sudo nmap -sn -PR -oX - '
# Working workaround:
NMAPDEV_ARGS='nmap --privileged -sn -PE -oX - '
docker-compose.yml
services:
netalertx:
image: ghcr.io/netalertx/netalertx:26.10.0
network_mode: host
cap_drop:
- ALL
cap_add:
- NET_ADMIN
- NET_RAW
- NET_BIND_SERVICE
Debug or Trace enabled
- I have read and followed the steps in the wiki link above and provided the required debug logs and the log section covers the time when the issue occurs.
Relevant app.log section
[NMAPDEV] Executing: sudo nmap -sn -PR -oX - 192.168.101.0/24
Warning: You are not root -- using TCP pingscan rather than ICMP
[NMAPDEV] Found 2 devices
Docker Logs
[NMAPDEV] Executing: sudo nmap -sn -PR -oX - 192.168.101.0/24
Warning: You are not root -- using TCP pingscan rather than ICMP
- Dominant language
- Python
- Stars
- 7.2k
- Forks
- 456
- Avg merge
- 17h 59m
- Merged PRs (30d)
- 26
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from netalertx/NetAlertX
-
bug 🐛
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
netalertx/NetAlertX#1856 · 1 comment · 7 reactions ·
Maintainers usually reply within 1 day
-
[Bug] MCP SSE endpoint event omits the /server prefix, so clients behind the built-in nginx proxy get a 404 on /mcp/messagesPossibly taken @frdmn claimed this 2 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Docker 🐋
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
bug 🐛 next release/in dev image 🚀 Waiting for reply⏳
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
netalertx/NetAlertX#1851 · 2 comments ·
Maintainers usually reply within 1 day
-
[Bug] Internet-Check returns 0.0.0.0 when IPv6 is enabled and OpenDNS lookup failsPossibly taken @pujitha24 claimed this 6 days ago. Openbug 🐛 next release/in dev image 🚀 Waiting for reply⏳
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
netalertx/NetAlertX#1845 · 2 comments ·
Maintainers usually reply within 1 day
All issues in netalertx/NetAlertX
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
foxglove/mcap#1907 · 1 comment ·
Maintainers usually reply within 1 day
-
namespace operations
Difficulty 1/5 Under an hour Newbie friendliness 72/100
EclipseFdn/open-vsx.org#14623 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
developmentseed/titiler-cmr#261 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
andrewyng/openworker#774 ·
Maintainers usually reply within 1 day
-
aggfuncOpen
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
worldbank/blackmarblepy#160 ·