Repository navigation
Reject malformed IPv6 target ports - #6198
Merged
stamparm merged 1 commit intoDec 4, 2026
Merged
Conversation
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 #6197.
Malformed IPv6 ports are silently ignored or truncated by the digit-only extraction in
parseTargetUrl(). For example,http://[::1]:abc/pathbecomes port 80 and:8080junkbecomes port 8080. Equivalent malformed hostname ports are rejected.Split the bracketed IPv6 host from the complete port suffix, letting the existing integer and range checks reject invalid ports. Add regression/control coverage for malformed and out-of-range ports, HTTP(S)/WebSocket defaults, valid explicit ports, IPv4-mapped IPv6 and URL userinfo. Restore the IPv6 flag after the test module.
Found through independent source inspection with AI assistance and reproduced against master
eae0f00dcb0384a058c9fc423c0078f5a9007aee.Validation on macOS arm64, CPython 3.12.13, in a clean environment:
git diff --checkpassed.python -B sqlmap.py --smoke-testpassed.The machine's separate Python 3.14 alpha installation initially produced 19 errors from its installed Crypto/cffi stack; the clean Python 3.12 run above passed. Other upstream OS/interpreter jobs and live-target tests were not run locally. Final diff self-reviewed; no independent human review is claimed.