projectdiscovery / naabu

A fast port scanner written in go with a focus on reliability and simplicity. Designed to be used in combination with other tools for attack surface discovery in bug bounties and pentests
https://projectdiscovery.io
MIT License
4.51k stars 531 forks source link

naabu does not work with sudo su #1130

Closed khaledkamal456 closed 1 month ago

khaledkamal456 commented 1 month ago

When I run naabu with sudo su, it appears like this without any output

naabu -host "34.120.164.219" -top-ports 1000  -json -debug                        

                  __
  ___  ___  ___ _/ /  __ __
 / _ \/ _ \/ _ \/ _ \/ // /
/_//_/\_,_/\_,_/_.__/\_,_/

                projectdiscovery.io

[INF] Current naabu version 2.3.1 (latest)
[INF] Running host discovery scan
[DBG] Received ICMP response from 34.120.164.219
[INF] Running SYN scan with CAP_NET_RAW privileges

When I run naabu without sudo su, it appears like this

naabu -host "34.120.164.219" -top-ports 1000  -json -debug                       

                  __
  ___  ___  ___ _/ /  __ __
 / _ \/ _ \/ _ \/ _ \/ // /
/_//_/\_,_/\_,_/_.__/\_,_/

                projectdiscovery.io

[INF] Current naabu version 2.3.1 (latest)
[INF] Running CONNECT scan with non root privileges
{"ip":"34.120.164.219","timestamp":"2024-06-25T00:27:29.8116474Z","port":443,"protocol":"tcp","tls":false}
{"ip":"34.120.164.219","timestamp":"2024-06-25T00:27:29.84001781Z","port":80,"protocol":"tcp","tls":false}
[INF] Found 2 ports on host 34.120.164.219 (34.120.164.219)

Knowing that the which naabu command was not executed, it shows me the same path whether I use subo su or not

which naabu
/home/user/go/bin/naabu
-rwxr-xr-x 1 root root 40703416 Jun 25 03:17 /home/user/go/bin/naabu
dogancanbakir commented 1 month ago

I couldn't repro the issue on osx - used the dev branch for testing:

$ sudo naabu -host "34.120.164.219" -top-ports 1000 -json -debug  

                  __
  ___  ___  ___ _/ /  __ __
 / _ \/ _ \/ _ \/ _ \/ // /
/_//_/\_,_/\_,_/_.__/\_,_/

                projectdiscovery.io

[INF] Current naabu version 2.2.0 (outdated)
[INF] Running host discovery scan
[INF] Running SYN scan with root privileges
[INF] Found 2 ports on host 34.120.164.219 (34.120.164.219)
{"ip":"34.120.164.219","timestamp":"2024-06-25T12:16:34.141933Z","port":443,"protocol":"tcp","tls":false}
{"ip":"34.120.164.219","timestamp":"2024-06-25T12:16:34.141933Z","port":80,"protocol":"tcp","tls":false}