🗒️内存马查杀
2023-12-20
| 2023-12-20
字数 649阅读时长 2 分钟
type
status
date
slug
summary
tags
category
icon
password
存在的价值:
webshell需要落地,可面临被edr或边界流量审计等设备干掉 内存马不需要落地,运行在服务器内存中

1.环境准备

冰蝎,哥斯拉
模拟webshell 部署tomcat
notion image
访问8080端口下图即正常
notion image
点击manager app输入默认口令
notion image
后台部署war
notion image
notion image
上传即可
notion image
访问测试
notion image

冰蝎连接

notion image
notion image

哥斯拉shell

notion image
notion image
通过tomcat部署之后通过webshell连接
notion image
获取java-webshell
notion image
模拟webshell上线并使用冰蝎注入内存马,观察展示效果注入前先将流量导入burp
notion image

jspwebshell&&内存马流量特征:

冰蝎:

①建立连接需要两条流量,第一条不带cookie
notion image
②请求头中带有固定的Accept和Accept-Language,且不可自定义
notion image
③大片无参数的请求体
④内存马默认路径
/shell/memshell 且 页面访问为404但可连接
notion image
notion image

哥斯拉:

①一眼丁真
notion image
②默认密码为pass,并且存在参数后大量密文
③host头随即放
notion image
哥斯拉注入内存马:
进入shell后选择memeoryshell模块,根据路径注入
notion image
可通过serletmanage模块检测是否注册成功

蚁剑:

jsp流量特点:
①响应包中的setcookie字段
notion image
notion image
②默认情况下大部分请求头缺失
notion image
可选择通过蚁剑注入冰蝎或哥斯拉的内存马
notion image

查杀

由于内存马的特性故系统文件中不会存在浏览器中访问gos/test路径返回200
notion image
notion image

工具:

判断是否中了内存马: https://github.com/c0ny1/java-memshell-scanner 但无法覆盖部份内存马
notion image
练习查看该工具是否能查出其他webshell生成的木马

日志:

大量访问同一个文件,并且文件不存于服务器内

以毒攻毒:

将自己的哥斯拉webshell上传至客户服务器
可通过serletmanage模块检测是否存在哥斯拉内存马
notion image
内存马的特点为基本上没有指向的具体方法,后面会标注为空
哥斯拉中内置两种内存马的插入,及删除
notion image
notion image

内存分析:

例:
notion image
notion image
notion image
https://github.com/jar-analyzer/jar-analyzer
通过筛查存在时间戳的信息基本上为哥斯拉的内存马,若要系统热删除,需要定位到系统的临时目录下清除文件
notion image
重点筛查,在当前服务内存中是否存在以下字段
notion image
注:java版本建议8,tomcat8,最简单的办法为先下线服务、修复漏洞,重启
 
  • 安服
  • 日志分析CTF刷点题
    Loading...