# CVE-2016-5007: Spring Security and Spring Framework may not recognize certain paths that should be protected

> Attackers can bypass Spring Security authorization checks by exploiting URL pattern matching discrepancies between Spring Security and Spring Framework.

- **Severity:** High 7.5 (`CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 25 May 2017
- **Updated:** 6 Aug 2024
- **Also known as:** CLSA-2026-1778028246, DEBIAN-CVE-2016-5007, GHSA-8crv-49fr-2h6j, OESA-2021-1416, ROOT-APP-MAVEN-CVE-2016-5007, UBUNTU-CVE-2016-5007

## What is CVE-2016-5007?

CVE-2016-5007 is a high-severity missing authorization vulnerability in Vmware Spring Framework, published on 25 May 2017. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

Both Spring Security 3.2.x, 4.0.x, 4.1.0 and the Spring Framework 3.2.x, 4.0.x, 4.1.x, 4.2.x rely on URL pattern mappings for authorization and for mapping requests to controllers respectively. Differences in the strictness of the pattern matching mechanisms, for example with regards to space trimming in path segments, can lead Spring Security to not recognize certain paths as not protected that are in fact mapped to Spring MVC controllers that should be protected. The problem is compounded by the fact that the Spring Framework provides richer features with regards to pattern matching as well as by the fact that pattern matching in each Spring Security and the Spring Framework can easily be customized creating additional differences.

Weakness: CWE-264

## Which versions are affected by CVE-2016-5007?

4 open source packages ship an affected version, including org.springframework.security:spring-security-core and org.springframework:spring-core. It affects 3 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `org.springframework.security:spring-security-core` | Maven | All versions | 4.1.1 |
| `org.springframework.security:spring-security-core` | Maven | All versions | 4.1.1 |
| `org.springframework:spring-core` | Maven | All versions | 4.3.1 |
| `org.springframework:spring-core` | Maven | All versions | 4.3.1 |

Products: Pivotal Software Spring Framework, Vmware Spring Framework, Vmware Spring Security.

## How do I fix CVE-2016-5007?

Upgrade org.springframework.security:spring-security-core to 4.1.1 or later.

## Is CVE-2016-5007 being exploited?

There is no known exploitation of CVE-2016-5007 in the wild and no public exploit code.

## Other vulnerabilities in Vmware Spring Framework

- [CVE-2014-0225](https://insights.sbomify.com/CVE-2014-0225/): Improper Restriction of XML External Entity Reference in Spring Framework (high 8.8)
- [CVE-2016-9878](https://insights.sbomify.com/CVE-2016-9878/): Pivotal Spring Framework Paths provided to the ResourceServlet were not properly sanitized (high 7.5)
- [CVE-2013-6429](https://insights.sbomify.com/CVE-2013-6429/): Cross-Site Request Forgery in Spring Framework (medium 6.8)
- [CVE-2013-6430](https://insights.sbomify.com/CVE-2013-6430/): Improper Neutralization of Input During Web Page Generation in Spring Framework (medium 5.4)
- [CVE-2015-0201](https://insights.sbomify.com/CVE-2015-0201/): Moderate severity vulnerability that affects org.springframework:spring-core (medium 5.0)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2016-5007 and fix it if it is affected.

What it is: CVE-2016-5007 is a high-severity missing authorization vulnerability in Vmware Spring Framework, published on 25 May 2017. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2016-5007 in the wild and no public exploit code.

Affected packages and fixed versions:
- org.springframework.security:spring-security-core (Maven): affected all versions; fixed in 4.1.1
- org.springframework.security:spring-security-core (Maven): affected all versions; fixed in 4.1.1
- org.springframework:spring-core (Maven): affected all versions; fixed in 4.3.1
- org.springframework:spring-core (Maven): affected all versions; fixed in 4.3.1

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2016-5007/ (Markdown: https://insights.sbomify.com/CVE-2016-5007/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2016-5007
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2016-5007
- OSV: https://osv.dev/vulnerability/CVE-2016-5007

---
From sbomify Insights: https://insights.sbomify.com/CVE-2016-5007/
Summaries are generated and may contain mistakes; the official description above is the record.
