|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +<cherrytree> |
| 3 | + <node name="22 - SSH" unique_id="3" prog_lang="custom-colors" tags="" readonly="0" nosearch_me="0" nosearch_ch="0" custom_icon_id="0" is_bold="0" foreground="" ts_creation="1704060859" ts_lastsave="1704140664"> |
| 4 | + <rich_text>Note: SSH is a pretty secure service, and is pretty hard to configure poorly. It is unlikely that this will be the initial foothold (unless you bruteforce) |
| 5 | + |
| 6 | +</rich_text> |
| 7 | + <rich_text underline="single" weight="heavy">Banner Grabbing</rich_text> |
| 8 | + <rich_text> |
| 9 | +</rich_text> |
| 10 | + <rich_text justification="left"></rich_text> |
| 11 | + <rich_text> |
| 12 | + |
| 13 | +</rich_text> |
| 14 | + <rich_text underline="single" weight="heavy">nmap scripts</rich_text> |
| 15 | + <rich_text> |
| 16 | +</rich_text> |
| 17 | + <rich_text justification="left"></rich_text> |
| 18 | + <rich_text> |
| 19 | +a list of known bad keys: </rich_text> |
| 20 | + <rich_text link="webs https://github.com/rapid7/ssh-badkeys/tree/master/authorized">https://github.com/rapid7/ssh-badkeys/tree/master/authorized</rich_text> |
| 21 | + <rich_text> |
| 22 | + |
| 23 | +</rich_text> |
| 24 | + <rich_text underline="single" weight="heavy">Bruteforcing SSH</rich_text> |
| 25 | + <rich_text> |
| 26 | + |
| 27 | + |
| 28 | +</rich_text> |
| 29 | + <rich_text underline="single" weight="heavy">MetaSploit Modules</rich_text> |
| 30 | + <rich_text> |
| 31 | + |
| 32 | + |
| 33 | +</rich_text> |
| 34 | + <rich_text underline="single" weight="heavy">SSH Tunneling</rich_text> |
| 35 | + <rich_text> |
| 36 | +If you have compromised the host via SSH, you can use this for tunneling. This is much more stable in my experience than using metasploit |
| 37 | + |
| 38 | + |
| 39 | +</rich_text> |
| 40 | + <rich_text underline="single" weight="heavy">SSH Authorized_Keys</rich_text> |
| 41 | + <rich_text> |
| 42 | +When a device has been compromised, check the user's home folders for authorized keys. This can allow you to privesc without needing a password |
| 43 | + |
| 44 | + |
| 45 | +</rich_text> |
| 46 | + <codebox char_offset="173" justification="left" frame_width="500" frame_height="40" width_in_pixels="1" syntax_highlighting="sh" highlight_brackets="1" show_line_numbers="0">nc -vn ip.addr 22</codebox> |
| 47 | + <codebox char_offset="190" justification="left" frame_width="1257" frame_height="70" width_in_pixels="1" syntax_highlighting="sh" highlight_brackets="1" show_line_numbers="0">nmap -p 22 ip.addr --script=ssh2-enum-algos #enumerate algorithms used to create key |
| 48 | +nmap -p 22 ip.addr --script=ssh-hostkey --script-args ssh_hostkey=full # Shows the target SSH server's key fingerprint |
| 49 | +nmap -p 22 ip.addr --script=ssh-auth-methods --script-args="ssh.user=username" #can help you identify accounts without creds</codebox> |
| 50 | + <codebox char_offset="297" justification="left" frame_width="857" frame_height="40" width_in_pixels="1" syntax_highlighting="sh" highlight_brackets="1" show_line_numbers="0">hydra -L user.txt -P pass.txt ip.addr -V -f ssh #can help you find low hanging fruit</codebox> |
| 51 | + <codebox char_offset="319" justification="left" frame_width="597" frame_height="40" width_in_pixels="1" syntax_highlighting="sh" highlight_brackets="1" show_line_numbers="0">auxiliary/scanner/ssh/ssh_version |
| 52 | +auxiliary/scanner/ssh/ssh_login |
| 53 | +scanner/ssh/ssh_enumusers #a timing attack may be possible</codebox> |
| 54 | + <codebox char_offset="474" justification="left" frame_width="787" frame_height="40" width_in_pixels="1" syntax_highlighting="sh" highlight_brackets="1" show_line_numbers="0">sudo ssh -L <local_port>:<remote_host>:<remote_port> -N -f <username>@ip.addr</codebox> |
| 55 | + <codebox char_offset="641" justification="left" frame_width="500" frame_height="70" width_in_pixels="1" syntax_highlighting="sh" highlight_brackets="1" show_line_numbers="0">cat /home/user/.ssh/authorized_keys |
| 56 | +#from attack box |
| 57 | +ssh -i authorized_keys [email protected]</ codebox> |
| 58 | + </node> |
| 59 | +</cherrytree> |
0 commit comments