Skip to main content

SSH Agent Forwarding Hijack

If another user has SSH agent forwarding enabled, you can use their agent socket to authenticate as them to remote hosts.

Find Active Agent Sockets

Identify Socket Owner

Hijack Agent

If keys listed → you can use them:

Automate Discovery


Writable SSH Config

/etc/ssh/sshd_config

If writable — enable root login:
Reload:

~/.ssh/authorized_keys

If writable for another user:
Add your key:

~/.ssh/config

If writable — inject ProxyCommand:
Triggers on next SSH connection by that user.

Debian Weak Keys (CVE-2008-0166)

Debian OpenSSL bug generated only 32,768 possible keys.

Check

Exploit

Download pre-generated keys:
Try each key against target:

SSH Private Keys on Disk

Find Keys

Check Permissions (Readable?)

Use Found Key

Crack Passphrase

If key is encrypted:

SSH Persistence

Add Key to Root

Generate Key Pair on Target


Quick Reference