App Web Vuln Cookie Spoofing

jueves, 4 de junio de 2009 en 13:31
<?
/**
* 04/06/09
* App Web Vuln Code Cookie Spoofing
* Coded by Bocvk
* www.exploit-crew.blogspot.com
**/

if(!empty($_POST['user']) && !empty($_POST['pass'])){

$user=$_POST['user'];
$pass=$_POST['pass'];
check_user($user,$pass);

}elseif(empty($_COOKIE['user'])){
echo '<center><br><form action="" method="POST">
User : <input type="text" name="user"><br>
Pass : <input type="text" name="pass"><br><br>
<input type="submit" value="Send">
</form></center> ';
}else{
if(isset($_COOKIE['user']))
{
echo "<center><h1>";
switch($_COOKIE['user']){
case 1: echo "Logged in admin";
break;
case 2: echo "Logged in user1";
break;
default: echo "Logged in user2";
break;
}
echo "</h1></center>";
}
}



function check_user($user,$pass){
// Simulation of database simple =)
$users=array("admin","user1","user2");
$passwords=array("pass_admin","pass_user1","pass_user2");

for($i=0;$i<count($users);$i++){
if($users[$i]=="$user" && $passwords[$i]=="$pass"){
setcookie("user",strval($i+1),time()+3600);
$file= basename($_SERVER["SCRIPT_NAME"]);
header("Location: $file");
}
}
}
?>

PHP Code Analityc

domingo, 31 de mayo de 2009 en 10:07
Este script lo hice por la razon , que no podia ejecutar el CGI Code Analityc de Xianur0 , porque no tenia soporte CGI , asi que creo que la mayoria no lo tiene , por lo tanto lo hice en php que es totalmente diferente el codigo , la idea la extraje del manual hecho por Xianur0 asi que de ahi me guie y de una variante de una tool que programe hace unos dias tambien , pero creo que el CGI Code Analityc solo busca los parametros en un directorio mas no en los subdirectorios , esta funcion esta agregada , aqui les dejo algunas descripcion del script :

Funcion del Script :
Busca una variable/texto/funcion en los archivos de una carpeta y subcarpetas

Utilidad :
- Encontrar fallas de seguridad
- Lo dejo para su imaginación


Ej de utilidad :
Buscar variables globalizadas, por ejemplo $_SERVER (en PHP) logicamente $_SERVER contiene variables del servidor, pero tambien contiene algunas como son headers HTTP

