# CVE-2019-3778: Open Redirect in spring-security-oauth2

> Attackers can exploit an open redirect in Spring Security OAuth to leak authorization codes, potentially leading to account takeover.

- **Severity:** Medium 6.5 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/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:** 7 Mar 2019
- **Updated:** 16 Sep 2024
- **Also known as:** GHSA-77rv-6vfw-x4gc

## What is CVE-2019-3778?

CVE-2019-3778 is a medium-severity vulnerability in Spring Security OAuth, published on 7 Mar 2019. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

Spring Security OAuth, versions 2.3 prior to 2.3.5, and 2.2 prior to 2.2.4, and 2.1 prior to 2.1.4, and 2.0 prior to 2.0.17, and older unsupported versions could be susceptible to an open redirector attack that can leak an authorization code. A malicious user or attacker can craft a request to the authorization endpoint using the authorization code grant type, and specify a manipulated redirection URI via the "redirect_uri" parameter. This can cause the authorization server to redirect the resource owner user-agent to a URI under the control of the attacker with the leaked authorization code. This vulnerability exposes applications that meet all of the following requirements: Act in the role of an Authorization Server (e.g. @EnableAuthorizationServer) and uses the DefaultRedirectResolver in the AuthorizationEndpoint. This vulnerability does not expose applications that: Act in the role of an Authorization Server and uses a different RedirectResolver implementation other than DefaultRedirectResolver, act in the role of a Resource Server only (e.g. @EnableResourceServer), act in the role of a Client only (e.g. @EnableOAuthClient).

Weakness: CWE-601 (URL Redirection to Untrusted Site)

## Which versions are affected by CVE-2019-3778?

16 open source packages ship an affected version, including org.springframework.security.oauth:spring-security-oauth and org.springframework.security.oauth:spring-security-oauth2. It affects 2 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `org.springframework.security.oauth:spring-security-oauth` | Maven | All versions | 2.0.17.RELEASE |
| `org.springframework.security.oauth:spring-security-oauth` | Maven | All versions | 2.0.17.RELEASE |
| `org.springframework.security.oauth:spring-security-oauth` | Maven | From 2.1.0.RELEASE | 2.1.4.RELEASE |
| `org.springframework.security.oauth:spring-security-oauth` | Maven | From 2.1.0.RELEASE | 2.1.4.RELEASE |
| `org.springframework.security.oauth:spring-security-oauth` | Maven | From 2.2.0.RELEASE | 2.2.4.RELEASE |
| `org.springframework.security.oauth:spring-security-oauth` | Maven | From 2.2.0.RELEASE | 2.2.4.RELEASE |
| `org.springframework.security.oauth:spring-security-oauth` | Maven | From 2.3.0.RELEASE | 2.3.5.RELEASE |
| `org.springframework.security.oauth:spring-security-oauth` | Maven | From 2.3.0.RELEASE | 2.3.5.RELEASE |
| `org.springframework.security.oauth:spring-security-oauth2` | Maven | All versions | 2.0.17.RELEASE |
| `org.springframework.security.oauth:spring-security-oauth2` | Maven | All versions | 2.0.17.RELEASE |
| `org.springframework.security.oauth:spring-security-oauth2` | Maven | From 2.1.0.RELEASE | 2.1.4.RELEASE |
| `org.springframework.security.oauth:spring-security-oauth2` | Maven | From 2.1.0.RELEASE | 2.1.4.RELEASE |
| `org.springframework.security.oauth:spring-security-oauth2` | Maven | From 2.2.0.RELEASE | 2.2.4.RELEASE |
| `org.springframework.security.oauth:spring-security-oauth2` | Maven | From 2.2.0.RELEASE | 2.2.4.RELEASE |
| `org.springframework.security.oauth:spring-security-oauth2` | Maven | From 2.3.0.RELEASE | 2.3.5.RELEASE |
| `org.springframework.security.oauth:spring-security-oauth2` | Maven | From 2.3.0.RELEASE | 2.3.5.RELEASE |

Products: Oracle Banking Corporate Lending, Pivotal Software Spring Security Oauth.

## How do I fix CVE-2019-3778?

Upgrade org.springframework.security.oauth:spring-security-oauth to a fixed version for your release line: 2.0.17.RELEASE, 2.1.4.RELEASE, 2.2.4.RELEASE or 2.3.5.RELEASE.

## Is CVE-2019-3778 being exploited?

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

Public exploit code:

- Spring Security OAuth - Open Redirector (exploitdb)
- Spring Security OAuth 2.3 Open Redirection  分析复现篇 (github_poc): https://github.com/BBB-man/CVE-2019-3778-Spring-Security-OAuth-2.3-Open-Redirection

## Other vulnerabilities in Spring Security OAuth

- [CVE-2018-2706](https://insights.sbomify.com/CVE-2018-2706/): Auth bypass in Banking Corporate Lending (high 8.8)
- [CVE-2018-3050](https://insights.sbomify.com/CVE-2018-3050/): Missing authorization in Banking Corporate Lending (high 8.1)
- [CVE-2018-2707](https://insights.sbomify.com/CVE-2018-2707/): Missing authorization in Banking Corporate Lending (high 8.1)
- [CVE-2020-2718](https://insights.sbomify.com/CVE-2020-2718/): Missing authorization in Banking Corporate Lending (high 7.1)
- [CVE-2018-2746](https://insights.sbomify.com/CVE-2018-2746/): Information disclosure in FLEXCUBE Universal Banking (high 7.1)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2019-3778 and fix it if it is affected.

What it is: CVE-2019-3778 is a medium-severity vulnerability in Spring Security OAuth, published on 7 Mar 2019. 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-2019-3778 in the wild and no public exploit code.

Affected packages and fixed versions:
- org.springframework.security.oauth:spring-security-oauth (Maven): affected all versions; fixed in 2.0.17.RELEASE
- org.springframework.security.oauth:spring-security-oauth (Maven): affected all versions; fixed in 2.0.17.RELEASE
- org.springframework.security.oauth:spring-security-oauth (Maven): affected from 2.1.0.RELEASE; fixed in 2.1.4.RELEASE
- org.springframework.security.oauth:spring-security-oauth (Maven): affected from 2.1.0.RELEASE; fixed in 2.1.4.RELEASE
- org.springframework.security.oauth:spring-security-oauth (Maven): affected from 2.2.0.RELEASE; fixed in 2.2.4.RELEASE
- org.springframework.security.oauth:spring-security-oauth (Maven): affected from 2.2.0.RELEASE; fixed in 2.2.4.RELEASE
- org.springframework.security.oauth:spring-security-oauth (Maven): affected from 2.3.0.RELEASE; fixed in 2.3.5.RELEASE
- org.springframework.security.oauth:spring-security-oauth (Maven): affected from 2.3.0.RELEASE; fixed in 2.3.5.RELEASE
- org.springframework.security.oauth:spring-security-oauth2 (Maven): affected all versions; fixed in 2.0.17.RELEASE
- org.springframework.security.oauth:spring-security-oauth2 (Maven): affected all versions; fixed in 2.0.17.RELEASE
- org.springframework.security.oauth:spring-security-oauth2 (Maven): affected from 2.1.0.RELEASE; fixed in 2.1.4.RELEASE
- org.springframework.security.oauth:spring-security-oauth2 (Maven): affected from 2.1.0.RELEASE; fixed in 2.1.4.RELEASE

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-2019-3778/ (Markdown: https://insights.sbomify.com/CVE-2019-3778/index.md)
```

## Sources

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

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