Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPv6 port scanning attempted when -iv 4 (or default value) specified #1234

Open
AV-IO opened this issue Oct 9, 2024 · 2 comments · Fixed by #1235
Open

IPv6 port scanning attempted when -iv 4 (or default value) specified #1234

AV-IO opened this issue Oct 9, 2024 · 2 comments · Fixed by #1235
Assignees
Labels
hacktoberfest-accepted Status: Completed Nothing further to be done with this issue. Awaiting to be closed. Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors.

Comments

@AV-IO
Copy link

AV-IO commented Oct 9, 2024

Naabu version: 2.3.1

Current Behavior:

Naabu appears to attempt IPv6 scanning even when not specified.

Expected Behavior:

IPv6 only to be scanned when specified.
While no effective scanning is taking place, I don't think scanning should be attempted at least to not pollute debug logs.

Steps To Reproduce:

  1. Run sudo naabu -host "google.com" -iv 4 -debug (ports and other options may be specified to truncate results)
  2. See debug logs including IPv6 addresses

From OSX:

# sudo naabu -host "google.com" -iv 4 -p 80,443,1234 -debug
[INF] Current naabu version 2.3.1 (latest)
[INF] Running host discovery scan
[DBG] Received ICMP response from 142.250.72.174
[DBG] Received ICMP response from 142.250.72.174
[DBG] Received ICMP response from 142.250.72.174
[INF] Running SYN scan with root privileges
[DBG] Can not send packet to da86:8811:800:4500:2c:0:4000:7a06:80 port: Invalid source IPv6 address (wrong length of 0 bytes instead of 16)
[DBG] Can not send packet to da86:8811:800:4500:2c:0:4000:7a06:443 port: Invalid source IPv6 address (wrong length of 0 bytes instead of 16)
[DBG] Can not send packet to da86:8811:800:4500:2c:0:4000:7a06:1234 port: Invalid source IPv6 address (wrong length of 0 bytes instead of 16)
[DBG] Can not send packet to da86:8811:800:4500:2c:0:4000:7a06:80 port: Invalid source IPv6 address (wrong length of 0 bytes instead of 16)
[DBG] Can not send packet to da86:8811:800:4500:2c:0:4000:7a06:443 port: Invalid source IPv6 address (wrong length of 0 bytes instead of 16)
[DBG] Can not send packet to da86:8811:800:4500:2c:0:4000:7a06:1234 port: Invalid source IPv6 address (wrong length of 0 bytes instead of 16)
[DBG] Can not send packet to da86:8811:800:4500:2c:0:4000:7a06:80 port: Invalid source IPv6 address (wrong length of 0 bytes instead of 16)
[DBG] Can not send packet to da86:8811:800:4500:2c:0:4000:7a06:443 port: Invalid source IPv6 address (wrong length of 0 bytes instead of 16)
[DBG] Can not send packet to da86:8811:800:4500:2c:0:4000:7a06:1234 port: Invalid source IPv6 address (wrong length of 0 bytes instead of 16)
google.com:443
[DBG] Received Transport (TCP) scan response from ipv4:142.250.72.174 ipv6:da86:8811:800:4500:2c:0:4000:7a06 port:443
google.com:80
[DBG] Received Transport (TCP) scan response from ipv4:142.250.72.174 ipv6:da86:8811:800:4500:2c:0:4000:7a06 port:80
[DBG] Received Transport (TCP) scan response from ipv4:142.250.72.174 ipv6:da86:8811:800:4500:2c:0:4000:3a06 port:443
[DBG] Received Transport (TCP) scan response from ipv4:142.250.72.174 ipv6:da86:8811:800:4500:2c:0:4000:3a06 port:80
[DBG] Received Transport (TCP) scan response from ipv4:142.250.72.174 ipv6:da86:8811:800:4500:2c:0:4000:7a06 port:80
[DBG] Received Transport (TCP) scan response from ipv4:142.250.72.174 ipv6:da86:8811:800:4500:2c:0:4000:3a06 port:443
[INF] Found 2 ports on host google.com (142.250.72.174)

From Amazon Linux 2:

