Skip to content

Reject malformed IPv6 target ports - #6198

Merged
stamparm merged 1 commit into
sqlmapproject:masterfrom
1akashkalita:fix/ipv6-target-port-validation
Dec 4, 2026
Merged

stamparm merged 1 commit into
sqlmapproject:masterfrom
1akashkalita:fix/ipv6-target-port-validation

Conversation

@1akashkalita

Copy link
Copy Markdown
Contributor

Fixes #6197.

Malformed IPv6 ports are silently ignored or truncated by the digit-only extraction in parseTargetUrl(). For example, http://[::1]:abc/path becomes port 80 and :8080junk becomes 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:

  • Final focused tests against original production source: 16 tests run, 2 regression failures and 14 passes.
  • With the fix: full unit suite, 2,764 tests run, 12 skipped, no failures or errors.
  • Pyflakes on both changed files and git diff --check passed.
  • python -B sqlmap.py --smoke-test passed.

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.

@stamparm
stamparm merged commit c446f66 into sqlmapproject:master Dec 4, 2026
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.

Malformed IPv6 target ports are silently ignored or truncated

2 participants