Skip to content

Malformed IPv6 target ports are silently ignored or truncated #6197

Done

Description

@1akashkalita

Describe the bug

parseTargetUrl() silently drops or truncates malformed ports on bracketed IPv6 targets. On master eae0f00dcb0384a058c9fc423c0078f5a9007aee:

Input Parsed destination
http://[::1]:abc/path?id=1 http://[::1]/path, port 80
http://[::1]:-1/path?id=1 http://[::1]/path, port 80
http://[::1]:8080junk/path?id=1 http://[::1]:8080/path, port 8080

The equivalent hostname input http://example.com:abc/path?id=1 raises SqlmapSyntaxException. Silently choosing a different destination makes an input typo harder to diagnose.

To reproduce

From a clone of master, run this offline parser reproduction (no target requests):

import sys
sys.path.insert(0, "tests")
from _testutils import bootstrap
bootstrap()
from lib.core.common import parseTargetUrl
from lib.core.data import conf

for url in ("http://[::1]:abc/path?id=1", "http://[::1]:-1/path?id=1",
            "http://[::1]:8080junk/path?id=1"):
    conf.url = url
    parseTargetUrl()
    print(conf.url, conf.port)

Expected behavior

Reject the malformed port through the existing integer/range validation instead of ignoring its non-digit suffix. Valid bracketed IPv6 addresses and their explicit/default ports should retain their current behavior.

Running environment

  • sqlmap 1.10.12.5, cloned from master at the commit above
  • macOS 26.3.1, Apple Silicon
  • CPython 3.12.13
  • DBMS, injection techniques, WAF/IPS: not applicable; URL parsing only.

Found through independent source inspection with AI assistance and reproduced locally. I have a focused one-line parser fix and regression coverage; the full unit suite ran 2,764 tests with 12 skips in a clean environment, and pyflakes and the smoke test passed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions