GHSA-vp5q-ff62-jwqv CVE-2026-116794
russh: Agent server never calls `Agent::confirm`, so keys added with the confirm constraint (`ssh-add -c`) sign without confirmation
- Severity
- 8.3 / 10
- High · CVSS 4.0
- Exploit chance (EPSS)
- 0.16%
- Chance of exploitation in the next 30 days. Higher than 4.73% of scored vulnerabilities.
- Known exploited
- No
- Not in CISA's catalog
- Weakness
- CWE-862 Missing Authorization
- Fix
0.65- Upgrade russh to this version or later
Description
Summary
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.
The call was replaced by a hard-coded true in 3e04597 ("Native async traits encore", #455), first released in 0.50.0-beta.12. Every release since, up to and including 0.64.1, signs requests for confirm-constrained keys without asking the Agent implementation. A user who added a key with -c is therefore never asked to confirm.
Details
Connection::try_sign notes that the key needs confirmation, then awaits a ready future instead of the agent (server.rs L348-L360 at v0.64.1):
let agent = if needs_confirm {
let (agent, ok) = {
let _pk = key.clone();
Box::new(futures::future::ready((agent, true)))
}
.await;
if !ok {
return Ok((agent, false));
}
agent
} else {
agent
};
Before 3e04597 the first statement was let (agent, ok) = agent.confirm(key.clone()).await;.
try_sign was checked in the published crates on crates.io:
- Every russh release from 0.50.0-beta.12 to 0.64.1 (52 versions) has the hard-coded
true. - russh 0.50.0-beta.8 to beta.11 call
agent.confirm. - Earlier russh releases have no agent server. It lived in russh-keys, and no russh-keys release is affected.
Not affected:
Agentimplementations that keep the defaultconfirm, which returnstrueanyway.- Checks made in
Agent::confirm_request, which is still called withMessageType::Signfor every sign request (L158-L159). - The agent client, and the SSH client and server.
PoC
- Add this test to
mod testinrussh/src/keys/mod.rs. It uses the module's existingIncominghelper andED25519_KEY. - Run
cargo test -p russh --lib keys::test::test_agent_confirms_keys_added_with_the_confirm_constraint.
#[tokio::test]
#[cfg(unix)]
async fn test_agent_confirms_keys_added_with_the_confirm_constraint() {
use std::sync::atomic::{AtomicUsize, Ordering};
// An agent whose user refuses every confirmation prompt.
#[derive(Clone)]
struct Refuse(std::sync::Arc<AtomicUsize>);
impl agent::server::Agent for Refuse {
fn confirm(
self,
_: std::sync::Arc<PrivateKey>,
) -> Box<dyn Future<Output = (Self, bool)> + Send + Unpin> {
self.0.fetch_add(1, Ordering::SeqCst);
Box::new(futures::future::ready((self, false)))
}
}
let prompts = std::sync::Arc::new(AtomicUsize::new(0));
let dir = tempfile::tempdir().unwrap();
let agent_path = dir.path().join("agent");
let mut listener = tokio::net::UnixListener::bind(&agent_path).unwrap();
let agent = Refuse(prompts.clone());
tokio::spawn(async move {
agent::server::serve(
Incoming {
listener: &mut listener,
},
agent,
)
.await
});
let key = decode_secret_key(ED25519_KEY, Some("blabla")).unwrap();
let public = key.public_key().clone();
let stream = tokio::net::UnixStream::connect(&agent_path).await.unwrap();
let mut client = agent::client::AgentClient::connect(stream);
// What `ssh-add -c` sends.
client
.add_identity(&key, &[agent::Constraint::Confirm])
.await
.unwrap();
let signed = client
.sign_request(&AgentIdentity::from(public), None, b"data".to_vec())
.await;
let confirm_calls = prompts.load(Ordering::SeqCst);
assert!(
signed.is_err(),
"the agent signed with a confirm-constrained key without asking: \
Agent::confirm was called {confirm_calls} time(s)"
);
assert_eq!(
confirm_calls, 1,
"Agent::confirm should be asked exactly once"
);
}
On v0.64.1 (e5d80a0) the test fails:
the agent signed with a confirm-constrained key without asking: Agent::confirm was called 0 time(s)
With the fix below it passes, and so do all 46 keys:: tests.
Impact
A russh-based agent whose Agent::confirm asks the user, or applies any other check, signs every request for a confirm-constrained key without running that check. Anyone who can talk to the agent can then use the key without the user's approval:
- other local processes of the user;
- the remote host, when the agent is forwarded (
ssh -A).
Preventing exactly this is the purpose of the confirm constraint. RFC 9987 §10 names it as what stops an attacker with access to the agent from "stealing use of those keys".
Because the agent accepts the constraint, ssh-add -c reports success and the user believes the key is protected. RFC 9987 §5.2.7 says an agent that does not support a constraint MUST refuse the key instead.
The private key itself is not exposed. The impact is unauthorized use of it for as long as the attacker can reach the agent: logging in to other hosts as the user, or signing data such as git commits.
Known affected downstream user (from its public code; not tested): Proton Pass desktop, which uses russh 0.62.7.
- It adds every key with
Constraint::Confirm(mod.rs L332). - It uses
Agent::confirmas its "Pass is unlocked" check before signing, and defersMessageType::Signfromconfirm_requestto it (L75-L100). That check never runs. - Proton also removes keys from the agent on lock and logout (ssh-agent.middleware.ts L23-L27).
So the exposure there is limited to states in which keys stay loaded while Pass is not unlocked. Their own code notes, for example, that the agent persists across renderer reloads and account switches.
Suggested fix
--- a/russh/src/keys/agent/server.rs
+++ b/russh/src/keys/agent/server.rs
@@ -346,11 +346,7 @@ impl<S: AsyncRead + AsyncWrite + Send + Unpin + 'static, A: Agent + Send + Sync
}
};
let agent = if needs_confirm {
- let (agent, ok) = {
- let _pk = key.clone();
- Box::new(futures::future::ready((agent, true)))
- }
- .await;
+ let (agent, ok) = agent.confirm(key.clone()).await;
if !ok {
return Ok((agent, false));
}
When confirm returns false, try_sign returns false and the agent answers SSH_AGENT_FAILURE, as it did before the regression.
Compatibility note for the release notes: confirm is called again for confirm-constrained keys, so implementations that stub it out will now hit that stub.
- For example, Litterbox implements
confirmastodo!()(agent.rs L81-L87). - Each connection runs in its own task, so such a panic ends only that connection.
Related but separate: with the default confirm, the agent still accepts the confirm constraint without enforcing it. Given RFC 9987 §5.2.7, refusing such keys when the application does not implement confirm may be worth considering.
Affected versions
crates.io
| Package | Vulnerable | Fixed in |
|---|---|---|
| russh | < 0.65 |
0.65 |
How to fix
Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.
russh crates.io → 0.65
- cargo
cargo update -p russh --precise 0.65
Severity breakdown
CVSS 4.0 8.3
CVSS:4.0/AV:L/AC:L/AT:N/PR:L/UI:N/VC:N/VI:H/VA:N/SC:H/SI:H/SA:N
- Attack vector
- Local
- Attack complexity
- Low
- Attack requirements
- None
- Privileges required
- Low
- User interaction
- None
- Confidentiality (vulnerable system)
- None
- Integrity (vulnerable system)
- High
- Availability (vulnerable system)
- None
- Confidentiality (subsequent systems)
- High
- Integrity (subsequent systems)
- High
- Availability (subsequent systems)
- None
Weakness
CWE-862: Missing Authorization
The product does not perform an authorization check when an actor attempts to access a resource or perform an action.
How to prevent it
- Architecture and Design: Divide the product into anonymous, normal, privileged, and administrative areas. Reduce the attack surface by carefully mapping roles with data and functionality. Use role-based access control (RBAC) [REF-229] to enforce the roles at the appropriate boundaries. Note that this approach may not protect against horizontal authorization, i.e., it will not protect a user from attacking others with the same role.
- Architecture and Design: Ensure that access control checks are performed related to the business logic. These checks may be different than the access control checks that are applied to more generic resources such as files, connections, processes, memory, and database records. For example, a database may restrict access for medical records to a specific database user, but each record might only be intended to be accessible to the patient and the patient's doctor [REF-7].
- Architecture and Design: Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid. For example, consider using authorization frameworks such as the JAAS Authorization Framework [REF-233] and the OWASP ESAPI Access Control feature [REF-45].
- Architecture and Design: For web applications, make sure that the access control mechanism is enforced correctly at the server side on every page. Users should not be able to access any unauthorized functionality or information by simply requesting direct access to that page. One way to do this is to ensure that all pages containing sensitive information are not cached, and that all such pages restrict access to requests that are accompanied by an active and authenticated session token associated with a user who has the required permissions to access that page.
- System Configuration, Installation: Use the access control capabilities of your operating system and server environment and define your access control lists accordingly. Use a "default deny" policy when defining these ACLs.
References
Advisories
Fixes and patches
Packages
Other links
Timeline
- Published
- Last updated by the source
- Latest EPSS score
Related advisories
| Advisory | Severity | Why it's related |
|---|---|---|
| GHSA-fw5c-8223-6h42 russh: peer-declared zero maximum packet size permanently stalls channel writes (silent AsyncWrite hang) | Medium | Also affects russh |
| GHSA-9wfm-jcj8-jfv9 russh's SSH agent server is susceptible to unbound allocations via repeated SSH_AGENT_CONSTRAIN_CONFIRM messages | Low | Also affects russh |
| GHSA-4p9f-7p9m-5vfg russh's SSH client is susceptible to unbounded allocations via EXT_INFO packets | Medium | Also affects russh |
| GHSA-4wc5-f2rc-q74m russh: Unbounded memory allocation in agent protocol server via crafted constraint records | Medium | Also affects russh |
| GHSA-j7h2-66j4-ghjf A russh SSH server accepts a publickey authentication whose signature uses a different algorithm than the one named in the request | Low | Also affects russh |
| GHSA-g6xm-f9xp-qq35 Russh: Configured server auth-attempt cap is not enforced in the USERAUTH_REQUEST runtime path | Low | Also affects russh |
| GHSA-w3jg-pjxf-73p4 Russh: Missing X25519 zero-point validation in hybrid ML-KEM key exchange | Medium | Also affects russh |
| GHSA-47hw-gvq5-r2gm russh: Client-side channel-scoped Handler callbacks fire for channel IDs the client never opened | High | Also affects russh |
Credits: cataggar
MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.
Check your repos with MergeHarbor