139,445 - Pentesting SMB
Smb ์ด๊ฑฐ ์ ์ ์ ๋ ํจ์ค์๋์ ์๋ฌด๊ฑฐ๋ ์ ๋ ฅํด์๋ผ๋ ํ๋ฒ ํ์ธํ
โโโโ(root@kali-container-upgrade)-[~/tools/impacket]
โโ# sudo python3 lookupsid.py thm.corp/guest:@10.10.171.244
#์ฑ
Impacket v0.12.0.dev1 - Copyright 2023 Fortra
Password:
[*] Brute forcing SIDs at 10.10.171.244
[*] StringBinding ncacn_np:10.10.171.244[\pipe\lsarpc]
[*] Domain SID is: S-1-5-21-1966530601-3185510712-10604624
498: THM\Enterprise Read-only Domain Controllers (SidTypeGrou
enum4linux -a 10.10.10.100 #-a : ๋ชจ๋ ์ ๋ณด ๊ฐ์ ธ์ค๊ธฐ
smbmap -H 10.10.10.100
smbclient //10.10.10.100/Replication -U ""%"" #-U๋ ์ฌ์ฉ์ ์ธ์ฆ ์ ๋ณด ์ง์ ์ต์
(์ ์ ์์ด๋ ๊ฐ์ ๊ฒ) but ์ฌ๊ธฐ์๋ ๋น๋ฌธ์์ด ""%""์ ์ฌ์ฉํ์ฌ ์ต๋ช
์ผ๋ก ์ ์
smbmap -H 10.10.10.100 -r #๊ณต์ ๊ฐ๋ฅํ ํด๋ ์ฌ๊ท์ ์ผ๋ก ๋์ด
crackmapexec smb support.htb #ํธ์คํธ ์ด๋ฆ๊ณผ ๋๋ฉ์ธ ํ์
crackmapexec smb support.htb --shares #๊ณต์ ๊ฐ๋ฅํ ํด๋ ๋ชจ๋ ํ์
crackmapexec smb <target_ip_range> --shares -u '' -p ''
smbclient -N -L //support.htb #-N : ์ธ์ฆ ์์ด, -L : ํธ์คํธ์ ๊ณต์ ๋ชฉ๋ก ํ์
smbclient --no-pass //10.10.11.202/public #์ต๋ช
๋ก๊ทธ์ธ
smbclient ////10.10.11.202 -U sql_svc%REGGIE1234ronnie
smb: \> mask ""
smb: \> recurse ON
smb: \> prompt OFF
smb: \> mget * #์ด๋ฌ๋ฉด ๊ฐ ๊ณต์ ์ ์๋ ๋ชจ๋ ํ์ผ ๋ค์ด ๊ฐ๋ฅ
smb: \> get "SQL Server Procedures.pdf" /root/Downloads/HTB/machine/Escape/txt.txt
#ํ์ผ ๋ค์ด ๋ช
๋ น์ด
#๋ค์ด๋ก๋ํ ํด๋์์ ํ์ผ ์ฐพ๋ ๋ช
๋ น์ด
find smb-data-loot/ -type f
mount -t cifs //10.10.10.192/profiles$ /mnt #ํ์ผ ๋ง์ดํธ ๋ช
๋ น์ด
#-t cifs: ๋ง์ดํธํ ํ์ผ ์์คํ
์ ์ ํ์ ์ง์ ํฉ๋๋ค. ์ฌ๊ธฐ์๋ CIFS๋ฅผ ์ฌ์ฉํ๋ฏ๋ก -t cifs๋ก ์ง์ ํฉ๋๋ค.
sudo umount ./blackfield/smb # unmount
#smb ์ต๋ช
๋ก๊ทธ์ธ
โโโโ(root@kali-container-upgrade)-[~/Downloads/HTB/machine/Reset]
โโ# smbclient -N -L //10.10.171.244/Data
Sharename Type Comment
--------- ---- -------
ADMIN$ Disk Remote Admin
C$ Disk Default share
Data Disk
IPC$ IPC Remote IPC
NETLOGON Disk Logon server share
SYSVOL Disk Logon server share
Reconnecting with SMB1 for workgroup listing.
do_connect: Connection to 10.10.171.244 failed (Error NT_STATUS_RESOURCE_NAME_NOT_FOUND)
Unable to connect with SMB1 -- no workgroup available
โโโโ(root@kali-container-upgrade)-[~/Downloads/HTB/machine/Reset]
โโ# smbclient //10.10.171.244/Data -N
Try "help" to get a list of possible commands.
smb: \>
๋ก์ปฌ ์ฌ์ฉ์ ์ด๊ฑฐ
์ํจํท
python3 lookupsid.py 'hazard:stealth1agent'@10.10.10.149
// SMB ๋ช
๋ น์ดcode
get <ํ์ผ๋ช
> #ํ์ผ ๋ค์ด ๋ช
๋ น์ด
put <file name > #file upload command
๋น๋ฐ๋ฒํธ ์คํ๋ ์ด
๋ง์ ์ฌ์ฉ์๋ค์๊ฒ ํ๋์ ๋น๋ฐ๋ฒํธ๋ฅผ ๋์ ํ๋ ๊ฒ
crackmapexec smb 10.10.10.169 -u users -p 'Welcome123!' --shares --continue-on-success
hydra -L user.list -P password.list smb://10.129.42.197
msf - smb_login ๋ชจ๋ ์ฌ์ฉ
RID ์ด๊ฑฐ
crackmapexec smb thm.corp -u uest -p '' --rid-brute
sudo python3 lookupsid.py guest:@10.10.171.244
Last updated