Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
With private keys stored as environment variables, create a basic SSH interactive session with Fabric.
What would you do if a device on which you've stored your private ssh key files, is lost, stolen or damaged?
This small script allows a (basic, slow) ssh log-in shell session to be created using Fabric and Paramiko, from a private ssh key stored in an environment variable. Services such as Hashicorp Vault can run scripts such as this one, passing them secrets as environment variables. This makes saving copies of private key files (whether temporary or permanent) on a local disk unnecessary.
I do not claim this is best practise. Nor that it scales (vault services can be used to authenticate ssh certificates instead).
This script is only intended to be a simple mitigation to loss, theft and damage of physical devices.
Users able to rely on managed physical copies of ssh key files, do not need this library at all. For the rest of us, please note this not a hardened magic bullet to manage all your security issues. Produce your own security model. In particular this approach: a) delegates important security decisions to second and third parties, in no particular order: myself, my own infrastructure and dependency providers, and your chosen cloud vault service provider(s). This script is a trade off. It is intended to make you less vulnerable to all your offices burning down or devices being stolen. But as with moving anything from on-prem to the cloud, this is always at the cost of exposing you to others' vulnerabilities instead. b) the vault service(s) themselves must now be secured. By their very nature, credible providers have considered this at length, e.g. requiring password, and either a OTP or a recovery code (storing recovery codes on the devices instead of ssh key files, just shifts the problem to a different file, and adds only a little obscurity, not any extra security).
ssh_from_env
will look for a secret called SSH_KEY
by default).pipx install ssh_from_env
hcp vault-secrets run -- ssh_from_env user@host (env_var_name=SSH_KEY)
FAQs
With private keys stored as environment variables, create a basic SSH interactive session with Fabric.
We found that ssh-from-env demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.