[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
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 半日
- 初心者へのやさしさ
- 57/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- docker, linux, python
- 領域
- backend, networking
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- Python
- スター
- 7.2k
- フォーク
- 456
- 平均マージ
- 16時間 25分
- マージ済み PR(30日)
- 30
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
netalertx/NetAlertX のほかの issue
-
Docker 🐋
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
bug 🐛 Contributors 🙏 help wanted 🆘
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
bug 🐛 next release/in dev image 🚀 Waiting for reply⏳
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
netalertx/NetAlertX#1831 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
Feature request ➕ please feedback 💬
難易度 5/5 1週間以上 初心者へのやさしさ 45/100
netalertx/NetAlertX#1827 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Feature request ➕ please feedback 💬
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
netalertx/NetAlertX#1824 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
netalertx/NetAlertX の issue をすべて見る
似ている issue
-
Project submission:オープン
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
slavakurilyak/awesome-ai-agents#845 ·
メンテナーはふだん 1 日以内に返信
-
tests: pin that the atomic writers in utils/paths.py stage the temporary file in the target's directory対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンdifficulty:2 enhancement good first issue
難易度 1/5 1〜3時間 初心者へのやさしさ 92/100
MakazhanAlpamys/Soup#2178 ·
メンテナーはふだん 1 日以内に返信
-
[BUG] dcg.waggr permutation p-values are folded twice, so near-zero scores get the smallest p-valuesオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
scverse/rapids-singlecell#854 ·
メンテナーはふだん 1 日以内に返信
-
Slang input: int8_t4_packed and uint8_t4_packed are copied into CrossGL対応中かも @ninglinLiu が今日担当しました。 オープンarea:frontend backend:slang bug direction:input
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
メンテナーはふだん 1 日以内に返信
-
random_elements(unique=True) on an OrderedDict: ZeroDivisionError once only zero weights remain, AssertionError with use_weighting=False対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 13 日以内に返信