# CVE-2023-36820: micronaut security has invalid IdTokenClaimsValidator logic on aud

> Attackers can bypass audience validation in Micronaut Security, allowing unauthorized access when multiple applications share an OIDC issuer.

- **Severity:** Medium 4.8 (`CVSS:3.1/AV:N/AC:H/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:** 9 Oct 2023
- **Updated:** 19 Sep 2024
- **Also known as:** GHSA-qw22-8w9r-864h

## What is CVE-2023-36820?

CVE-2023-36820 is a medium-severity authentication bypass vulnerability in micronaut-projects micronaut-security, published on 9 Oct 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

Micronaut Security is a security solution for applications. Prior to versions 3.1.2, 3.2.4, 3.3.2, 3.4.3, 3.5.3, 3.6.6, 3.7.4, 3.8.4, 3.9.6, 3.10.2, and 3.11.1, IdTokenClaimsValidator skips `aud` claim validation if token is issued by same identity issuer/provider. Any OIDC setup using Micronaut where multiple OIDC applications exists for the same issuer but token auth are not meant to be shared. This issue has been patched in versions 3.1.2, 3.2.4, 3.3.2, 3.4.3, 3.5.3, 3.6.6, 3.7.4, 3.8.4, 3.9.6, 3.10.2, and 3.11.1.

Weakness: CWE-284 (Improper Access Control)

## Which versions are affected by CVE-2023-36820?

22 open source packages ship an affected version, including io.micronaut.security:micronaut-security-oauth2. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `io.micronaut.security:micronaut-security-oauth2` | Maven | From 3.1.0 | 3.1.2 |
| `io.micronaut.security:micronaut-security-oauth2` | Maven | From 3.1.0 | 3.1.2 |
| `io.micronaut.security:micronaut-security-oauth2` | Maven | From 3.10.0 | 3.10.2 |
| `io.micronaut.security:micronaut-security-oauth2` | Maven | From 3.10.0 | 3.10.2 |
| `io.micronaut.security:micronaut-security-oauth2` | Maven | From 3.11.0 | 3.11.1 |
| `io.micronaut.security:micronaut-security-oauth2` | Maven | From 3.11.0 | 3.11.1 |
| `io.micronaut.security:micronaut-security-oauth2` | Maven | From 3.2.0 | 3.2.4 |
| `io.micronaut.security:micronaut-security-oauth2` | Maven | From 3.2.0 | 3.2.4 |
| `io.micronaut.security:micronaut-security-oauth2` | Maven | From 3.3.0 | 3.3.2 |
| `io.micronaut.security:micronaut-security-oauth2` | Maven | From 3.3.0 | 3.3.2 |
| `io.micronaut.security:micronaut-security-oauth2` | Maven | From 3.4.0 | 3.4.3 |
| `io.micronaut.security:micronaut-security-oauth2` | Maven | From 3.4.0 | 3.4.3 |
| `io.micronaut.security:micronaut-security-oauth2` | Maven | From 3.5.0 | 3.5.3 |
| `io.micronaut.security:micronaut-security-oauth2` | Maven | From 3.5.0 | 3.5.3 |
| `io.micronaut.security:micronaut-security-oauth2` | Maven | From 3.6.0 | 3.6.6 |
| `io.micronaut.security:micronaut-security-oauth2` | Maven | From 3.6.0 | 3.6.6 |
| `io.micronaut.security:micronaut-security-oauth2` | Maven | From 3.7.0 | 3.7.4 |
| `io.micronaut.security:micronaut-security-oauth2` | Maven | From 3.7.0 | 3.7.4 |
| `io.micronaut.security:micronaut-security-oauth2` | Maven | From 3.8.0 | 3.8.4 |
| `io.micronaut.security:micronaut-security-oauth2` | Maven | From 3.8.0 | 3.8.4 |
| `io.micronaut.security:micronaut-security-oauth2` | Maven | From 3.9.0 | 3.9.6 |
| `io.micronaut.security:micronaut-security-oauth2` | Maven | From 3.9.0 | 3.9.6 |

Products: Objectcomputing Micronaut Security.

## How do I fix CVE-2023-36820?

Upgrade io.micronaut.security:micronaut-security-oauth2 to a fixed version for your release line: 3.1.2, 3.10.2, 3.11.1 or 3.2.4.

## Is CVE-2023-36820 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2023-36820 exists.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2023-36820 and fix it if it is affected.

What it is: CVE-2023-36820 is a medium-severity authentication bypass vulnerability in micronaut-projects micronaut-security, published on 9 Oct 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2023-36820 exists.

Affected packages and fixed versions:
- io.micronaut.security:micronaut-security-oauth2 (Maven): affected from 3.1.0; fixed in 3.1.2
- io.micronaut.security:micronaut-security-oauth2 (Maven): affected from 3.1.0; fixed in 3.1.2
- io.micronaut.security:micronaut-security-oauth2 (Maven): affected from 3.10.0; fixed in 3.10.2
- io.micronaut.security:micronaut-security-oauth2 (Maven): affected from 3.10.0; fixed in 3.10.2
- io.micronaut.security:micronaut-security-oauth2 (Maven): affected from 3.11.0; fixed in 3.11.1
- io.micronaut.security:micronaut-security-oauth2 (Maven): affected from 3.11.0; fixed in 3.11.1
- io.micronaut.security:micronaut-security-oauth2 (Maven): affected from 3.2.0; fixed in 3.2.4
- io.micronaut.security:micronaut-security-oauth2 (Maven): affected from 3.2.0; fixed in 3.2.4
- io.micronaut.security:micronaut-security-oauth2 (Maven): affected from 3.3.0; fixed in 3.3.2
- io.micronaut.security:micronaut-security-oauth2 (Maven): affected from 3.3.0; fixed in 3.3.2
- io.micronaut.security:micronaut-security-oauth2 (Maven): affected from 3.4.0; fixed in 3.4.3
- io.micronaut.security:micronaut-security-oauth2 (Maven): affected from 3.4.0; fixed in 3.4.3

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

## Sources

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

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