SQL 盲注

问题描述:

SQL 盲注_第1张图片

SQL 盲注_第2张图片

 

 解决方案:

通过建立过滤器方法

添加拦截器:

web.xml 文件配置拦截器

    
        sqlFilter
        com.fh.filter.SqlFilter
    
package com.fh.filter;

import com.fh.controller.base.BaseController;

import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Enumeration;


public class SqlFilter extends BaseController implements Filter {

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void destroy() {
    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        HttpServletRequest req = (HttpServletRequest)request;
        HttpServletResponse resp = (HttpServletResponse)response;
        PrintWriter writer = null;
        Enumeration params = req.getParameterNames();
        String sql = "";
        while(params.hasMoreElements()) {


            String name = params.nextElement().toString();
            String[] value = req.getParameterValues(name);
            for(int i=0;i= 0) {


                return true;
            }
        }
        return false;
    }


}

你可能感兴趣的:(WEB安全(漏洞),sql,java,数据库)