Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/documentation/modules/post/windows/manage/sshkey_persistence.md
Views: 11789
This module will add an SSH key to a specified user (or all), to allow remote login on the victim via SSH at any time.
Creating A Testing Environment
This module has been tested against:
Windows 10, 1903
Verification Steps
Start msfconsole
Exploit a box via whatever method
Do:
use post/windows/manage/sshkey_persistence
Do:
set session #
Optional Do:
set USERNAME
Optional Do:
set SSHD_CONFIG
Do:
run
Options
SSHD_CONFIG
Location of the sshd_config file on the remote system. We use this to determine if the authorized_keys file location has changed on the system. If it hasn't, we default to .ssh/authorized_keys
USERNAME
If set, we only write our key to this user. If not, we'll write to all users
PUBKEY
A public key to use. If not provided, a pub/priv key pair is generated automatically
ADMIN_KEY_FILE
Location of public keys for Administrator level accounts
ADMIN
Add public keys for gaining access to Administrator level accounts
EDIT_CONFIG
Allow the module to edit the sshd_config to enable public key authentication
Scenarios
Get initial access
Use the post module to write the ssh key
Verify our access works