# CVE-2024-51744: Bad documentation of error handling in ParseWithClaims can lead to potentially dangerous situations in golang-jwt

> Developers using golang-jwt may accept invalid tokens if they only check for expiration errors, bypassing signature validation.

- **Severity:** Low 3.1 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:N/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 4 Nov 2024
- **Updated:** 5 Nov 2024
- **Also known as:** AZL-52171, AZL-52174, AZL-52180, AZL-52183, AZL-52186, AZL-52189, AZL-52192, AZL-52195, AZL-52198, AZL-52201, AZL-52204, AZL-52207, AZL-52210, AZL-52213, AZL-52216, AZL-52219, AZL-52221, AZL-52224, AZL-52227, AZL-52230, AZL-52233, AZL-52236, AZL-52239, AZL-52242, AZL-52248, AZL-52251, AZL-52254, AZL-52257, AZL-52260, AZL-52265, AZL-52266, AZL-52272, AZL-52275, AZL-52278, CLEANSTART-2026-MU61112, CLEANSTART-2026-PD51287, DEBIAN-CVE-2024-51744, GHSA-29wx-vh33-7x7r, GO-2024-3250, MINI-28qc-3m8m-v3jm, MINI-2r3g-gmqh-pmpq, MINI-4vph-2w8r-27fp, MINI-58cf-qrx4-9v85, MINI-63qw-vxrr-7x5h, MINI-94m5-fqgw-p39w, MINI-9hmx-gm2v-96hp, MINI-9v7c-3j3x-37rh, MINI-fcrx-237f-h3vh, MINI-fr6m-65p5-ch28, MINI-jpj5-p3q7-j46v, MINI-m9j4-8m5p-4rhr, MINI-mrqp-v8vq-2896, MINI-px78-qjpx-4x5m, MINI-qq3r-jqw2-4qfv, MINI-r8r9-cgr2-pwm4, MINI-rvwm-cjjj-3wxg, MINI-v54r-2xhg-87j9, MINI-v7h7-38j8-8vvx, MINI-whc4-r64w-2hw4, SUSE-SU-2025:0546-1, UBUNTU-CVE-2024-51744, openSUSE-SU-2024:14481-1, openSUSE-SU-2024:14484-1, openSUSE-SU-2024:14495-1, openSUSE-SU-2024:14517-1, openSUSE-SU-2024:14522-1, openSUSE-SU-2025:0131-1, openSUSE-SU-2025:14768-1

## What is CVE-2024-51744?

CVE-2024-51744 is a low-severity authentication bypass vulnerability in golang-jwt jwt, published on 4 Nov 2024. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

golang-jwt is a Go implementation of JSON Web Tokens. Unclear documentation of the error behavior in `ParseWithClaims` can lead to situation where users are potentially not checking errors in the way they should be. Especially, if a token is both expired and invalid, the errors returned by `ParseWithClaims` return both error codes. If users only check for the `jwt.ErrTokenExpired ` using `error.Is`, they will ignore the embedded `jwt.ErrTokenSignatureInvalid` and thus potentially accept invalid tokens. A fix has been back-ported with the error handling logic from the `v5` branch to the `v4` branch. In this logic, the `ParseWithClaims` function will immediately return in "dangerous" situations (e.g., an invalid signature), limiting the combined errors only to situations where the signature is valid, but further validation failed (e.g., if the signature is valid, but is expired AND has the wrong audience). This fix is part of the 4.5.1 release. We are aware that this changes the behaviour of an established function and is not 100 % backwards compatible, so updating to 4.5.1 might break your code. In case you cannot update to 4.5.0, please make sure that you are properly checking for all errors ("dangerous" ones first), so that you are not running in the case detailed above.

Weakness: CWE-755 (Improper Handling of Exceptional Conditions)

## Which versions are affected by CVE-2024-51744?

3 open source packages ship an affected version, including github.com/golang-jwt/jwt/v4.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/golang-jwt/jwt/v4` | Go | All versions | 4.5.1 |
| `github.com/golang-jwt/jwt/v4` | Go | All versions | 4.5.1 |
| `github.com/golang-jwt/jwt/v4` | Go | All versions | 4.5.1 |
| `golang-github-prometheus-prometheus` | SUSE:Linux Enterprise Module for Package Hub 15 SP6 | All versions | 2.53.3-150100.4.23.1 |
| `golang-github-prometheus-prometheus` | SUSE:Manager Proxy Module 4.3 | All versions | 2.53.3-150100.4.23.1 |
| `coredns` | SUSE:Package Hub 15 SP6 | All versions | 1.12.1-bp156.4.6.5 |
| `coredns` | openSUSE:Leap 15.6 | All versions | 1.12.1-bp156.4.6.5 |
| `golang-github-prometheus-prometheus` | openSUSE:Leap 15.6 | All versions | 2.53.3-150100.4.23.1 |
| `coredns` | openSUSE:Tumbleweed | All versions | 1.11.3+git129.387f34d-1.1 |
| `govulncheck-vulndb` | openSUSE:Tumbleweed | All versions | 0.0.20241112T145010-1.1 |
| `grafana` | openSUSE:Tumbleweed | All versions | 11.5.1-1.1 |
| `rclone` | openSUSE:Tumbleweed | All versions | 1.68.1-2.1 |
| `traefik` | openSUSE:Tumbleweed | All versions | 3.2.1-1.1 |
| `traefik2` | openSUSE:Tumbleweed | All versions | 2.11.14-1.1 |

## How do I fix CVE-2024-51744?

Upgrade github.com/golang-jwt/jwt/v4 to 4.5.1 or later.

## Is CVE-2024-51744 being exploited?

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

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-51744 and fix it if it is affected.

What it is: CVE-2024-51744 is a low-severity authentication bypass vulnerability in golang-jwt jwt, published on 4 Nov 2024. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2024-51744 in the wild and no public exploit code.

Affected packages and fixed versions:
- github.com/golang-jwt/jwt/v4 (Go): affected all versions; fixed in 4.5.1
- github.com/golang-jwt/jwt/v4 (Go): affected all versions; fixed in 4.5.1
- github.com/golang-jwt/jwt/v4 (Go): affected all versions; fixed in 4.5.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-2024-51744/ (Markdown: https://insights.sbomify.com/CVE-2024-51744/index.md)
```

## Sources

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

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