Know every vulnerabilitybefore it knows you.
DevGuard continuously monitors your dependencies and alerts you when CVEs like this one affect your stack — with real-time threat intelligence built for developers.
GHSA-f27p-cmv8-xhm6
No affected components available
Summary
When you send a request with the Authorization header to one domain, and the response asks to redirect to a different domain, Deno'sfetch() redirect handling creates a follow-up redirect request that keeps the original Authorization header, leaking its content to that second domain.
Details
The right behavior would be to drop the Authorization header instead, in this scenario. The same is generally applied to Cookie and Proxy-Authorization headers, and is done for not only host changes, but also protocol/port changes. Generally referred to as "origin".
The documentation states:
Deno does not follow the same-origin policy, because the Deno user agent currently does not have the concept of origins, and it does not have a cookie jar. This means Deno does not need to protect against leaking authenticated data cross origin
Reproduction
const ac = new AbortController()
const server1 = Deno.serve({ port: 3001, signal: ac.signal }, (req) => {
return new Response(null, {
status: 302,
headers: {
'location': 'http://localhost:3002/redirected'
},
})
})
const server2 = Deno.serve({ port: 3002, signal: ac.signal }, (req) => {
const body = JSON.stringify({
url: req.url,
hasAuth: req.headers.has('authorization'),
})
return new Response(body, {
status: 200,
headers: {'content-type': 'application/json'},
})
})
async function main() {
const response = await fetch("http://localhost:3001/", {
headers: {authorization: 'Bearer foo'}
})
const body = await response.json()
ac.abort()
if (body.hasAuth) {
console.error('ERROR: Authorization header should not be present after cross-origin redirect')
} else {
console.log('SUCCESS: Authorization header is not present after cross-origin redirect')
}
}
setTimeout(main, 500)
The vulnerability can be exploited over the network without needing physical access. It is easy for an attacker to exploit this vulnerability. An attacker does not need any special privileges or access rights. No user interaction is needed for the attacker to exploit this vulnerability. The impact is confined to the system where the vulnerability exists. There is a high impact on the confidentiality of the information.
Exploitation attempts have been detected. Elevated vigilance and prompt remediation are advised.
The exploit probability is very low. The vulnerability is unlikely to be exploited in the next 30 days.
We did not find any exploit available. Neither in GitHub repositories nor in the Exploit-Database.
Browse More
Continuously monitor your dependencies and get alerted when vulnerabilities like this one affect your stack.
Checkout DevGuard