Skip to content

fix: remove -O from nmap; OS detection requires root - #36

Merged
reloadfast merged 1 commit into
mainfrom
fix/nmap-drop-os-detection
Feb 28, 2026
Merged

reloadfast merged 1 commit into
mainfrom
fix/nmap-drop-os-detection

Conversation

@reloadfast

Copy link
Copy Markdown
Owner

Problem

ARP scan finds hosts correctly, but nmap immediately quits:

TCP/IP fingerprinting (for OS scan) requires root privileges. QUITTING!

This aborts the entire nmap run — no port or service data is collected.

Root Cause

nmap's OS detection (-O) contains a hard-coded geteuid() == 0 check. File capabilities (setcap cap_net_raw+ep) do not affect geteuid() — it always returns non-zero for uid 1000. No capability-based workaround exists.

Fix

Remove -O from the nmap command. Per system_config.md, OS detection was already documented as "best-effort". os_guess will be an empty string; all port and service/version data is unaffected.

Test

test_does_not_use_os_detection_flag — asserts -O is absent and -sV is present in the built command.

nmap hard-codes geteuid()==0 for -O (OS fingerprinting) regardless of
Linux file capabilities. Running as non-root uid 1000 always triggers:
  'TCP/IP fingerprinting (for OS scan) requires root privileges. QUITTING!'
causing the entire nmap scan to abort, losing all service/version data.

-O was documented as best-effort; os_guess will be empty string.
All other scan data (ports, services, version banners) is unaffected.

Test added: test_does_not_use_os_detection_flag asserts -O absent.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@reloadfast
reloadfast merged commit 159c0f6 into main Feb 28, 2026
5 checks passed
@reloadfast
reloadfast deleted the fix/nmap-drop-os-detection branch February 28, 2026 16:08
@reloadfast
reloadfast restored the fix/nmap-drop-os-detection branch March 26, 2026 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant