發表於 程式分享

struts2 的struts.enable.DynamicMethodInvocation設定值

前幾日,發現網站被放上一個檔案,

經查Tomcat的access log,

是透過struts2  dynamic method invocation功能寫一上傳檔案的程式,

再透過此檔案上傳了另一個檔案,

方式如下:

http://localhost:8080/S2-032/index.action?method:%23_memberAccess%3D@ognl.OgnlContext@DEFAULT_MEMBER_ACCESS%2C%23f%3D@java.lang.Runtime@getRuntime%28%29.exec%28%23parameters.cmd….

經參考此篇文章:

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

緊急先將struts2.xml如下設定值改為false

<constant name=“struts.enable.DynamicMethodInvocation" value=“true" />