Vulnerability DatabaseGHSA-cprq-r4fp-jx46

GHSA-cprq-r4fp-jx46: 
Rust vulnerability analysis and mitigation

Affected versions: read from source: every release from v0.18.0 (commit 6b2ac397, which introduced DPoPNonce::is_valid) through v0.36.2, and main at 989f9ff9. Demonstrated at runtime only on a build of v0.36.2. Severity: left to you; not assessed here. DPoPNonce::is_valid (src/data/src/entity/dpop_proof.rs) returns is_ok() on the cache lookup:

let slf: Result<Option<Self>, hiqlite::Error> = DB::hql().get(Cache::DPoPNonce, value).await;
slf.is_ok()

A lookup that finds nothing is Ok(None), so any nonce value is accepted, including one the server never issued and the fixed cache key latest. DPoPProof::validate_nonce is the only caller, and every DPoP-bound grant reaches the nonce through it (password, client credentials, authorization code, token exchange, and the DPoP-bound refresh path); none checks the nonce independently. With the default DPOP_FORCE_NONCE=true, a proof carrying a made-up nonce gets a token instead of the 400 use_dpop_nonce challenge. Separately, DPoPNonce::get_latest is meant to hand out the current nonce only while it has at least 15 s left, but compares exp < now - 15s, so it hands one out until the cache evicts it. With expiry enforced, that becomes visible as a refused retry; it is part of the same fix. Impact, as far as it was examined: narrow. What is lost is the server-issued freshness that DPOP_FORCE_NONCE promises. Every other proof check still holds: the signature by the key the token is bound to, htm, htu, and iat within the last 60 s and not in the future. A proof therefore still needs the private key and is usable for at most about 60 s. There is no jti replay tracking either way; the nonce (valid 900 s by default, not single-use) would not have provided it. Not examined: relying parties that treat the nonce as a stronger guarantee. Reproducer: in src/bin/tests/handler_auth.rs, test_dpop, after the first request that returns the DPoP-Nonce header, sign two more proofs with the same key whose nonce claim is "never-issued-by-this-server" and "latest", and send each to /oidc/token with the same body. On v0.36.2 both are answered 200 with a token. The test change is in dpop-fix.patch beside this file (the handler_auth.rs hunk); run it against a backend started with just test-backend. Negative control: the same test with the fix applied answers 400 with a DPoP-Nonce header for both; with the old is_ok() restored and nothing else changed, it fails again on the forged nonce (200). Unit test test_dpop_nonce_accepts covers never issued, live, expired, latest and a failed lookup. Fix: is_valid accepts only Ok(Some(entry)) whose value equals the presented nonce and whose exp is in the future; Ok(None) and a lookup error are refused (the error is logged). get_latest issues a new nonce when fewer than 15 s remain. A client that echoes the DPoP-Nonce it was given is unaffected. The diff is the dpop_proof.rs hunk of dpop-fix.patch (inline below). Downstream note: I maintain a downstream patched build on the bartekus/rauthy fork (0.36.2-patched.N). Its next release, 0.36.2-patched.3, carries this fix and will be published after this report; its commit message and release notes describe the fix without exploit detail beyond what is here. I'm happy to open a pull request against main whenever and however you prefer. Patch (against v0.36.2; test hunk plus fix):

