# CVE-2024-38513: Fiber Session Middleware Token Injection Vulnerability

> Attackers can inject session IDs in GoFiber, enabling session fixation and unauthorized access if server-side validation is missing.

- **Severity:** Critical 10.0 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 1 Jul 2024
- **Updated:** 2 Aug 2024
- **Also known as:** GHSA-98j2-3j3p-fw2v, GO-2024-2959

## What is CVE-2024-38513?

CVE-2024-38513 is a critical authentication bypass vulnerability in gofiber fiber, published on 1 Jul 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

Fiber is an Express-inspired web framework written in Go A vulnerability present in versions prior to 2.52.5 is a session middleware issue in GoFiber versions 2 and above. This vulnerability allows users to supply their own session_id value, resulting in the creation of a session with that key. If a website relies on the mere presence of a session for security purposes, this can lead to significant security risks, including unauthorized access and session fixation attacks. All users utilizing GoFiber's session middleware in the affected versions are impacted. The issue has been addressed in version 2.52.5. Users are strongly encouraged to upgrade to version 2.52.5 or higher to mitigate this vulnerability. Users who are unable to upgrade immediately can apply the following workarounds to reduce the risk: Either implement additional validation to ensure session IDs are not supplied by the user and are securely generated by the server, or regularly rotate session IDs and enforce strict session expiration policies.

Weakness: CWE-384 (Session Fixation)

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

8 open source packages ship an affected version, including github.com/gofiber/fiber, github.com/gofiber/fiber/v2 and github.com/gofiber/fiber/v2/middleware/session. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/gofiber/fiber` | Go | All versions | None |
| `github.com/gofiber/fiber` | Go | All versions | 2.52.5 |
| `github.com/gofiber/fiber` | Go | All versions | 2.52.5 |
| `github.com/gofiber/fiber/v2` | Go | All versions | 2.52.5 |
| `github.com/gofiber/fiber/v2` | Go | All versions | 2.52.5 |
| `github.com/gofiber/fiber/v2` | Go | All versions | 2.52.5 |
| `github.com/gofiber/fiber/v2/middleware/session` | Go | All versions | 2.52.5 |
| `github.com/gofiber/fiber/v2/middleware/session` | Go | All versions | 2.52.5 |

Products: Gofiber Fiber.

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

Upgrade github.com/gofiber/fiber to 2.52.5 or later.

## Is CVE-2024-38513 being exploited?

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

## Other vulnerabilities in gofiber fiber

- [CVE-2023-45128](https://insights.sbomify.com/CVE-2023-45128/): CSRF Token Reuse Vulnerability in fiber (critical 10.0)
- [CVE-2024-25124](https://insights.sbomify.com/CVE-2024-25124/): Fiber has Insecure CORS Configuration, Allowing Wildcard Origin with Credentials (critical 9.4)
- [CVE-2025-66630](https://insights.sbomify.com/CVE-2025-66630/): Fiber insecurely fallsback in utils.UUIDv4() / utils.UUID() — predictable / zero‑UUID on crypto/rand failure (critical 9.2)
- [CVE-2025-54801](https://insights.sbomify.com/CVE-2025-54801/): Fiber Susceptible to Crash via `BodyParser` Due to Unvalidated Large Slice Index in Decoder (high 8.7)
- [CVE-2023-45141](https://insights.sbomify.com/CVE-2023-45141/): CSRF Token Validation Vulnerability in fiber (high 8.6)

## Fix prompt for AI coding agents

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

What it is: CVE-2024-38513 is a critical authentication bypass vulnerability in gofiber fiber, published on 1 Jul 2024. 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-2024-38513 in the wild and no public exploit code.

Affected packages and fixed versions:
- github.com/gofiber/fiber (Go): affected all versions; no fix listed
- github.com/gofiber/fiber (Go): affected all versions; fixed in 2.52.5
- github.com/gofiber/fiber (Go): affected all versions; fixed in 2.52.5
- github.com/gofiber/fiber/v2 (Go): affected all versions; fixed in 2.52.5
- github.com/gofiber/fiber/v2 (Go): affected all versions; fixed in 2.52.5
- github.com/gofiber/fiber/v2 (Go): affected all versions; fixed in 2.52.5
- github.com/gofiber/fiber/v2/middleware/session (Go): affected all versions; fixed in 2.52.5
- github.com/gofiber/fiber/v2/middleware/session (Go): affected all versions; fixed in 2.52.5

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

## Sources

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

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