Skip to content
Leaked secrets Write-up Intermediate

Exploiting Unencrypted Private Keys And Misconfigured Ssh Settings To Breach Multiple Systems

After compromising one internet-facing machine, the author found an unencrypted SSH private key in a user's ~/.ssh directory. Using that key, they logged into other machines listed in the SSH configuration without any passphrase prompt, spreading access across several systems.

Aman Singh Gill Follow

Published on systemweakness.com

In this post, I’ll walk through how I was able to gain unauthorized access to multiple machines by exploiting unencrypted private keys and misconfigured SSH settings.

Aman Singh Gill, on systemweakness.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the private key was stored without a passphrase and the SSH configuration allowed key-based logins to many hosts, so one stolen key gave access to all of them.

Impact

An attacker who reached one machine could use the key to log in to and breach several other systems, and the text notes a weakly encrypted key could also be brute-forced.

What the attacker needed

Initial access to one machine; a user account with readable ~/.ssh files; target hosts trust that key

The fix

Private keys should be protected with a strong passphrase, SSH configurations hardened, keys centrally managed, 2FA enabled and systems audited regularly.

How it was found

  1. Gain initial access to an internet-facing machine (method not described).
  2. Review files in a user's ~/.ssh directory and find a private key used for logins to other systems.
  3. Try the key against a device listed in the SSH configuration file.
  4. Observe the connection succeeds with no passphrase prompt, confirming the key is unencrypted.
  5. Repeat the same method against other machines listed in the configuration to reach more devices.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

SSH is a way to log in to another computer remotely. Normally a private key file acts like a password, and it should be locked with its own passphrase so a stolen copy is useless. Here the key had no passphrase, so anyone who found the file could log in to every machine that trusted it.

What is Leaked secrets?

Keys, tokens or passwords left in public code, apps, logs or responses, that grant real access.

More by Aman Singh Gill

View all

8 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Leaked secrets and credentials

The lesson behind this report.

Keys, tokens or passwords left in public code, apps, logs or responses, that grant real access.