spring - jar 如何在使用它的 Web 应用程序中传播漏洞?

我有一个受 Spring Security 保护的 Spring MVC Web 应用程序。生活似乎如此平静,直到我被迫进行静态应用程序安全测试 (SAST) 并且该工具引发了一堆安全问题。看看这里:

我浏览了所有 CVE,并大致了解了这些漏洞。我有几个疑问:

  1. 当 Web 应用程序与 (Spring Security) 等安全框架集成时,它如何容易受到此类攻击?

  2. 我可以忽略所有这些漏洞,因为 Spring Security 可能对所有这些漏洞都有某种解决方法吗?

最佳答案

来自 Spring Security manual :

Spring Security is a powerful and highly customizable authentication and access-control framework. It is the de-facto standard for securing Spring-based applications.

将 Spring Security 视为一个身份验证框架,它涵盖了安全难题的一部分。

作为一个例子,让我们看一下 OWASP 十大应用程序安全风险中的#1:A1 - 注入(inject)
假设您使用 jar 来访问 SQL 数据库(例如 hibernate)并且它具有注入(inject)漏洞,那么您的应用程序也可能存在漏洞。然而,即使 hibernate 没有任何安全漏洞,如果程序员在没有正确转义用户输入的情况下将 SQL 查询连接在一起,则应用程序很容易受到注入(inject)攻击。
Spring security 不会保护您的应用程序免受这些注入(inject)攻击。

如果 jar 存在漏洞并且您正在调用易受攻击的方法/功能,那么您的应用程序也可能存在该漏洞,这在很大程度上取决于漏洞是什么以及其执行方式以及您的应用程序如何配置为使用该 jar .

为了快速浏览另一个 OWASP Top 10 Application Security Risks :
A1-Injection - 没有 Spring Security 的保护
A2-Broken 身份验证和 session 管理 - Spring Security 可以帮助管理其中的一些,但是未配置的 Spring Security 会暴露这些。
A3-Cross-Site Scripting (XSS) - 没有 Spring Security 的保护
A4-不安全的直接对象引用 - 没有来自 Spring Security 的额外保护(Spring Security 为您提供了管理此问题的工具)
A5-Security Misconfiguration - Spring Security 没有保护
A6 敏感数据暴露 - Spring Security 可以帮助解决这个问题,但它也很大程度上取决于您如何存储和管理数据(例如日志文件)
A7-Missing Function Level Access Control - 如果错过了访问控制,Spring Security 帮不了你,但是 Spring Security 可以很容易地添加这些
A8-Cross-Site Request Forgery (CSRF) - Spring Security(取决于您的应用程序的配置方式)将为您提供帮助,甚至为您管理此风险。
A9-使用具有已知漏洞的组件 - 这是您在问题中列出的 CVE - Spring Security 没有保护
A10-未经验证的重定向和转发 - Spring Security 可用于管理此问题,但它不能立即保护您的应用程序免受此问题的影响

在您的应用程序的 STAT 期间发现的 CVE 列表是 A9-使用具有已知漏洞的组件的示例,请查看 OWASP wiki for more information .

Example Attack Scenarios

Component vulnerabilities can cause almost any type of risk imaginable, ranging from the trivial to sophisticated malware designed to target a specific organization. Components almost always run with the full privilege of the application, so flaws in any component can be serious, The following two vulnerable components were downloaded 22m times in 2011.

  • Apache CXF Authentication Bypass – By failing to provide an identity token, attackers could invoke any web service with full permission. (Apache CXF is a services framework, not to be confused with the Apache Application Server.)
  • Spring Remote Code Execution – Abuse of the Expression Language implementation in Spring allowed attackers to execute arbitrary code, effectively taking over the server.

Every application using either of these vulnerable libraries is vulnerable to attack as both of these components are directly accessible by application users. Other vulnerable libraries, used deeper in an application, may be harder to exploit.

请注意上面最后一段,组件(jar)越深,就越难利用,但这并不意味着确定的实体不能利用它们。

总之,Spring Security 是管理应用程序中的身份验证和访问控制的绝佳工具,但它并不是解决所有安全问题的 Elixir 。

https://stackoverflow.com/questions/46707284/

相关文章:

spring - 如何在运行时将新用户添加到 Spring Security

java - Spring WS : How to get and save XSD validat

java - 在 Spring Hibernate java 项目中使用 "Envers"审计表

java - Spring Security 3 - 总是返回错误 302

java - Spring MVC : Resolving the view based on Us

java - Spring Integration Kafka Consumer Listener

java - spring mvc 表单 :select tag

java - 使用 Spring JavaConfig 和 @Autowired 注入(inject

java - 使用具有不同 AuthenticationProviders 的多个 WebSecur

java - 如何使用spring websocket向自定义用户发送自定义消息?