Bracket IPv6 address literals in HTTP/nikto/testssl host strings#56
Open
RamsesRodenburg wants to merge 1 commit into
Open
Bracket IPv6 address literals in HTTP/nikto/testssl host strings#56RamsesRodenburg wants to merge 1 commit into
RamsesRodenburg wants to merge 1 commit into
Conversation
9617d57 to
fff2bf7
Compare
Author
|
Since I have no option/permissions to squash/merge - feel free to do so as you please 😉 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #55.
IPv6 port discovery already works (nmap is correctly given
-6), but theHTTP-layer checks build the connection target by plain concatenation —
f"http://{host}:{port}"andf"{host}:{port}". For an IPv6 literal that yieldshttp://2001:db8::1:443, which is unparseable: RFC 3986 requires the literal tobe bracketed (
http://[2001:db8::1]:443,[2001:db8::1]:443). So scanning anIPv6 target logs:
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 wherethe host goes into a URL or
host:portstring. It uses the same":" in hosttest the script already uses to decide on
-6, so IPv4 addresses and hostnamesare unaffected.
Changed (URL / host:port contexts):
http_checks()— thehttp://andhttps://URLscheck_trace()— the curlhost:porttargetdo_nikto()— the-host host:portargumentdo_testssl()— thehost:porttargetLeft unchanged:
-6, which is correct)do_nikto()'s-vhost {host}(Host header) — for strict correctness an IPv6Host:header is also bracketed, but that's the request header rather than theconnection, and I didn't want to assume the bundled nikto's expectation; happy
to add if you'd like
Testing: built a patched image from
gofwd/analyze_hostswith this change andscanned 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.