Struts2漏洞处理
拦截器处理struts2的漏洞;
主要原因是加上的一个参数:这里只需要判断这里请求的参数里面没有\\u0023,这个代表#,就可以通过;
public class BugInterceptor implements Interceptor{
@Override
public String intercept(ActionInvocation invocation) throws Exception {
invocation.getProxy().getConfig().getParams();
String suffer = ServletActionContext.getRequest().getQueryString();
if(suffer.contains("\\u0023")){
return "error";
}else{
return invocation.invoke();
}
}
@Override
public void destroy() {
// TODO Auto-generated method stub
}
@Override
public void init() {
// TODO Auto-generated method stub
}
}
<package name="bugInterceptor" namespace="/" extends="struts-default">
<interceptors>
<interceptor name="bugInterceptor" class="com.itcast.oa.interceptor.BugInterceptor"></interceptor>
<interceptor-stack name="bugStack">
<interceptor-ref name="bugInterceptor"></interceptor-ref>
<interceptor-ref name="defaultStack"></interceptor-ref>
</interceptor-stack>
</interceptors>
<default-interceptor-ref name="bugStack"></default-interceptor-ref>
</package>
浙公网安备 33010602011771号