10.0critical
CSRF Token Reuse Vulnerability in fiber
- Severity
- 10.0critical CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.36% (higher than 32% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-94w9-97p3-p368GO-2023-2115
Description
Fiber is an express inspired web framework written in Go. A Cross-Site Request Forgery (CSRF) vulnerability has been identified in the application, which allows an attacker to inject arbitrary values and forge malicious requests on behalf of a user. This vulnerability can allow an attacker to inject arbitrary values without any authentication, or perform various malicious actions on behalf of an authenticated user, potentially compromising the security and integrity of the application. The vulnerability is caused by improper validation and enforcement of CSRF tokens within the application. This issue has been addressed in version 2.50.0 and users are advised to upgrade. Users should take additional security measures like captchas or Two-Factor Authentication (2FA) and set Session cookies with SameSite=Lax or SameSite=Secure, and the Secure and HttpOnly attributes as defense in depth measures. There are no known workarounds for this vulnerability.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| gofiber fiber | < 2.50.0, before 2.50.0 | CVE List, NVD |
| github.com/gofiber/fiber/v2 (Go) | before 2.50.0 | GitHub Advisory Database, Go Vulnerability Database |
All scores
| GitHub_M | 10.0critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:L |
| GitHub | 9.6critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:L |
| NVD | 8.8high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H |
Classification
What each source says
CVE List
Fiber is an express inspired web framework written in Go. A Cross-Site Request Forgery (CSRF) vulnerability has been identified in the application, which allows an attacker to inject arbitrary values and forge malicious requests on behalf of a user. This vulnerability can allow an attacker to inject arbitrary values without any authentication, or perform various malicious actions on behalf of an authenticated user, potentially compromising the security and integrity of the application. The vulnerability is caused by improper validation and enforcement of CSRF tokens within the application. This issue has been addressed in version 2.50.0 and users are advised to upgrade. Users should take additional security measures like captchas or Two-Factor Authentication (2FA) and set Session cookies with SameSite=Lax or SameSite=Secure, and the Secure and HttpOnly attributes as defense in depth measures. There are no known workarounds for this vulnerability.
GitHub Advisory Database
A Cross-Site Request Forgery (CSRF) vulnerability has been identified in the application, which allows an attacker to inject arbitrary values and forge malicious requests on behalf of a user. This vulnerability can allow an attacker to inject arbitrary values without any authentication, or perform various malicious actions on behalf of an authenticated user, potentially compromising the security and integrity of the application.
Vulnerability Details
The vulnerability is caused by improper validation and enforcement of CSRF tokens within the application. The following issues were identified:
-
Token Injection: For 'safe' methods, the token was extracted from the cookie and saved to storage without further validation or sanitization.
-
Lack of Token Association: The CSRF token was validated against tokens in storage but not associated with a session, nor by using a Double Submit Cookie Method, allowing for token reuse.
Specific Go Packages Affected
github.com/gofiber/fiber/v2/middleware/csrf
Remediation
To remediate this vulnerability, it is recommended to take the following actions:
-
Update the Application: Upgrade the application to a fixed version with a patch for the vulnerability.
-
Implement Proper CSRF Protection: Review the updated documentation and ensure your application's CSRF protection mechanisms follow best practices.
-
Choose CSRF Protection Method: Select the appropriate CSRF protection method based on your application's requirements, either the Double Submit Cookie method or the Synchronizer Token Pattern using sessions.
-
Security Testing: Conduct a thorough security assessment, including penetration testing, to identify and address any other security vulnerabilities.
Defence-in-depth
Users should take additional security measures like captchas or Two-Factor Authentication (2FA) and set Session cookies with SameSite=Lax or SameSite=Secure, and the Secure and HttpOnly attributes.
Go Vulnerability Database
A cross-site request forgery vulnerability in this package can allow an attacker to inject arbitrary values and forge malicious requests on behalf of a user. The attacker may inject arbitrary values without any authentication, or perform various malicious actions on behalf of an authenticated user, potentially compromising the security and integrity of the application.
The vulnerability is caused by improper validation and enforcement of CSRF tokens within the application. For 'safe' methods, the token is extracted from the cookie and saved to storage without further validation or sanitization. In addition, the CSRF token is validated against tokens in storage but not associated with a session, nor by using a Double Submit Cookie Method, allowing for token reuse.
NVD (es)
Fiber es un framework web inspirado en Express escrito en Go. Se ha identificado una vulnerabilidad de Cross-Site Request Forgery (CSRF) en la aplicación, que permite a un atacante inyectar valores arbitrarios y falsificar solicitudes maliciosas en nombre de un usuario. Esta vulnerabilidad puede permitir a un atacante inyectar valores arbitrarios sin ninguna autenticación o realizar diversas acciones maliciosas en nombre de un usuario autenticado, comprometiendo potencialmente la seguridad y la integridad de la aplicación. La vulnerabilidad se debe a una validación y aplicación inadecuadas de los tokens CSRF dentro de la aplicación. Este problema se solucionó en la versión 2.50.0 y se recomienda a los usuarios que actualicen. Los usuarios deben tomar medidas de seguridad adicionales como captchas o autenticación de dos factores (2FA) y configurar cookies de sesión con SameSite=Lax o SameSite=Secure, y los atributos Secure y HttpOnly como medidas de defensa en profundidad. No se conocen workarounds para esta vulnerabilidad.
References
| https://github.com/gofiber/fiber/security/advisories/GHSA-94w9-97p3-p368 | advisory, mitigation, vendor-advisory, web | |
| https://github.com/gofiber/fiber/commit/8c3916dbf4ad2ed427d02c6eb63ae8b2fa8f019a | fix, patch, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2023-45128 | advisory | |
| https://github.com/gofiber/fiber/commit/b50d91d58ecdff2a330bf07950244b6c4caf65b1 | fix, web | |
| https://github.com/gofiber/fiber | package | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2023-45128 changed 2024-09-16 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-94w9-97p3-p368 changed 2023-11-08 | CC-BY-4.0 |
| Go Vulnerability Database | GO-2023-2115 changed 2024-05-20 | CC-BY-4.0 |
| NVD | CVE-2023-45128 changed 2026-06-17 | Public domain |