XWork ParameterInterceptor类绕过安全限制漏洞-解决1
                                                            生活随笔
收集整理的這篇文章主要介紹了
                                XWork ParameterInterceptor类绕过安全限制漏洞-解决1
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.                        
                                
                            
                            
                            這個問題是如何發生的呢?下面深入看看:       ? Struts2官方站點提供的Struts 2 的整體結構           一個請求在Struts2框架中的處理大概分為以下幾個步驟:   Struts2框架的調用流程:   1、當Servlet容器接收到一個請求后,將請求交給你在web.xml中配置的過濾器FilterDispatcher,調用它的doFilter()方法。  ?   2、FilterDispatcher詢問ActionMapper,以便確定這個請求是否有對應的action調用。  ?   3、ActionMapper返回一個描述了action調用的ActionMapping對象。 ?   4、FilterDispatcher調用Dispatcher類的serviceAction()方法。  ?   5、Dispatcher調用ActionProxy的executed()方法。  ?   6、ActionProxy設置ActionInvocation對象的執行上下文,然后調用其invoke()方法。  ?   7、ActionInvocation的invoke()方法從攔截器映射中查找尚未執行的攔截器,調用它的intercept(invocation)方法,并將自身對象的引用作為參數傳遞給攔截器。  ?   8、攔截器完成某些預處理工作后,反過來調用ActionInvocation的invoke()方法。   ActionInvocation維護著自己的狀態,所以它知道哪些攔截器已經被執行,如果還有未執行的攔截器,就繼續執行它的intercept(invocation)方法。 ?   9、如果所有的攔截器都已經執行過了,就調用action實例的executed()方法(如果struts.xml文件中沒有被設置成其他方法的話)。  ?   10、ActionInvocation根據action執行返回的接過碼,查找對應的Result,調用Result的executed(invocation)的方法,將結果頁面呈現給用戶。  ?   11、ActionInvocation的invoke()方法將控制權返回給攔截器映射中的最后一個攔截器,該攔截器完成所有必須的后期處理工作,然后從interce(invocation)方法返回,允許前一個攔截器執行它自己的后續處理工作。如次反復,直到所有的攔截器都成功返回。  ?   12、ActionInvocation的invoke()方法執行完畢后,向ActionProxy返回一個String類型的結果碼,最后,ActionProxy清理狀態并返回。   這個究竟發生在哪個流程呢? 我們訪問: http://test.struts.com/admin/modelAdmin!listModel.action?cid=000H000A DEBUG整個流程: DEBUG [com.opensymphony.xwork2.interceptor.StaticParametersInterceptor] - Setting static parameters {} 2010-07-19 13:36:26,718  DEBUG [com.opensymphony.xwork2.interceptor.ParametersInterceptor] - Setting params cid => [ 000H000A ]  可以看到,發生在攔截器那個流程,處理請求參數的ParameterInterceptor 類,還記得第七步說什么嗎? 7、ActionInvocation的invoke()方法從攔截器映射中查找尚未執行的攔截器,調用它的intercept(invocation)方法,并將自身對象的引用作為參數傳遞給攔截器。 就是調用:ParameterInterceptor 的 intercept(ActionInvocation invocation)  public class ParametersInterceptor extends MethodFilterInterceptor { public String doIntercept(ActionInvocation invocation) throws Exception { Object action = invocation.getAction(); if (!(action instanceof NoParameters)) { ActionContext ac = invocation.getInvocationContext(); Map parameters = ac.getParameters(); if (LOG.isDebugEnabled()) { LOG.debug("Setting params " + getParameterLogMap(parameters)); } if (parameters != null) { Map contextMap = ac.getContextMap(); try { OgnlContextState.setCreatingNullObjects(contextMap, true); OgnlContextState.setDenyMethodExecution(contextMap, true); OgnlContextState.setReportingConversionErrors(contextMap, true); ValueStack stack = ac.getValueStack(); setParameters(action, stack, parameters); } finally { OgnlContextState.setCreatingNullObjects(contextMap, false); OgnlContextState.setDenyMethodExecution(contextMap, false); OgnlContextState.setReportingConversionErrors(contextMap, false); } } } return invocation.invoke(); } ,,,,
                            
                        
                        
                        總結
以上是生活随笔為你收集整理的XWork ParameterInterceptor类绕过安全限制漏洞-解决1的全部內容,希望文章能夠幫你解決所遇到的問題。
                            
                        - 上一篇: 3COM小型企业有线局域网方案(三、四、
 - 下一篇: CSS布局最常用属性float(浮动)和