CVE-2023-29019:Session fixation vulnerability in @fastify/passport allows attackers to hijack authenticated sessions.

splash
Back

Description Preview

@fastify/passport, a port of the passport authentication library for Fastify, contains a session fixation vulnerability when used with @fastify/session. The vulnerability exists because the sessionId is preserved between pre-login and authenticated sessions. This allows attackers to set a known sessionId cookie in a victim's browser and gain access to the victim's authenticated session after they log in. The issue affects applications that use @fastify/passport for authentication combined with @fastify/session for session management.

Overview

The vulnerability (CVE-2023-29019) in @fastify/passport is a session fixation issue (CWE-384) that occurs because the library fails to regenerate session IDs during the authentication process. When a user logs in, the same sessionId used before authentication remains active after successful authentication. This allows attackers to perform session fixation attacks by planting a known sessionId in the victim's browser (through various attack vectors) and waiting for the victim to authenticate. Once authenticated, the attacker can use the known sessionId to access the victim's authenticated session, effectively bypassing authentication controls and impersonating the victim.

Remediation

To address this vulnerability, users should:

  1. Upgrade to a patched version of @fastify/passport that regenerates sessionId upon successful authentication.
  2. Apply the patch referenced in commit 43c82c321db58ea3e375dd475de60befbfcf2a11 if upgrading is not immediately possible.
  3. Implement additional security measures such as:
    • Validating user IP addresses during sessions
    • Implementing shorter session timeouts
    • Adding additional authentication factors for sensitive operations

There are no known workarounds for this vulnerability other than upgrading to a patched version.

References

  1. Patch: https://github.com/fastify/fastify-passport/commit/43c82c321db58ea3e375dd475de60befbfcf2a11
  2. Vendor Advisory: https://github.com/fastify/fastify-passport/security/advisories/GHSA-4m3m-ppvx-xgw9
  3. Technical Description of Session Fixation: https://owasp.org/www-community/attacks/Session_fixation

Industry ExposureMost to least
This section illustrates the prevalence of a specific Common Vulnerabilities and Exposures (CVE) across various industries based on customer reports. The ranking displays industries from the most to least affected by this particular vulnerability, offering valuable insight into where this CVE has been most frequently observed. This information can help organizations within these sectors prioritize their security efforts, understand their relative risk exposure compared to their peers, and focus remediation strategies where they are most needed. By understanding the industry-specific impact, organizations can make more informed decisions regarding patching, resource allocation, and overall risk management related to this CVE.

  1. Educational Services: Low
    Educational Services
  2. Accommodation & Food Services: Low
    Accommodation & Food Services
  3. Administrative, Support, Waste Management & Remediation Services: Low
    Administrative, Support, Waste Management & Remediation Services
  4. Agriculture, Forestry Fishing & Hunting: Low
    Agriculture, Forestry Fishing & Hunting
  5. Arts, Entertainment & Recreation: Low
    Arts, Entertainment & Recreation
  6. Construction: Low
    Construction
  7. Finance and Insurance: Low
    Finance and Insurance
  8. Health Care & Social Assistance: Low
    Health Care & Social Assistance
  9. Information: Low
    Information
  10. Management of Companies & Enterprises: Low
    Management of Companies & Enterprises
  11. Manufacturing: Low
    Manufacturing
  12. Mining: Low
    Mining
  13. Other Services (except Public Administration): Low
    Other Services (except Public Administration)
  14. Professional, Scientific, & Technical Services: Low
    Professional, Scientific, & Technical Services
  15. Public Administration: Low
    Public Administration
  16. Real Estate Rental & Leasing: Low
    Real Estate Rental & Leasing
  17. Retail Trade: Low
    Retail Trade
  18. Transportation & Warehousing: Low
    Transportation & Warehousing
  19. Utilities: Low
    Utilities
  20. Wholesale Trade: Low
    Wholesale Trade

Focus on What Matters

  1. See Everything.
  2. Identify True Risk.
  3. Proactively Mitigate Threats.

Let's talk!

background