# sudo naabu -host "google.com" -iv 4 -p 80,443,1234 -debug
[INF] Current naabu version 2.3.1 (latest)
[INF] Running host discovery scan
[DBG] Received ICMP response from 142.250.217.110
[DBG] Received ICMP response from 142.250.217.110
[DBG] Received ICMP response from 142.250.217.110
[DBG] Received ICMP response from 142.250.217.110
[INF] Running SYN scan with CAP_NET_RAW privileges
[DBG] could not find route to host 8785:cdbd:800:4580:2c:0:4000:7a06:80: no route found for 8785:cdbd:800:4580:2c:0:4000:7a06
[DBG] could not find route to host 8785:cdbd:800:4580:28:0:4000:7a06:443: no route found for 8785:cdbd:800:4580:28:0:4000:7a06
[DBG] could not find route to host 8785:cdbd:800:4580:2c:0:4000:7a06:1234: no route found for 8785:cdbd:800:4580:2c:0:4000:7a06
[DBG] could not find route to host 8785:cdbd:800:4580:2c:0:4000:7a06:443: no route found for 8785:cdbd:800:4580:2c:0:4000:7a06
[DBG] could not find route to host 8785:cdbd:800:4580:28:0:4000:7a06:80: no route found for 8785:cdbd:800:4580:28:0:4000:7a06
[DBG] could not find route to host 8785:cdbd:800:4580:28:0:4000:7a06:1234: no route found for 8785:cdbd:800:4580:28:0:4000:7a06
[DBG] could not find route to host 8785:cdbd:800:4580:2c:0:4000:7a06:1234: no route found for 8785:cdbd:800:4580:2c:0:4000:7a06
[DBG] could not find route to host 8785:cdbd:800:4580:28:0:4000:7a06:80: no route found for 8785:cdbd:800:4580:28:0:4000:7a06
[DBG] could not find route to host 8785:cdbd:800:4580:28:0:4000:7a06:443: no route found for 8785:cdbd:800:4580:28:0:4000:7a06
[DBG] could not find route to host 8785:cdbd:800:4580:28:0:4000:7a06:1234: no route found for 8785:cdbd:800:4580:28:0:4000:7a06
[DBG] could not find route to host 8785:cdbd:800:4580:2c:0:4000:7a06:443: no route found for 8785:cdbd:800:4580:2c:0:4000:7a06
[DBG] could not find route to host 8785:cdbd:800:4580:2c:0:4000:7a06:80: no route found for 8785:cdbd:800:4580:2c:0:4000:7a06
[DBG] could not find route to host 8785:cdbd:800:4580:28:0:4000:7a06:443: no route found for 8785:cdbd:800:4580:28:0:4000:7a06
[DBG] could not find route to host 8785:cdbd:800:4580:28:0:4000:7a06:80: no route found for 8785:cdbd:800:4580:28:0:4000:7a06
[DBG] could not find route to host 8785:cdbd:800:4580:2c:0:4000:7a06:443: no route found for 8785:cdbd:800:4580:2c:0:4000:7a06
[DBG] could not find route to host 8785:cdbd:800:4580:28:0:4000:7a06:1234: no route found for 8785:cdbd:800:4580:28:0:4000:7a06
[DBG] could not find route to host 8785:cdbd:800:4580:2c:0:4000:7a06:80: no route found for 8785:cdbd:800:4580:2c:0:4000:7a06
[DBG] could not find route to host 8785:cdbd:800:4580:2c:0:4000:7a06:1234: no route found for 8785:cdbd:800:4580:2c:0:4000:7a06
google.com:443
[DBG] Received Transport (TCP) scan response from ipv4:142.250.217.110 ipv6:8785:cdbd:800:4500:28:0:4000:3a06 port:443
google.com:80
[DBG] Received Transport (TCP) scan response from ipv4:142.250.217.110 ipv6:8785:cdbd:800:4580:28:0:4000:7a06 port:80
[DBG] Received Transport (TCP) scan response from ipv4:142.250.217.110 ipv6:8785:cdbd:800:4500:28:0:4000:3a06 port:80
[INF] Found 2 ports on host google.com (142.250.217.110)

Anything else:

These results are not too different from when IPv4 and IPv6 are scanned together:

