Skip to content

Bracket IPv6 address literals in HTTP/nikto/testssl host strings#56

Open
RamsesRodenburg wants to merge 1 commit into
PeterMosmans:masterfrom
RamsesRodenburg:fix/ipv6-bracket-urls
Open

Bracket IPv6 address literals in HTTP/nikto/testssl host strings#56
RamsesRodenburg wants to merge 1 commit into
PeterMosmans:masterfrom
RamsesRodenburg:fix/ipv6-bracket-urls

Conversation

@RamsesRodenburg

Copy link
Copy Markdown

Fixes #55.

IPv6 port discovery already works (nmap is correctly given -6), but the
HTTP-layer checks build the connection target by plain concatenation —
f"http://{host}:{port}" and f"{host}:{port}". For an IPv6 literal that yields
http://2001:db8::1:443, which is unparseable: RFC 3986 requires the literal to
be bracketed (http://[2001:db8::1]:443, [2001:db8::1]:443). So scanning an
IPv6 target logs:

http://2001:db8::1:80  Could not connect: Failed to parse: http://2001:db8::1:80

and IPv6 hosts get nmap + SSH/TLS results but no HTTP / nikto findings.

This adds a small bracket_ipv6() helper and applies it at the five sites where
the host goes into a URL or host:port string. It uses the same ":" in host
test the script already uses to decide on -6, so IPv4 addresses and hostnames
are unaffected.

Changed (URL / host:port contexts):

  • http_checks() — the http:// and https:// URLs
  • check_trace() — the curl host:port target
  • do_nikto() — the -host host:port argument
  • do_testssl() — the host:port target

Left unchanged:

  • the nmap target (bare literal + -6, which is correct)
  • do_nikto()'s -vhost {host} (Host header) — for strict correctness an IPv6
    Host: header is also bracketed, but that's the request header rather than the
    connection, and I didn't want to assume the bundled nikto's expectation; happy
    to add if you'd like
  • the per-finding log prefix (display only)

Testing: built a patched image from gofwd/analyze_hosts with this change and
scanned a real dual-stack host by its IPv6 literal — HTTP checks now connect and
report findings (compression / headers / nikto) where they previously failed
with Failed to parse; nmap and SSH/TLS behaviour unchanged.

@RamsesRodenburg RamsesRodenburg force-pushed the fix/ipv6-bracket-urls branch from 9617d57 to fff2bf7 Compare June 23, 2026 07:30
@RamsesRodenburg

Copy link
Copy Markdown
Author

Since I have no option/permissions to squash/merge - feel free to do so as you please 😉

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.

IPv6 targets: HTTP/nikto/testssl checks fail — address literal not bracketed in URLs

1 participant