# 22 - Pentesting SSH/SFTP
{% hint style="success" %}
Learn & practice AWS Hacking:[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)\
Learn & practice GCP Hacking: [**HackTricks Training GCP Red Team Expert (GRTE)**](https://training.hacktricks.xyz/courses/grte)
Support HackTricks
* Check the [**subscription plans**](https://github.com/sponsors/carlospolop)!
* **Join the** π¬ [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** π¦ [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.**
* **Share hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
{% endhint %}
**Bug bounty tip**: **sign up** for **Intigriti**, a premium **bug bounty platform created by hackers, for hackers**! Join us at [**https://go.intigriti.com/hacktricks**](https://go.intigriti.com/hacktricks) today, and start earning bounties up to **$100,000**!
{% embed url="https://go.intigriti.com/hacktricks" %}
## κΈ°λ³Έ μ 보
**SSH (Secure Shell λλ Secure Socket Shell)**μ 보μλμ§ μμ λ€νΈμν¬λ₯Ό ν΅ν΄ μ»΄ν¨ν°μ λν μμ ν μ°κ²°μ κ°λ₯νκ² νλ λ€νΈμν¬ νλ‘ν μ½μ
λλ€. μ격 μμ€ν
μ μ κ·Όν λ λ°μ΄ν°μ κΈ°λ°μ±κ³Ό 무결μ±μ μ μ§νλ λ° νμμ μ
λλ€.
**κΈ°λ³Έ ν¬νΈ:** 22
```
22/tcp open ssh syn-ack
```
**SSH μλ²:**
* [openSSH](http://www.openssh.org) β OpenBSD SSH, BSD, Linux λ°°ν¬ν λ° Windows 10λΆν° Windowsμ νμ¬λ¨
* [Dropbear](https://matt.ucc.asn.au/dropbear/dropbear.html) β λ©λͺ¨λ¦¬μ νλ‘μΈμ μμμ΄ μ μ νκ²½μ μν SSH ꡬν, OpenWrtμ νμ¬λ¨
* [PuTTY](https://www.chiark.greenend.org.uk/\~sgtatham/putty/) β Windowsμ© SSH ꡬν, ν΄λΌμ΄μΈνΈλ μΌλ°μ μΌλ‘ μ¬μ©λμ§λ§ μλ²μ μ¬μ©μ λλ¬Όλ€
* [CopSSH](https://www.itefix.net/copssh) β Windowsμ© OpenSSH ꡬν
**SSH λΌμ΄λΈλ¬λ¦¬ (μλ² μΈ‘ ꡬν):**
* [libssh](https://www.libssh.org) β SSHv2 νλ‘ν μ½μ ꡬννλ λ€μ€ νλ«νΌ C λΌμ΄λΈλ¬λ¦¬, [Python](https://github.com/ParallelSSH/ssh-python), [Perl](https://github.com/garnier-quentin/perl-libssh/) λ° [R](https://github.com/ropensci/ssh)μμ λ°μΈλ©λ¨; KDEμ sftpμ GitHubμ git SSH μΈνλΌμμ μ¬μ©λ¨
* [wolfSSH](https://www.wolfssl.com/products/wolfssh/) β ANSI Cλ‘ μμ±λ SSHv2 μλ² λΌμ΄λΈλ¬λ¦¬, μλ² λλ, RTOS λ° μμμ΄ μ νλ νκ²½μ λͺ©νλ‘ ν¨
* [Apache MINA SSHD](https://mina.apache.org/sshd-project/index.html) β Apache SSHD μλ° λΌμ΄λΈλ¬λ¦¬λ Apache MINAλ₯Ό κΈ°λ°μΌλ‘ ν¨
* [paramiko](https://github.com/paramiko/paramiko) β Python SSHv2 νλ‘ν μ½ λΌμ΄λΈλ¬λ¦¬
## μ΄κ±°
### λ°°λ μμ§
```bash
nc -vn 22
```
### μλνλ ssh-audit
ssh-auditλ ssh μλ² λ° ν΄λΌμ΄μΈνΈ κ΅¬μ± κ°μ¬λ₯Ό μν λꡬμ
λλ€.
[https://github.com/jtesta/ssh-audit](https://github.com/jtesta/ssh-audit)λ [https://github.com/arthepsy/ssh-audit/](https://github.com/arthepsy/ssh-audit/)μ μ
λ°μ΄νΈλ ν¬ν¬μ
λλ€.
**κΈ°λ₯:**
* SSH1 λ° SSH2 νλ‘ν μ½ μλ² μ§μ;
* SSH ν΄λΌμ΄μΈνΈ κ΅¬μ± λΆμ;
* λ°°λ κ°μ Έμ€κΈ°, μ₯μΉ λλ μννΈμ¨μ΄ λ° μ΄μ 체μ μΈμ, μμΆ κ°μ§;
* ν€ κ΅ν, νΈμ€νΈ ν€, μνΈν λ° λ©μμ§ μΈμ¦ μ½λ μκ³ λ¦¬μ¦ μμ§;
* μκ³ λ¦¬μ¦ μ 보 μΆλ ₯ (μ¬μ© κ°λ₯ μμ , μ κ±°/λΉνμ±ν, μμ νμ§ μμ/μ½ν¨/ꡬμ λ±);
* μκ³ λ¦¬μ¦ κΆμ₯ μ¬ν μΆλ ₯ (μΈμλ μννΈμ¨μ΄ λ²μ μ λ°λΌ μΆκ° λλ μ κ±°);
* 보μ μ 보 μΆλ ₯ (κ΄λ ¨ λ¬Έμ , ν λΉλ CVE λͺ©λ‘ λ±);
* μκ³ λ¦¬μ¦ μ 보λ₯Ό κΈ°λ°μΌλ‘ SSH λ²μ νΈνμ± λΆμ;
* OpenSSH, Dropbear SSH λ° libsshμ μμ¬μ μ 보;
* Linux λ° Windowsμμ μ€ν;
* μμ‘΄μ± μμ
```bash
usage: ssh-audit.py [-1246pbcnjvlt]
-1, --ssh1 force ssh version 1 only
-2, --ssh2 force ssh version 2 only
-4, --ipv4 enable IPv4 (order of precedence)
-6, --ipv6 enable IPv6 (order of precedence)
-p, --port= port to connect
-b, --batch batch output
-c, --client-audit starts a server on port 2222 to audit client
software config (use -p to change port;
use -t to change timeout)
-n, --no-colors disable colors
-j, --json JSON output
-v, --verbose verbose output
-l, --level= minimum output level (info|warn|fail)
-t, --timeout= timeout (in seconds) for connection and reading
(default: 5)
$ python3 ssh-audit
```
[See it in action (Asciinema)](https://asciinema.org/a/96ejZKxpbuupTK9j7h8BdClzp)
### μλ²μ κ³΅κ° SSH ν€
```bash
ssh-keyscan -t rsa -p
```
### μ½ν μνΈ μκ³ λ¦¬μ¦
μ΄λ κΈ°λ³Έμ μΌλ‘ **nmap**μ μν΄ λ°κ²¬λ©λλ€. κ·Έλ¬λ **sslcan** λλ **sslyze**λ₯Ό μ¬μ©ν μλ μμ΅λλ€.
### Nmap μ€ν¬λ¦½νΈ
```bash
nmap -p22 -sC # Send default nmap scripts for SSH
nmap -p22 -sV # Retrieve version
nmap -p22 --script ssh2-enum-algos # Retrieve supported algorythms
nmap -p22 --script ssh-hostkey --script-args ssh_hostkey=full # Retrieve weak keys
nmap -p22 --script ssh-auth-methods --script-args="ssh.user=root" # Check authentication methods
```
### Shodan
* `ssh`
## μ¬μ©μ μ΄λ¦, λΉλ°λ²νΈ λ° κ°μΈ ν€μ λν λ¬΄μ°¨λ³ λμ
곡격
### μ¬μ©μ μ΄λ¦ μ΄κ±°
μΌλΆ OpenSSH λ²μ μμλ νμ΄λ° 곡격μ ν΅ν΄ μ¬μ©μλ₯Ό μ΄κ±°ν μ μμ΅λλ€. μ΄λ₯Ό μ΄μ©νκΈ° μν΄ λ©νμ€νλ‘μ λͺ¨λμ μ¬μ©ν μ μμ΅λλ€:
```
msf> use scanner/ssh/ssh_enumusers
```
### [Brute force](../generic-methodologies-and-resources/brute-force.md#ssh)
μΌλΆ μΌλ°μ μΈ ssh μ격 μ¦λͺ
[μ¬κΈ°](https://github.com/danielmiessler/SecLists/blob/master/Passwords/Default-Credentials/ssh-betterdefaultpasslist.txt)μ [μ¬κΈ°](https://github.com/danielmiessler/SecLists/blob/master/Passwords/Common-Credentials/top-20-common-SSH-passwords.txt) λ° μλμ μμ΅λλ€.
### κ°μΈ ν€ λΈλ£¨νΈ ν¬μ€
μ¬μ©ν μ μλ ssh κ°μΈ ν€λ₯Ό μκ³ μλ€λ©΄... μλν΄ λ³΄κ² μ΅λλ€. nmap μ€ν¬λ¦½νΈλ₯Ό μ¬μ©ν μ μμ΅λλ€:
```
https://nmap.org/nsedoc/scripts/ssh-publickey-acceptance.html
```
λλ MSF 보쑰 λͺ¨λ:
```
msf> use scanner/ssh/ssh_identify_pubkeys
```
Or use `ssh-keybrute.py` (native python3, lightweight and has legacy algorithms enabled): [snowdroppe/ssh-keybrute](https://github.com/snowdroppe/ssh-keybrute).
#### Known badkeys can be found here:
{% embed url="https://github.com/rapid7/ssh-badkeys/tree/master/authorized" %}
#### Weak SSH keys / Debian predictable PRNG
μΌλΆ μμ€ν
μ μνΈν μλ£λ₯Ό μμ±νλ λ° μ¬μ©λλ λλ€ μλμ μλ €μ§ κ²°ν¨μ΄ μμ΅λλ€. μ΄λ‘ μΈν΄ ν€ κ³΅κ°μ΄ κ·Ήμ μΌλ‘ μ€μ΄λ€μ΄ λ¬΄μ°¨λ³ λμ
곡격μ λ°μ μ μμ΅λλ€. μ½ν PRNGμ μν₯μ λ°λ Debian μμ€ν
μμ μμ±λ 미리 μμ±λ ν€ μΈνΈλ μ¬κΈ°μμ μ¬μ©ν μ μμ΅λλ€: [g0tmi1k/debian-ssh](https://github.com/g0tmi1k/debian-ssh).
νΌν΄μ λ¨Έμ μ μ ν¨ν ν€λ₯Ό κ²μνκΈ° μν΄ μ¬κΈ°λ₯Ό νμΈν΄μΌ ν©λλ€.
### Kerberos
**crackmapexec**λ `ssh` νλ‘ν μ½μ μ¬μ©νμ¬ **kerberosλ₯Ό ν΅ν΄ μΈμ¦**ν μ μλ `--kerberos` μ΅μ
μ μ¬μ©ν μ μμ΅λλ€.\
μμΈν μ 보λ `crackmapexec ssh --help`λ₯Ό μ€ννμμμ€.
## Default Credentials
| **Vendor** | **Usernames** | **Passwords** |
| ---------- | ----------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| APC | apc, device | apc |
| Brocade | admin | admin123, password, brocade, fibranne |
| Cisco | admin, cisco, enable, hsa, pix, pnadmin, ripeop, root, shelladmin | admin, Admin123, default, password, secur4u, cisco, Cisco, \_Cisco, cisco123, C1sco!23, Cisco123, Cisco1234, TANDBERG, change\_it, 12345, ipics, pnadmin, diamond, hsadb, c, cc, attack, blender, changeme |
| Citrix | root, nsroot, nsmaint, vdiadmin, kvm, cli, admin | C1trix321, nsroot, nsmaint, kaviza, kaviza123, freebsd, public, rootadmin, wanscaler |
| D-Link | admin, user | private, admin, user |
| Dell | root, user1, admin, vkernel, cli | calvin, 123456, password, vkernel, Stor@ge!, admin |
| EMC | admin, root, sysadmin | EMCPMAdm7n, Password#1, Password123#, sysadmin, changeme, emc |
| HP/3Com | admin, root, vcx, app, spvar, manage, hpsupport, opc\_op | admin, password, hpinvent, iMC123, pvadmin, passw0rd, besgroup, vcx, nice, access, config, 3V@rpar, 3V#rpar, procurve, badg3r5, OpC\_op, !manage, !admin |
| Huawei | admin, root | 123456, admin, root, Admin123, Admin@storage, Huawei12#$, HwDec@01, hwosta2.0, HuaWei123, fsp200@HW, huawei123 |
| IBM | USERID, admin, manager, mqm, db2inst1, db2fenc1, dausr1, db2admin, iadmin, system, device, ufmcli, customer | PASSW0RD, passw0rd, admin, password, Passw8rd, iadmin, apc, 123456, cust0mer |
| Juniper | netscreen | netscreen |
| NetApp | admin | netapp123 |
| Oracle | root, oracle, oravis, applvis, ilom-admin, ilom-operator, nm2user | changeme, ilom-admin, ilom-operator, welcome1, oracle |
| VMware | vi-admin, root, hqadmin, vmware, admin | vmware, vmw@re, hqadmin, default |
## SSH-MitM
νΌν΄μκ° μ¬μ©μ μ΄λ¦κ³Ό λΉλ°λ²νΈλ₯Ό μ¬μ©νμ¬ SSH μλ²μ μ°κ²°νλ €κ³ νλ λ‘컬 λ€νΈμν¬μ μλ κ²½μ°, **MitM 곡격μ μννμ¬ ν΄λΉ μ격 μ¦λͺ
μ νμΉ μ μμ΅λλ€:**
**곡격 κ²½λ‘:**
* **νΈλν½ λ¦¬λλ μ
:** 곡격μλ νΌν΄μμ νΈλν½μ μμ μ λ¨Έμ μΌλ‘ **μ ν**νμ¬ SSH μλ²μ λν μ°κ²° μλλ₯Ό **κ°λ‘μ±λλ€**.
* **κ°λ‘μ±κΈ° λ° λ‘κΉ
:** 곡격μμ λ¨Έμ μ **νλ‘μ** μν μ νμ¬ ν©λ²μ μΈ SSH μλ²μΈ μ² νλ©΄μ μ¬μ©μμ λ‘κ·ΈμΈ μΈλΆ μ 보λ₯Ό **μΊ‘μ²**ν©λλ€.
* **λͺ
λ Ή μ€ν λ° μ€κ³:** λ§μ§λ§μΌλ‘, 곡격μμ μλ²λ **μ¬μ©μμ μ격 μ¦λͺ
μ κΈ°λ‘νκ³ **, **λͺ
λ Ήμ** μ€μ SSH μλ²λ‘ **μ λ¬νλ©°**, **μ€ν**νκ³ , **κ²°κ³Όλ₯Ό μ¬μ©μμκ² λ€μ μ μ‘**νμ¬ νλ‘μΈμ€κ° 맀λλ½κ³ ν©λ²μ μΌλ‘ 보μ΄κ² λ§λλλ€.
[**SSH MITM**](https://github.com/jtesta/ssh-mitm)μ μμμ μ€λͺ
ν λλ‘ μ νν μνν©λλ€.
μ€μ MitMμ μννκΈ° μν΄ ARP μ€νΈν, DNS μ€νΈν λλ [**λ€νΈμν¬ μ€νΈν 곡격**](../generic-methodologies-and-resources/pentesting-network/#spoofing)μμ μ€λͺ
λ λ€λ₯Έ κΈ°μ μ μ¬μ©ν μ μμ΅λλ€.
## SSH-Snake
λ°κ²¬λ SSH κ°μΈ ν€λ₯Ό μ¬μ©νμ¬ μμ€ν
μμ λ€νΈμν¬λ₯Ό νμνκ³ κ° μμ€ν
μ κ° κ°μΈ ν€λ₯Ό μλ‘μ΄ νΈμ€νΈμ νμ©νλ €λ©΄ [**SSH-Snake**](https://github.com/MegaManSec/SSH-Snake)κ° νμν©λλ€.
SSH-Snakeλ λ€μ μμ
μ μλμΌλ‘ μ¬κ·μ μΌλ‘ μνν©λλ€:
1. νμ¬ μμ€ν
μμ λͺ¨λ SSH κ°μΈ ν€λ₯Ό μ°Ύμ΅λλ€,
2. νμ¬ μμ€ν
μμ κ°μΈ ν€κ° μλ½λ μ μλ λͺ¨λ νΈμ€νΈ λλ λͺ©μ μ§(user@host)λ₯Ό μ°Ύμ΅λλ€,
3. λ°κ²¬λ λͺ¨λ κ°μΈ ν€λ₯Ό μ¬μ©νμ¬ λͺ¨λ λͺ©μ μ§μ SSH μ°κ²°μ μλν©λλ€,
4. λͺ©μ μ§μ μ±κ³΅μ μΌλ‘ μ°κ²°λλ©΄ μ°κ²°λ μμ€ν
μμ #1 - #4 λ¨κ³λ₯Ό λ°λ³΅ν©λλ€.
μμ ν μκΈ° 볡μ λ° μκΈ° μ νκ° κ°λ₯νλ©°, μμ ν νμΌμ΄ μμ΅λλ€.
## Config Misconfigurations
### Root login
SSH μλ²κ° κΈ°λ³Έμ μΌλ‘ λ£¨νΈ μ¬μ©μ λ‘κ·ΈμΈμ νμ©νλ κ²μ μΌλ°μ μ΄λ©°, μ΄λ μλΉν 보μ μνμ μ΄λν©λλ€. **λ£¨νΈ λ‘κ·ΈμΈμ λΉνμ±ννλ κ²**μ μλ² λ³΄μμ κ°ννλ μ€μν λ¨κ³μ
λλ€. κ΄λ¦¬ κΆνμΌλ‘μ λ¬΄λ¨ μ κ·Ό λ° λ¬΄μ°¨λ³ λμ
곡격μ μνν μ μμ΅λλ€.
**OpenSSHμμ λ£¨νΈ λ‘κ·ΈμΈ λΉνμ±ννκΈ°:**
1. `sudoedit /etc/ssh/sshd_config`λ‘ SSH κ΅¬μ± νμΌμ **νΈμ§ν©λλ€**.
2. `#PermitRootLogin yes`μμ **`PermitRootLogin no`**λ‘ **μ€μ μ λ³κ²½ν©λλ€**.
3. `sudo systemctl daemon-reload`λ₯Ό μ¬μ©νμ¬ **ꡬμ±μ λ€μ λ‘λν©λλ€**.
4. λ³κ²½ μ¬νμ μ μ©νκΈ° μν΄ SSH μλ²λ₯Ό **μ¬μμν©λλ€**: `sudo systemctl restart sshd`
### SFTP Brute Force
* [**SFTP Brute Force**](../generic-methodologies-and-resources/brute-force.md#sftp)
### SFTP command execution
SFTP μ€μ μμ μΌλ°μ μΈ κ°κ³Όκ° λ°μνλλ°, κ΄λ¦¬μκ° μ¬μ©μκ° μ격 μ
Έ μ κ·Όμ νμ±ννμ§ μκ³ νμΌμ κ΅ννλλ‘ μλνλ κ²½μ°μ
λλ€. λΉλνν μ
Έ(μ: `/usr/bin/nologin`)λ‘ μ¬μ©μλ₯Ό μ€μ νκ³ νΉμ λλ ν 리μ μ ννλλΌλ 보μ νμ μ΄ λ¨μ μμ΅λλ€. **μ¬μ©μλ λ‘κ·ΈμΈ μ§ν λΉλνν μ
Έμ΄ μ°¨μ§νκΈ° μ μ λͺ
λ Ή μ€νμ μμ²νμ¬ μ΄λ¬ν μ νμ μ°νν μ μμ΅λλ€**(μ: `/bin/bash`). μ΄λ λ¬΄λ¨ λͺ
λ Ή μ€νμ νμ©νμ¬ μλλ 보μ μ‘°μΉλ₯Ό μ½νμν΅λλ€.
[μ¬κΈ°μμμ μμ](https://community.turgensec.com/ssh-hacking-guide/):
```bash
ssh -v noraj@192.168.1.94 id
...
Password:
debug1: Authentication succeeded (keyboard-interactive).
Authenticated to 192.168.1.94 ([192.168.1.94]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: pledge: network
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug1: Sending command: id
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0
uid=1000(noraj) gid=100(users) groups=100(users)
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 2412, received 2480 bytes, in 0.1 seconds
Bytes per second: sent 43133.4, received 44349.5
debug1: Exit status 0
$ ssh noraj@192.168.1.94 /bin/bash
```
μ¬κΈ° μ¬μ©μ `noraj`λ₯Ό μν μμ ν SFTP ꡬμ±μ μκ° μμ΅λλ€ (`/etc/ssh/sshd_config` β openSSH):
```
Match User noraj
ChrootDirectory %h
ForceCommand internal-sftp
AllowTcpForwarding no
PermitTunnel no
X11Forwarding no
PermitTTY no
```
μ΄ κ΅¬μ±μ SFTPλ§ νμ©ν©λλ€: μμ λͺ
λ Ήμ κ°μ νμ¬ μ
Έ μ‘μΈμ€λ₯Ό λΉνμ±ννκ³ TTY μ‘μΈμ€λ₯Ό λΉνμ±ννλ©° λͺ¨λ μ’
λ₯μ ν¬νΈ ν¬μλ© λλ ν°λλ§μ λΉνμ±νν©λλ€.
### SFTP ν°λλ§
SFTP μλ²μ μ‘μΈμ€ν μ μλ κ²½μ°, μΌλ°μ μΈ ν¬νΈ ν¬μλ©μ μ¬μ©νμ¬ μ΄ κ²½λ‘λ₯Ό ν΅ν΄ νΈλν½μ ν°λλ§ν μ μμ΅λλ€:
```bash
sudo ssh -L :: -N -f @
```
### SFTP Symlink
The **sftp** have the command "**symlink**". Therefore, if you have **writable rights** in some folder, you can create **symlinks** of **other folders/files**. As you are probably **trapped** inside a chroot this **won't be specially useful** for you, but, if you can **access** the created **symlink** from a **no-chroot** **service** (for example, if you can access the symlink from the web), you could **open the symlinked files through the web**.
μλ₯Ό λ€μ΄, μ νμΌ **"**_**froot**_**"**μμ "**_**/**_**"**λ‘ **symlink**λ₯Ό μμ±νλ €λ©΄:
```bash
sftp> symlink / froot
```
If you can access the file "_froot_" via web, you will be able to list the root ("/") folder of the system.
### μΈμ¦ λ°©λ²
κ³ λ³΄μ νκ²½μμλ λ¨μν λΉλ°λ²νΈ κΈ°λ° μΈμ¦ λμ ν€ κΈ°λ° λλ μ΄μ€ μΈμ¦λ§ νμ±ννλ κ²μ΄ μΌλ°μ μΈ κ΄νμ
λλ€. κ·Έλ¬λ μ’
μ’
λ κ°λ ₯ν μΈμ¦ λ°©λ²μ΄ νμ±νλλ©΄μ μ½ν λ°©λ²μ΄ λΉνμ±νλμ§ μμ΅λλ€. μμ£Ό λ°μνλ κ²½μ°λ openSSH ꡬμ±μμ `publickey`λ₯Ό νμ±ννκ³ κΈ°λ³Έ λ°©λ²μΌλ‘ μ€μ νμ§λ§ `password`λ₯Ό λΉνμ±ννμ§ μλ κ²μ
λλ€. λ°λΌμ SSH ν΄λΌμ΄μΈνΈμ μμΈν λͺ¨λλ₯Ό μ¬μ©νλ©΄ 곡격μκ° μ½ν λ°©λ²μ΄ νμ±νλμ΄ μμμ νμΈν μ μμ΅λλ€:
```bash
ssh -v 192.168.1.94
OpenSSH_8.1p1, OpenSSL 1.1.1d 10 Sep 2019
...
debug1: Authentications that can continue: publickey,password,keyboard-interactive
```
μλ₯Ό λ€μ΄ μΈμ¦ μ€ν¨ μ νμ΄ μ€μ λμ΄ μκ³ λΉλ°λ²νΈ λ°©λ²μ λλ¬ν κΈ°νκ° μλ€λ©΄, `PreferredAuthentications` μ΅μ
μ μ¬μ©νμ¬ μ΄ λ°©λ²μ κ°μ λ‘ μ¬μ©ν μ μμ΅λλ€.
```bash
ssh -v 192.168.1.94 -o PreferredAuthentications=password
...
debug1: Next authentication method: password
```
SSH μλ² κ΅¬μ±μ κ²ν νλ κ²μ μμλλ λ°©λ²λ§μ΄ νκ°λμλμ§ νμΈνλ λ° νμν©λλ€. ν΄λΌμ΄μΈνΈμμ μμΈν λͺ¨λλ₯Ό μ¬μ©νλ©΄ ꡬμ±μ ν¨κ³Όλ₯Ό νμΈνλ λ° λμμ΄ λ μ μμ΅λλ€.
### Config files
```bash
ssh_config
sshd_config
authorized_keys
ssh_known_hosts
known_hosts
id_rsa
```
## νΌμ§
* [https://packetstormsecurity.com/files/download/71252/sshfuzz.txt](https://packetstormsecurity.com/files/download/71252/sshfuzz.txt)
* [https://www.rapid7.com/db/modules/auxiliary/fuzzers/ssh/ssh\_version\_2](https://www.rapid7.com/db/modules/auxiliary/fuzzers/ssh/ssh\_version\_2)
## μ°Έκ³ μλ£
* SSHλ₯Ό κ°ννλ λ°©λ²μ λν ν₯λ―Έλ‘μ΄ κ°μ΄λλ [https://www.ssh-audit.com/hardening\_guides.html](https://www.ssh-audit.com/hardening\_guides.html)μμ μ°Ύμ μ μμ΅λλ€.
* [https://community.turgensec.com/ssh-hacking-guide](https://community.turgensec.com/ssh-hacking-guide)
**λ²κ·Έ λ°μ΄ν° ν**: **ν΄μ»€λ₯Ό μν΄ ν΄μ»€κ° λ§λ ν리미μ **λ²κ·Έ λ°μ΄ν° νλ«νΌμΈ **Intigriti**μ **κ°μ
νμΈμ**! μ€λ [**https://go.intigriti.com/hacktricks**](https://go.intigriti.com/hacktricks)μμ μ ν¬μ ν¨κ»νκ³ μ΅λ **$100,000**μ 보μμ λ°κΈ° μμνμΈμ!
{% embed url="https://go.intigriti.com/hacktricks" %}
## HackTricks μλ λͺ
λ Ή
```
Protocol_Name: SSH
Port_Number: 22
Protocol_Description: Secure Shell Hardening
Entry_1:
Name: Hydra Brute Force
Description: Need Username
Command: hydra -v -V -u -l {Username} -P {Big_Passwordlist} -t 1 {IP} ssh
Entry_2:
Name: consolesless mfs enumeration
Description: SSH enumeration without the need to run msfconsole
Note: sourced from https://github.com/carlospolop/legion
Command: msfconsole -q -x 'use auxiliary/scanner/ssh/ssh_version; set RHOSTS {IP}; set RPORT 22; run; exit' && msfconsole -q -x 'use scanner/ssh/ssh_enumusers; set RHOSTS {IP}; set RPORT 22; run; exit' && msfconsole -q -x 'use auxiliary/scanner/ssh/juniper_backdoor; set RHOSTS {IP}; set RPORT 22; run; exit'
```
{% hint style="success" %}
AWS ν΄νΉ λ°°μ°κΈ° λ° μ°μ΅νκΈ°:[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)\
GCP ν΄νΉ λ°°μ°κΈ° λ° μ°μ΅νκΈ°: [**HackTricks Training GCP Red Team Expert (GRTE)**](https://training.hacktricks.xyz/courses/grte)
HackTricks μ§μνκΈ°
* [**ꡬλ
κ³ν**](https://github.com/sponsors/carlospolop) νμΈνκΈ°!
* **π¬ [**Discord κ·Έλ£Ή**](https://discord.gg/hRep4RUj7f) λλ [**ν
λ κ·Έλ¨ κ·Έλ£Ή**](https://t.me/peass)μ μ°Έμ¬νκ±°λ **Twitter** π¦ [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**λ₯Ό νλ‘μ°νμΈμ.**
* **[**HackTricks**](https://github.com/carlospolop/hacktricks) λ° [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) κΉνλΈ λ¦¬ν¬μ§ν 리μ PRμ μ μΆνμ¬ ν΄νΉ νμ 곡μ νμΈμ.**
{% endhint %}