[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
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- Medio día
- Aptitud para principiantes
- 57/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- docker, linux, python
- Área
- backend, networking
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
- Lenguaje dominante
- Python
- Estrellas
- 7.2k
- Forks
- 456
- Merge medio
- 16 h 25 min
- PR fusionados (30 d)
- 30
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Incluye un Dockerfile o un archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de netalertx/NetAlertX
-
Docker 🐋
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
bug 🐛 Contributors 🙏 help wanted 🆘
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Los mantenedores suelen responder en 1 día
-
bug 🐛 next release/in dev image 🚀 Waiting for reply⏳
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
netalertx/NetAlertX#1831 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Feature request ➕ please feedback 💬
Dificultad 5/5 Más de una semana Aptitud para principiantes 45/100
netalertx/NetAlertX#1827 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Feature request ➕ please feedback 💬
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
netalertx/NetAlertX#1824 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de netalertx/NetAlertX
Issues similares
-
Project submission:Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
slavakurilyak/awesome-ai-agents#845 ·
Los mantenedores suelen responder en 1 día
-
tests: pin that the atomic writers in utils/paths.py stage the temporary file in the target's directoryPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertodifficulty:2 enhancement good first issue
Dificultad 1/5 1-3 horas Aptitud para principiantes 92/100
MakazhanAlpamys/Soup#2178 ·
Los mantenedores suelen responder en 1 día
-
[BUG] dcg.waggr permutation p-values are folded twice, so near-zero scores get the smallest p-valuesAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
scverse/rapids-singlecell#854 ·
Los mantenedores suelen responder en 1 día
-
Slang input: int8_t4_packed and uint8_t4_packed are copied into CrossGLPosiblemente ocupada @ninglinLiu la tomó hoy. Abiertoarea:frontend backend:slang bug direction:input
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
-
random_elements(unique=True) on an OrderedDict: ZeroDivisionError once only zero weights remain, AssertionError with use_weighting=FalsePosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 13 días