NewApp Monitoring is liveSign up free
AgentbeamBeta
Open-source package vulnerability · Rust (crates.io)

CVE-2025-21620: fetch: Authorization headers not dropped when redirecting cross-origin

highCVSS 3.0 7.5GHSA-f27p-cmv8-xhm6

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.

Published Jan 6, 2025 · Updated Jan 7, 2025

Affected packages

deno_fetch

Ecosystem
Rust (crates.io)
Affected
>= 0.0.1, < 0.204.0
Fixed in
0.204.0
Check
cargo tree -i deno_fetch

deno

Ecosystem
Rust (crates.io)
Affected
<= 1.46.3
Fixed in
No patched version yet
Check
cargo tree -i deno

deno

Ecosystem
Rust (crates.io)
Affected
>= 2.0.0, < 2.1.2
Fixed in
2.1.2
Check
cargo tree -i deno

Advisory details

From the GitHub Advisory Database (CC BY 4.0).

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)

Credited to rexxars.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology

More Rust (crates.io) vulnerabilities

All Rust (crates.io) entries