Path : /home/bocvk/wordpress
Search : $_SERVER['HTTP_
Resultado :
/home/bocvk/wordpress/wp-content/plugins/akismet/akismet.php

Line 189:
$comment['user_agent'] = $_SERVER['HTTP_USER_AGENT'];

Aqui podriamos sacar un LFI seria cuestion de seguir el rastro a la variable aver si no se filtra y por donde pasa tambien aver si se podra sacar el LFI ...

Mas Info :
CGI Code Analytic v0.1 Xianur0
Manual CGI Code Analytic By Xianur0

Source :
<style type=text/css>
BODY { font: 11px Tahoma, Verdana, sans-serif;
margin: 0px;
padding: 0px;
text-align: center;
color: #000000;}
Table{
border: 1px solid #DADADA;
background-color: White;
padding: 5px;
font: 11px Tahoma, Verdana, sans-serif;
line-height: 17px;
color: Gray; }

input,textarea,select
{
margin: 3px;
vertical-align: middle;
border: 1px solid #DADADA;
background-color: White;
padding: 3px;
font: 11px Tahoma, Verdana, sans-serif;
color: Gray;
}

div{
padding: 10px;
width:80%;
border:1px dashed black;
}

</style>
<html>
<title>PHP Code Analityc by Bocvk</title>
<body>
<br><table width="300" align="center"><th>PHP Code Analityc</th>
</table><br>
<table align="center">
<form action="" method="post">
<tr>
<td>Path : </td><td><input type="text" name="path" size="40"></td>
</tr>
<tr>
<td>Search : </td><td><input type="text" name="search" size="40"></td>
<tr>
<tr>
<td></td><td><input type="submit" value="Search"></td>
</tr>
</form></table><br>
<?php

// PHP Code Analityc
// Coded by Bocvk
// bocvk [at] hotmail [dot] com
// ~[Expl0it-Cr3w]~ 2oo9

// WARNING :
// I see not talk very good the language english
// Sorry if find a gramatical error


// ----- CONFIG -----
// route where executed the searcher
$path_conf=$_POST['path'];
// string of searcher
$search_conf=$_POST['search'];
// ----- -----

// Check if exists parameters
if($path_conf=="" || $search_conf==""){
exit;
}

$search_conf=stripslashes($search_conf);

echo "<table align='center'>
<tr><td>Directory :</td><td>$path_conf</td></tr>
<tr><td>String :</td><td>".htmlentities($search_conf)."</td></tr>
</table><br>";


function search($path){
global $search_conf;

// Open Dir
if(!($handle=@opendir($path))){
echo "Error : Directory Incorrect";
exit;
}
// $file content the name of archives in the directory specify
while (false !== ($file = readdir($handle))){

// Check is different a current directory
if ($file != "." && $file != ".."){

// We put the route and name of archive for can open the archive
$path_full=$path."/".$file;


// Check is directory
if(is_dir($path_full))
{
search($path_full);
}else{

// Print a error if can't open archive
if(!$fp=fopen($path_full,'r')){
echo "Error : Can't open the archive";
exit;
}

$warning=0;
$line_search=array();
$numline_search=array();

// Extract line for line of the archive
$count_lines=0;
while(!feof($fp)){
$line=fgets($fp);
// Searching the possibles results
if(strstr($line,$search_conf)){
$warning=1;
array_push($line_search,$line);
array_push($numline_search,$count_lines);
}
$count_lines++;
}


// Verify if finded a archive
if($warning==1){
// Print the filename of the archive
echo "<br><center><div>Archive : $path_full<br>";
// Print the number line and content
for($i=0;$i<count($numline_search);$i++){
echo "<br>Line ".($numline_search[$i]+1).":<br><textarea cols=150 rows=1>".htmlentities($line_search[$i]).
"</textarea><br>";
}
echo "</center></div><br>";
}

// Closed the archive
fclose($fp);
}

}
}


// Closed the directory
closedir($handle);

// Closed function search
}

// We invoked to the function search
search($path_conf);

?>

Port Scan Simple [Perl]

martes, 26 de mayo de 2009 en 14:06
#!/usr/bin/perl
# 25-03-09
# PortScan Simple
# Coded by Bocvk
# Exploit-Crew => Bocvk , Polk
# Contact : info.bocvk [at] gmail.com
# HomePage : www.exploit-crew.blospot.com

use IO::Socket;
die " [!] Syntax : perl $0 [server] [port_begin] [port_end]n" unless($ARGV[2]);
$server=$ARGV[0];
$port_i=$ARGV[1];
$port_f=$ARGV[2];
print " [+] Scanning ...n";
for($port=$port_i;$port<=$port_f;$port++){
$socket= IO::Socket::INET->new(PeerAddr => "$server",
PeerPort => "$port",
Proto => 'tcp');

if($socket){
$service = getservbyport($port, 'tcp');
print " OPEN | $port | $servicen";
}else{
print " CLOSE | $portn";
}
close($socket);
}

Path Disclosure in Systems Web of Open Sources

domingo, 17 de mayo de 2009 en 10:26
¿Que es Full Path Disclosure?

Full Path Disclosure quiere decir divulgación de ruta completa. En palabras simple, es mostrar la ruta exacta donde nos encontramos.
Es una vulnerabilidad producida debido a que los reportes de error están activados en el php.ini .

Utilidades del Path Disclosure

Obtener la ruta del servidor , asi poder aplicar mejor las vulnerabilidades de :
*Local File Inclusion
*Load File con SQL Injection
*Otros

Encontrando Path Disclosure en Sistemas Webs de Open Source

Utilidades :

Hosting (Preferible un localhost)
Un sistema web (Ej : Joomla , Wordpress , etc)

Encontrando Path Disclosure :
*La idea es acceder a los archivos php que no muestran contenidos html sino que son funciones para otros archivos que si cumplen la funcion de mostrar el html , a traves del navegador asi las funciones no recibiran los parametros correctos y provocaran errores , tal como cuando programamos en php a la hora probar nuestros scripts a veces nos surgen algunos errores
los cuales contienen la sgte. informacion :
- Indicandonos la ruta del archivo
- El error especifico y el numero de linea en la cual se encuentra dicho error

Ej :
Fatal error: Class 'JText' not found in C:\xampp\htdocs\config_database.php on line 2

*El problema esta en que algunos sistemas webs contienen protecciones en algunos archivos y en otros como por ejemplo SMF , si vos accedes a un archivo diferente de index.php a traves del navegador como /Sources/Admin.php veras el sgte mensaje de proteccion :
Hacking attempt...

O tambien el problema seria que algunos sistemas webs contienen demasiados archivos , y estar revisando uno por uno seria muy molestoso ...

*Asi que para ahorrar tiempo programe una tool en php que extrae la ruta de todos los archivos que tienen la vulnerabilidad de path disclosure .
La tool es la sgte :

<style type=text/css>
BODY { font: 11px Tahoma, Verdana, sans-serif;
margin: 0px;
padding: 0px;
text-align: center;
color: #000000;}
Table{
border: 1px solid #DADADA;
background-color: White;
padding: 5px;
font: 11px Tahoma, Verdana, sans-serif;
line-height: 17px;
color: Gray; }

input,textarea,select
{
margin: 3px;
vertical-align: middle;
border: 1px solid #DADADA;
background-color: White;
padding: 3px;
font: 11px Tahoma, Verdana, sans-serif;
color: Gray;
}

div{
padding: 10px;
width:80%;
border:1px dashed black;
}

</style>
<html>
<title>Tracker of Fatal Errors by Bocvk</title>
<body>
<br><table width="300" align="center"><th>Tracker of Fatal Errors</th>
</table><br>
<table align="center">
<form action="" method="post">
<tr>
<td>Path SystemWeb : </td><td><input type="text" name="path" size="40"></td>
</tr>
<tr>
<td>Search Not Exist : </td><td><input type="text" name="search1" size="40"></td>
</tr>
<tr>
<td>Search Yes Exist : </td><td><input type="text" name="search2" size="40"></td>
</tr>
<tr>
<td></td><td><input type="submit" value="Search"></td>
</tr>
</form></table><br>

<?php

// Tracker of Fatal Errors
// Coded by Bocvk
// bocvk [at] hotmail [dot] com
// ~[Expl0it-Cr3w]~ 2oo9

set_time_limit(0);


/* List all files in one folder and sub folders */

$webs='';
$path_conf=stripslashes($_POST['path']);
$strsearch=$_POST['search1'];
$strsearch_new=$_POST['search2'];

// Check if exists parameters
if($path_conf=="" || $strsearch=="" || $strsearch_new==""){
exit;
}

echo "<table align='center'>
<tr><td>Path SystemWeb:</td><td>$path_conf</td></tr>
<tr><td>String Not Found:</td><td>".htmlentities($strsearch)."</td></tr>
<tr><td>String Found:</td><td>".htmlentities($strsearch_new)."</td></tr>
</table><br>";

function list_dir($path){
global $webs;

if(!($handle=@opendir($path))){
echo "Error : Directory Incorrect";
exit;
}

while (false !== ($file = readdir($handle))){
if ($file != "." && $file != ".."){
$path_full=$path."/".$file;
if(is_dir($path_full))
{
list_dir($path_full);
}else{
$webs.=$path_full.'?';
}
}
}

}

list_dir($path_conf);

/* End List Dir */

$webs=str_replace('\','/',$webs);
/* Config Rute Personal */
$webs=str_replace('C:/xampp/htdocs','http://localhost',$webs);


$array_Webs=explode('?',$webs);
$array_Webs_new=array();

for($i=0;$i<count($array_Webs);$i++){
if(strstr($array_Webs[$i],'.php')){
if($strsearch=='null'){array_push($array_Webs_new,$array_Webs[$i]);}
else{
$content=@file_get_contents($array_Webs[$i]);
if(strstr($content,$strsearch)==false)
{array_push($array_Webs_new,$array_Webs[$i]);}
}
}
}

echo "<table align='center' width='600'><tr><td><center><h1>Results</h1></center></td></tr>
<tr><td>";

for($i=0;$i<count($array_Webs_new);$i++){
if($strsearch_new=='null'){echo $array_Webs_new[$i].'<br>';}
else{
$content=@file_get_contents($array_Webs_new[$i]);
if(strstr($content,$strsearch_new)==true)
{
echo $array_Webs_new[$i].'<br>';
}
}
}
echo "</td></tr></table>"
?>

Uso de la Tool :
Path SystemWeb : => Ruta Completa del Sistema Web
Search Not Exist : => Una String que no quieren que exista en los resultados . Ej : Hacking Attempt en SMF
Search Yes Exist : => String de Error . Ej : Fatal Error
*Si en cualquiera de las dos opciones (Search Not Exist o Search Yes Exist) , no se desea configurar deben poner la string : 'null' (sin comillas).

Ej de uso de la tool :
Path SystemWeb : C:\xampp\htdocs\Joomla
Search Not Exist : null
Search Yes Exist : error

Resultado :
http://localhost/Joomla/administrator/components/com_config/controllers/application.php
http://localhost/Joomla/administrator/components/com_config/controllers/component.php
http://localhost/Joomla/administrator/components/com_config/views/application/tmpl/config_cache.php
http://localhost/Joomla/administrator/components/com_config/views/application/tmpl/config_database.php
http://localhost/Joomla/administrator/components/com_config/views/application/tmpl/config_debug.php
http://localhost/Joomla/administrator/components/com_config/views/application/tmpl/config_ftp.php
http://localhost/Joomla/administrator/components/com_config/views/application/tmpl/config_locale.php
http://localhost/Joomla/administrator/components/com_config/views/application/tmpl/config_mail.php
http://localhost/Joomla/administrator/components/com_config/views/application/tmpl/config_metadata.php
http://localhost/Joomla/administrator/components/com_config/views/application/tmpl/config_seo.php
http://localhost/Joomla/administrator/components/com_config/views/application/tmpl/config_server.php
http://localhost/Joomla/administrator/components/com_config/views/application/tmpl/config_session.php
http://localhost/Joomla/administrator/components/com_config/views/application/tmpl/config_site.php
http://localhost/Joomla/administrator/components/com_config/views/application/tmpl/config_system.php
http://localhost/Joomla/administrator/components/com_config/views/application/tmpl/ftp.php
http://localhost/Joomla/administrator/components/com_config/views/application/tmpl/navigation.php
http://localhost/Joomla/administrator/components/com_installer/models/components.php
http://localhost/Joomla/administrator/components/com_installer/models/languages.php
http://localhost/Joomla/administrator/components/com_installer/models/modules.php
http://localhost/Joomla/administrator/components/com_installer/models/plugins.php
http://localhost/Joomla/administrator/components/com_installer/models/templates.php
http://localhost/Joomla/administrator/components/com_installer/views/components/tmpl/default.php
http://localhost/Joomla/administrator/components/com_installer/views/components/tmpl/default_item.php
http://localhost/Joomla/administrator/components/com_installer/views/default/tmpl/default_ftp.php
http://localhost/Joomla/administrator/components/com_installer/views/default/tmpl/default_message.php
http://localhost/Joomla/administrator/components/com_installer/views/install/tmpl/default.php
http://localhost/Joomla/administrator/components/com_installer/views/install/tmpl/default_form.php
http://localhost/Joomla/administrator/components/com_installer/views/languages/tmpl/default.php
http://localhost/Joomla/administrator/components/com_installer/views/languages/tmpl/default_item.php
http://localhost/Joomla/administrator/components/com_installer/views/modules/tmpl/default.php
http://localhost/Joomla/administrator/components/com_installer/views/modules/tmpl/default_item.php
http://localhost/Joomla/administrator/components/com_installer/views/plugins/tmpl/default.php
http://localhost/Joomla/administrator/components/com_installer/views/plugins/tmpl/default_item.php
http://localhost/Joomla/administrator/components/com_installer/views/templates/tmpl/default.php
http://localhost/Joomla/administrator/components/com_installer/views/templates/tmpl/default_item.php
http://localhost/Joomla/administrator/components/com_search/helpers/site.php
http://localhost/Joomla/administrator/components/com_translationsmanager/elements/fflanguages.php
http://localhost/Joomla/components/com_content/views/article/tmpl/pagebreak.php
http://localhost/Joomla/libraries/joomla/client/ldap.php
http://localhost/Joomla/libraries/joomla/html/html/content.php
http://localhost/Joomla/libraries/joomla/utilities/compat/php50x.php
http://localhost/Joomla/libraries/openid/Auth/OpenID/Association.php
http://localhost/Joomla/libraries/openid/Auth/OpenID/AX.php
http://localhost/Joomla/libraries/openid/Auth/OpenID/BigMath.php
http://localhost/Joomla/libraries/openid/Auth/OpenID/Consumer.php
http://localhost/Joomla/libraries/openid/Auth/OpenID/DiffieHellman.php
http://localhost/Joomla/libraries/openid/Auth/OpenID/Discover.php
http://localhost/Joomla/libraries/openid/Auth/OpenID/DumbStore.php
http://localhost/Joomla/libraries/openid/Auth/OpenID/Extension.php
http://localhost/Joomla/libraries/openid/Auth/OpenID/FileStore.php
http://localhost/Joomla/libraries/openid/Auth/OpenID/HMAC.php
http://localhost/Joomla/libraries/openid/Auth/OpenID/MemcachedStore.php
http://localhost/Joomla/libraries/openid/Auth/OpenID/Message.php
http://localhost/Joomla/libraries/openid/Auth/OpenID/MySQLStore.php
http://localhost/Joomla/libraries/openid/Auth/OpenID/Nonce.php
http://localhost/Joomla/libraries/openid/Auth/OpenID/PAPE.php
http://localhost/Joomla/libraries/openid/Auth/OpenID/Parse.php
http://localhost/Joomla/libraries/openid/Auth/OpenID/PostgreSQLStore.php
http://localhost/Joomla/libraries/openid/Auth/OpenID/Server.php
http://localhost/Joomla/libraries/openid/Auth/OpenID/ServerRequest.php
http://localhost/Joomla/libraries/openid/Auth/OpenID/SQLiteStore.php
http://localhost/Joomla/libraries/openid/Auth/OpenID/SQLStore.php
http://localhost/Joomla/libraries/openid/Auth/OpenID/SReg.php
http://localhost/Joomla/libraries/openid/Auth/OpenID/TrustRoot.php
http://localhost/Joomla/libraries/openid/Auth/OpenID/URINorm.php
http://localhost/Joomla/libraries/openid/Auth/OpenID.php
http://localhost/Joomla/libraries/openid/Auth/Yadis/HTTPFetcher.php
http://localhost/Joomla/libraries/openid/Auth/Yadis/ParanoidHTTPFetcher.php
http://localhost/Joomla/libraries/openid/Auth/Yadis/PlainHTTPFetcher.php
http://localhost/Joomla/libraries/openid/Auth/Yadis/XRDS.php
http://localhost/Joomla/libraries/openid/Auth/Yadis/XRI.php
http://localhost/Joomla/libraries/openid/Auth/Yadis/XRIRes.php
http://localhost/Joomla/libraries/openid/Auth/Yadis/Yadis.php
http://localhost/Joomla/libraries/openid/consumer.php
http://localhost/Joomla/libraries/phpxmlrpc/xmlrpcs.php

Verificando el funcionamiento de la tool :

*Accedemos a cualquiera de las rutas que nos dio . Ej:
http://localhost/Joomla/libraries/joomla/html/html/content.php

Resultado :
Fatal error: Class 'JLoader' not found in C:\xampp\htdocs\Joomla\libraries\joomla\html\html\content.php on line 15


Reparando el Bug

Abrimos el archivo php.ini y modificamos el sgte. valor :

display_errors = On

display_errors = Off

Saludos , Bocvk

Bievenidos

sábado, 9 de mayo de 2009 en 15:03

Exploit-Crew somos un pequeño Grupo de Seguridad Informatica , en el cual nuestra prioridad es ofrecer un matenimiento y medidas de seguridad optimas para tu web.


Contact : info.bocvk [at] gmail.com

Exploit Crew Labs | Powered by Blogger | Entries (RSS) | Comments (RSS) | Designed by MB Web Design | XML Coded By Cahayabiru.com