sqlmapproject/sqlmap · error · SqlmapSyntaxException

proxy authentication credentials value must be in format…

Error message

proxy authentication credentials value must be in format username:password

What it means

When --proxy-cred is given alongside a proxy, _setHTTPHandlers matches the value against a strict 'username:password' regular expression. This validation fires when the credentials do not match — missing colon, empty username/password, or extra segments — raising SqlmapSyntaxException; the credentials never reach the proxy authentication handler.

Solutions

  1. Format the value as `username:password`, e.g. `--proxy-cred="john:secret"`.
  2. Do not URL-encode or base64-encode the credentials; pass them in plaintext and let sqlmap handle encoding.
  3. Ensure exactly one colon separates username and password (escape or change passwords containing colons if needed).
  4. If the password contains special shell characters, quote the whole argument.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at lib/core/option.py:1296 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of sqlmapproject/sqlmap@0a35b20e39 (2026-08-26). Data as JSON: /api/errors/935ae1a1014e173e. Report an issue: GitHub.

Appendix: source

Thrown at lib/core/option.py:1296

            hostname = hostnamePort[0]
            port = None

            if len(hostnamePort) == 2:
                try:
                    port = int(hostnamePort[1])
                except:
                    pass  # drops into the next check block

            if not all((scheme, hasattr(PROXY_TYPE, scheme), hostname, port)):
                errMsg = "proxy value must be in format '(%s)://address:port'" % "|".join(_[0].lower() for _ in getPublicTypeMembers(PROXY_TYPE))
                raise SqlmapSyntaxException(errMsg)

            if conf.proxyCred:
                _ = re.search(r"\A(.*?):(.*?)\Z", conf.proxyCred)
                if not _:
                    errMsg = "proxy authentication credentials "
                    errMsg += "value must be in format username:password"
                    raise SqlmapSyntaxException(errMsg)
                else:
                    username = _.group(1)
                    password = _.group(2)

            if scheme in (PROXY_TYPE.SOCKS4, PROXY_TYPE.SOCKS5):
                proxyHandler.proxies = {}

                if scheme == PROXY_TYPE.SOCKS4:
                    warnMsg = "SOCKS4 does not support resolving (DNS) names (i.e. causing DNS leakage)"
                    singleTimeWarnMessage(warnMsg)

                socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5 if scheme == PROXY_TYPE.SOCKS5 else socks.PROXY_TYPE_SOCKS4, hostname, port, username=username, password=password)
                socks.wrapmodule(_http_client)
            else:
                socks.unwrapmodule(_http_client)

                if conf.proxyCred:
                    # Reference: http://stackoverflow.com/questions/34079/how-to-specify-an-authenticated-proxy-for-a-python-http-connection

View on GitHub (pinned to 0a35b20e39)