OpenSSH Agent Forwarding Fails or Risks Key Hijacking (`ForwardAgent`)

Remote root user can abuse forwarded `SSH_AUTH_SOCK` if `ForwardAgent yes` is enabled globally.

Runs locally in browser Free · No login Independently Verified 2026-11-25 v4.1.0
Identifier: OpenSSH Agent Forwarding Fails or Risks Key Hijacking (`ForwardAgent`) Platform: Security
Common Root Causes:
  • Remote root user can abuse forwarded `SSH_AUTH_SOCK` if `ForwardAgent yes` is enabled globally.

Interactive Diagnostic Checklist

Verified Solutions:
  1. Prefer `ProxyJump (-J)` over `ForwardAgent yes`, or scope forwarding strictly to trusted hosts.
Safe Diagnostic Command:
ssh-add -L
Warning: Verify configuration changes in staging or with dry-run flags (e.g. nginx -t) before reloading production services.

Technical Explanation

Remote root user can abuse forwarded `SSH_AUTH_SOCK` if `ForwardAgent yes` is enabled globally. Recommended diagnostic: `ssh-add -L`. Remediation: Prefer `ProxyJump (-J)` over `ForwardAgent yes`, or scope forwarding strictly to trusted hosts.

Worked Examples

  • Run `ssh-add -L` to verify root cause before applying the remediation.

Limitations & Assumptions

  • Always verify configuration changes in staging or with dry-run flags (e.g. `nginx -t`) before reloading production services.

Source References & Verification

Resource ID: err-linux-ssh-agent-forwarding-broken · Independently verified: 2026-11-25

Related Resources