# sudo naabu -host "google.com" -iv 4,6 -p 80,443,1234 -debug
[INF] Current naabu version 2.3.1 (latest)
[INF] Running host discovery scan
[DBG] Can not send packet to 2607:f8b0:402a:80a::200e:80 port: Invalid source IPv6 address (wrong length of 0 bytes instead of 16)
[DBG] Can not send packet to 2607:f8b0:402a:80a::200e:443 port: Invalid source IPv6 address (wrong length of 0 bytes instead of 16)
[DBG] Can not send packet to 2607:f8b0:402a:80a::200e:80 port: Invalid source IPv6 address (wrong length of 0 bytes instead of 16)
[DBG] Can not send packet to 2607:f8b0:402a:80a::200e:443 port: Invalid source IPv6 address (wrong length of 0 bytes instead of 16)
[DBG] Received ICMP response from 142.250.72.238
[DBG] Received ICMP response from 142.250.72.238
[DBG] Received ICMP response from 142.250.72.238
[INF] Running SYN scan with root privileges
[DBG] Can not send packet to da86:8811:800:4500:2c:0:4000:3a06:1234 port: Invalid source IPv6 address (wrong length of 0 bytes instead of 16)
[DBG] Can not send packet to da86:8811:800:4500:2c:0:4000:3a06:80 port: Invalid source IPv6 address (wrong length of 0 bytes instead of 16)
[DBG] Can not send packet to da86:8811:800:4500:2c:0:4000:3a06:443 port: Invalid source IPv6 address (wrong length of 0 bytes instead of 16)
[DBG] Can not send packet to da86:8811:800:4500:2c:0:4000:3a06:80 port: Invalid source IPv6 address (wrong length of 0 bytes instead of 16)
[DBG] Can not send packet to da86:8811:800:4500:2c:0:4000:3a06:443 port: Invalid source IPv6 address (wrong length of 0 bytes instead of 16)
[DBG] Can not send packet to da86:8811:800:4500:2c:0:4000:3a06:1234 port: Invalid source IPv6 address (wrong length of 0 bytes instead of 16)
[DBG] Can not send packet to da86:8811:800:4500:2c:0:4000:3a06:80 port: Invalid source IPv6 address (wrong length of 0 bytes instead of 16)
[DBG] Can not send packet to da86:8811:800:4500:2c:0:4000:3a06:443 port: Invalid source IPv6 address (wrong length of 0 bytes instead of 16)
[DBG] Can not send packet to da86:8811:800:4500:2c:0:4000:3a06:1234 port: Invalid source IPv6 address (wrong length of 0 bytes instead of 16)
google.com:443
da86:8811:800:4500:2c:0:4000:7a06:443
[DBG] Received Transport (TCP) scan response from ipv4:142.250.72.238 ipv6:da86:8811:800:4500:2c:0:4000:7a06 port:443
google.com:80
da86:8811:800:4500:2c:0:4000:3a06:80
[DBG] Received Transport (TCP) scan response from ipv4:142.250.72.238 ipv6:da86:8811:800:4500:2c:0:4000:3a06 port:80
da86:8811:800:4500:28:0:4000:7a06:443
[DBG] Received Transport (TCP) scan response from ipv4:142.250.72.238 ipv6:da86:8811:800:4500:28:0:4000:7a06 port:443
da86:8811:800:4500:2c:0:4000:7a06:80
[DBG] Received Transport (TCP) scan response from ipv4:142.250.72.238 ipv6:da86:8811:800:4500:2c:0:4000:7a06 port:80
[DBG] Received Transport (TCP) scan response from ipv4:142.250.72.238 ipv6:da86:8811:800:4500:2c:0:4000:3a06 port:80
[INF] Found 2 ports on host da86:8811:800:4500:2c:0:4000:7a06 (da86:8811:800:4500:2c:0:4000:7a06)
[INF] Found 1 ports on host da86:8811:800:4500:2c:0:4000:3a06 (da86:8811:800:4500:2c:0:4000:3a06)
[INF] Found 1 ports on host da86:8811:800:4500:28:0:4000:7a06 (da86:8811:800:4500:28:0:4000:7a06)
[INF] Found 2 ports on host google.com (142.250.72.238)

(which does seem to falsely report IPv6 ports, as IPv6 is not routable from my system)

# sudo naabu -host "google.com" -iv 6 -p 80,443,1234 -debug
[INF] Current naabu version 2.3.1 (latest)
[INF] Running host discovery scan
[DBG] Can not send packet to 2607:f8b0:402a:80a::200e:80 port: Invalid source IPv6 address (wrong length of 0 bytes instead of 16)
[DBG] Can not send packet to 2607:f8b0:402a:80a::200e:443 port: Invalid source IPv6 address (wrong length of 0 bytes instead of 16)
[DBG] Can not send packet to 2607:f8b0:402a:80a::200e:80 port: Invalid source IPv6 address (wrong length of 0 bytes instead of 16)
[DBG] Can not send packet to 2607:f8b0:402a:80a::200e:443 port: Invalid source IPv6 address (wrong length of 0 bytes instead of 16)
[INF] Running SYN scan with root privileges
[FTL] Could not run enumeration: no valid ipv4 or ipv6 targets were found
@AV-IO AV-IO added the Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors. label Oct 9, 2024
@mcamou
Copy link

mcamou commented Oct 11, 2024

I would like to tackle this one, could you please assign it to me with hacktoberfest or hacktoberfest-accepted?

@mcamou
Copy link

mcamou commented Oct 12, 2024

Here's the PR: #1235

@Mzack9999 Mzack9999 linked a pull request Oct 14, 2024 that will close this issue
ehsandeep added a commit that referenced this issue Oct 14, 2024
* chore(deps): bump google.golang.org/protobuf in /v2

Bumps google.golang.org/protobuf from 1.31.0 to 1.33.0.

---
updated-dependencies:
- dependency-name: google.golang.org/protobuf
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

* chore(deps): bump github.com/quic-go/quic-go in /v2

Bumps [github.com/quic-go/quic-go](https://github.com/quic-go/quic-go) from 0.38.2 to 0.42.0.
- [Release notes](https://github.com/quic-go/quic-go/releases)
- [Changelog](https://github.com/quic-go/quic-go/blob/master/Changelog.md)
- [Commits](quic-go/quic-go@v0.38.2...v0.42.0)

---
updated-dependencies:
- dependency-name: github.com/quic-go/quic-go
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

* chore(deps): bump golang.org/x/net from 0.22.0 to 0.23.0 in /v2

Bumps [golang.org/x/net](https://github.com/golang/net) from 0.22.0 to 0.23.0.
- [Commits](golang/net@v0.22.0...v0.23.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Fix #1234: Honor the -iv flag when scanning

* Lint fixes

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: sandeep <[email protected]>
Co-authored-by: mzack9999 <[email protected]>
@ehsandeep ehsandeep added the Status: Completed Nothing further to be done with this issue. Awaiting to be closed. label Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest-accepted Status: Completed Nothing further to be done with this issue. Awaiting to be closed. Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants