Skip to content

🛡️ Sentinel: [HIGH] Fix MITM vulnerability in ssh2 backend#505

Merged
adolago merged 1 commit intomainfrom
sentinel/fix-ssh2-mitm-4155186710690112462
Feb 11, 2026
Merged

🛡️ Sentinel: [HIGH] Fix MITM vulnerability in ssh2 backend#505
adolago merged 1 commit intomainfrom
sentinel/fix-ssh2-mitm-4155186710690112462

Conversation

@adolago
Copy link
Owner

@adolago adolago commented Feb 10, 2026

🚨 Severity: HIGH
💡 Vulnerability: The ssh2 backend (used when ssh2-backend feature is enabled) did not perform host key verification during connection establishment. It called session.handshake() but failed to check the server's host key against known_hosts, allowing any server to be accepted and exposing the connection to Man-in-the-Middle (MITM) attacks.
🎯 Impact: Attackers could intercept SSH connections, potentially stealing credentials or executing malicious commands on the control node or remote hosts if the user enabled the ssh2-backend feature (legacy/alternative to the default russh backend).
🔧 Fix: Implemented verify_host_key in src/connection/ssh.rs. This function loads ~/.ssh/known_hosts (or the configured UserKnownHostsFile), retrieves the server's host key, and verifies it using ssh2::KnownHosts. It respects StrictHostKeyChecking configuration: if strict checking is disabled (default for this tool's config in some contexts, but false in code), it adds new keys to memory (and tries to append to file); if enabled, it rejects unknown hosts. Mismatched keys are always rejected as a security error.
✅ Verification: Verified that the code compiles with cargo check --lib --features ssh2-backend. Confirmed via code inspection that session.host_key() is now checked against known_hosts before authentication proceeds.


PR created automatically by Jules for task 4155186710690112462 started by @dolagoartur

- Implemented host key verification in `SshConnection` (`src/connection/ssh.rs`).
- Loads `known_hosts` and checks server key after handshake.
- Respects `StrictHostKeyChecking` configuration.
- Aborts connection on key mismatch.

Co-authored-by: dolagoartur <146357947+dolagoartur@users.noreply.github.com>
@google-labs-jules
Copy link
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f3a465b484

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@adolago adolago merged commit 6ba7a41 into main Feb 11, 2026
20 of 23 checks passed
@adolago adolago deleted the sentinel/fix-ssh2-mitm-4155186710690112462 branch February 11, 2026 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant