服务器:基本的安全优化

  • SQL注入
    SQL注入漏洞可使用SQLMAP进行排查。
    解决方法:使用预编译语句,对于不得不使用${}的,例如排序字段,要进行检查

  • SQL语句泄露
    常出现在参数错误的时候,未对SQL类型的错误进行拦截。
    拦截sql异常,避免一直向上抛

  • 服务器版本泄露
    修改web容器的配置,例如Tomcat,修改Tomcat的配置文件。

  • 框架版本漏洞

  • 不必要的HTTP方法
    可从web.xml配置

<security-constraint>
	<web-resource-collection>
		<web-resource-name>restricted</web-resource-name>
       		<url-pattern>/*</url-pattern>
           	<http-method>PUT</http-method>
          	<http-method>DELETE</http-method>
           	<http-method>HEAD</http-method>
           	<http-method>OPTIONS</http-method>
           	<http-method>TRACE</http-method>
		</web-resource-collection>
		<auth-constraint></auth-constraint>
</security-constraint>
  • web.xml泄露
    在web.xml中配置拦截
<security-constraint>
	<web-resource-collection>
		<web-resource-name>webinf</web-resource-name>
		<url-pattern>/WEB-INF./*</url-pattern>
	</web-resource-collection>
	<auth-constraint></auth-constraint>
</security-constraint>
发布了21 篇原创文章 · 获赞 6 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/SudaDays/article/details/86490528