Ane Mau share bagaimana "Cara Menutup Celah File Upload Vulnerability ( Part I ) dengan Direct Access" tanpa mengganggu source code nya dengan menggunakan debug_backtrace..?
Contoh kasus
Misalkan ente sebagai attacker / hacker yang mengetahui lokasi file upload vulnerability di website target ente , contoh uploadernya berada di http://www.target.com/a.php , dan gak semua attacker jahat . mungkin ente berpikir tentang bagaimana cara menutup celah file upload tersebut, dandebug_backtrace lah solusi nya .
Nih cara pacth bug file upload dengan debug_backtrace :
#Contoh Script file upload yang default ( Liat gambar ) or liat script di bawah 👇
$files = @$_FILES["files"];Selesai ...Sekarang ente udah aman dari serangan file upload vulnerability
if ($files["name"] != '') {
$fullpath = $_REQUEST["path"] .$files["name"];
if (move_uploaded_file($files['tmp_name'], $fullpath)) {
echo "<h1><a href='$fullpath'>OK-Click here!</a></h1>";
}
}echo '<html><head><title>Upload files...</title></head><body><form method=POST enctype="multipart/form-data" action=""><input type=text name=path><input type="file" name="files"><input type=submit value="Up"></form></body></html>';?>
Trus gimana pake debug_backtrace nya ??
ente tinggal tambahin script nya sedikit kaya dibawah ini👇
<?php debug_backtrace() || die ("patches by CowoKerensTeam");
$files = @$_FILES["files"];
if ($files["name"] != '') {
$fullpath = $_REQUEST["path"] .$files["name"];
if (move_uploaded_file($files['tmp_name'], $fullpath)) {echo "<h1><a href='$fullpath'>OK-Click here!</a></h1>";
}
}echo '<html><head><title>Upload files...</title></head><body><form method=POST enctype="multipart/form-data" action=""><input type=text name=path><input type="file" name="files"><input type=submit value="Up"></form></body></html>';?>
Dan ketika ente udah ngupload sebuah file
form file upload yang di patch
Selamat , sekarang ente udah terbebas dari serangan exploit file upload vulnerability .
0 Response to "Cara Menutup Celah File Upload Vulnerability ( Part I ) dengan Direct Access"
Post a Comment