diff --git a/src/bin/tests/handler_auth.rs b/src/bin/tests/handler_auth.rs
index 4482161a..23d31dfb 100644
--- a/src/bin/tests/handler_auth.rs
+++ b/src/bin/tests/handler_auth.rs
@@ -645,6 +645,26 @@ async fn test_dpop() -> Result<(), Box<dyn Error>> {
         .unwrap();
     println!("nonce we should use: {}", nonce);
 
+    // A nonce the server never issued must be answered like a missing one. `latest` is the
+    // cache key under which the current nonce is also stored, and must not pass either.
+    for forged in ["never-issued-by-this-server", "latest"] {
+        claims.nonce = Some(forged.to_string());
+        let claims_json = serde_json::to_string(&claims).unwrap();
+        let claims_b64 = base64_url_no_pad_encode(claims_json.as_bytes());
+        let mut forged_token = format!("{}.{}", header_b64, claims_b64);
+        let sig = kp.sk.sign(&forged_token, Some(Noise::generate()));
+        write!(forged_token, ".{}", base64_url_no_pad_encode(sig.as_ref())).unwrap();
+
+        let res = client
+            .post(&url)
+            .header(TOKEN_DPOP, &forged_token)
+            .form(&body)
+            .send()
+            .await?;
+        assert_eq!(res.status(), 400, "nonce '{forged}' was accepted");
+        assert!(res.headers().get(HEADER_DPOP_NONCE).is_some());
+    }
+
     // insert the nonce and rebuild
     claims.nonce = Some(nonce.to_string());
 
diff --git a/src/data/src/entity/dpop_proof.rs b/src/data/src/entity/dpop_proof.rs
index d16f469a..66b9c293 100644
--- a/src/data/src/entity/dpop_proof.rs
+++ b/src/data/src/entity/dpop_proof.rs
@@ -10,7 +10,7 @@ use rauthy_common::utils::{base64_url_no_pad_decode, get_rand};
 use rauthy_error::{ErrorResponse, ErrorResponseType};
 use serde::{Deserialize, Serialize};
 use std::fmt::{Debug, Formatter};
-use std::ops::{Add, Sub};
+use std::ops::Add;
 use tracing::error;
 
 /// A DPoP nonce that only live inside the cache to limit client's DPoP lifetimes
@@ -52,9 +52,32 @@ impl DPoPNonce {
 
     /// Checks the validity of the given DPoP nonce value
     pub async fn is_valid(value: String) -> bool {
-        let slf: Result<Option<Self>, hiqlite::Error> =
-            DB::hql().get(Cache::DPoPNonce, value).await;
-        slf.is_ok()
+        let lookup: Result<Option<Self>, hiqlite::Error> =
+            DB::hql().get(Cache::DPoPNonce, value.as_str()).await;
+        Self::accepts(&value, lookup, Utc::now())
+    }
+
+    /// A nonce handed out must stay valid long enough for the client's retry.
+    fn expires_soon(exp: DateTime<Utc>, now: DateTime<Utc>) -> bool {
+        exp < now.add(chrono::Duration::seconds(15))
+    }
+
+    /// Only a nonce this cluster issued and that has not expired is valid. A lookup that finds
+    /// nothing, or fails, is not. The nonce must also be the entry's own value, because the
+    /// same cache holds a copy of the current nonce under the fixed key `latest`.
+    fn accepts(
+        value: &str,
+        lookup: Result<Option<Self>, hiqlite::Error>,
+        now: DateTime<Utc>,
+    ) -> bool {
+        match lookup {
+            Ok(Some(slf)) => slf.value == value && slf.exp > now,
+            Ok(None) => false,
+            Err(err) => {
+                error!(?err, "Cache lookup error during DPoP nonce validation");
+                false
+            }
+        }
     }
 
     /// Always returns the value of the latest valid DPoP nonce which is valid for at least
@@ -64,8 +87,7 @@ impl DPoPNonce {
         match slf {
             None => Self::new_value().await,
             Some(slf) => {
-                let now_minus_15 = Utc::now().sub(chrono::Duration::seconds(15));
-                if slf.exp < now_minus_15 {
+                if Self::expires_soon(slf.exp, Utc::now()) {
                     Self::new_value().await
                 } else {
                     Ok(slf.value)
@@ -465,4 +487,39 @@ mod tests {
         // jwk::test_signature_validation
         // -> no need to test it again here
     }
+
+    #[test]
+    fn test_dpop_nonce_accepts() {
+        use crate::entity::dpop_proof::DPoPNonce;
+        use chrono::Duration;
+        use std::borrow::Cow;
+
+        let now = Utc::now();
+        let issued = |value: &str, exp| {
+            Ok(Some(DPoPNonce {
+                exp,
+                value: value.to_string(),
+            }))
+        };
+        let later = now + Duration::seconds(60);
+
+        // issued and live
+        assert!(DPoPNonce::accepts("n1", issued("n1", later), now));
+        // never issued, or no longer in the cache (expired and evicted, or the cache was
+        // replaced): the lookup finds nothing
+        assert!(!DPoPNonce::accepts("forged", Ok(None), now));
+        // still in the cache but past its expiry
+        let earlier = now - Duration::seconds(1);
+        assert!(!DPoPNonce::accepts("n1", issued("n1", earlier), now));
+        assert!(!DPoPNonce::accepts("n1", issued("n1", now), now));
+        // the fixed key `latest` finds the current nonce, whose value is not `latest`
+        assert!(!DPoPNonce::accepts("latest", issued("n1", later), now));
+        // `get_latest` replaces a nonce with less than 15 s left
+        assert!(DPoPNonce::expires_soon(now + Duration::seconds(14), now));
+        assert!(!DPoPNonce::expires_soon(now + Duration::seconds(16), now));
+
+        // the cache could not be read
+        let err = hiqlite::Error::NodeFailed(Cow::Borrowed("test"));
+        assert!(!DPoPNonce::accepts("n1", Err(err), now));
+    }
 }

Source: NVD

Related Rust vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

GHSA-xm3f-jwj9-3x8mMEDIUM4.5
  • Rust logoRust
  • russh-config
NoYesNov 21, 2026
GHSA-m6v5-wqxv-mffhMEDIUM4.3
  • Rust logoRust
  • russh
NoYesNov 21, 2026
GHSA-66vf-xq4p-pg7qLOW3.7
  • Rust logoRust
  • russh
NoYesNov 21, 2026
GHSA-7qgr-cjxw-6vjfLOW3.1
  • Rust logoRust
  • russh
NoYesNov 21, 2026
GHSA-v3vc-7662-5hv7LOWN/A
  • Rust logoRust
  • russh
NoYesNov 21, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Additional Wiz resources

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management