CVE-2024-29886: Serverpod auth server Serverpod Improved Security For Stored Vulnerability

MODERATE
Advisory Identifier: GHSA-r75m-26cq-mjxc
CVSS 5.3
CWE-916
Published
Advisory Summary

CVE-2024-29886 is a MODERATE (CVSS 5.3) serverpod improved security for stored vulnerability (CWE-916: Use of Password Hash With Insufficient Computational Effort) affecting Serverpod auth server libraries in the Pub ecosystem. The issue involves serverpod improved security for stored password hashes. Remediation is available by upgrading affected packages to version 1.2.6.

CVE-2024-29886 at a Glance

CVE Identifier CVE-2024-29886
GHSA Identifier GHSA-r75m-26cq-mjxc
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-916: Use of Password Hash With Insufficient Computational Effort
Affected Product Serverpod auth server
Package Ecosystem Pub
Published Date
Last Updated

Security Impact

CVSS: 5.3

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2024-29886

To remediate this vulnerability, upgrade all affected Serverpod auth server dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

serverpod_auth_server fixed: 1.2.6
Upgrade serverpod_auth_server to 1.2.6
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for serverpod_auth_server

How to Check if You Are Affected

To determine whether your application is affected by CVE-2024-29886, inspect your project dependencies for Serverpod auth server:

inspect dependencies for serverpod_auth_server

Analyze the terminal output to locate any version of Serverpod auth server in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.2.6), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-916: Use of Password Hash With Insufficient Computational Effort, where the product generates a hash for a password, but it uses a scheme that does not provide a sufficient level of computational effort that would make password cracking attacks infeasible or expensive. In Serverpod auth server, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## Description ### Improved security for stored password hashes Serverpod now uses the OWASP, [source](https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html#introduction), recommended Argon2Id password hash algorithm to store password hashes for the email authentication module. Starting from Serverpod `1.2.6` all users that either creates an account or authenticates with the server will have their password stored using the safer algorithm. No changes are required from the developer to start storing passwords using the safer algorithm. ### Why did we change how passwords are stored? An issue was identified with the old password hash algorithm that made it susceptible to rainbow attacks if the database was compromised. It is strongly recommended to migrate your existing password hashes. ### Migrate existing password hashes The email authentication module provides a helper method to migrate all the existing legacy password hashes in the database. Simply call `Emails.migrateLegacyPasswordHashes(...)` with a session instance as an argument to migrate the password hashes. The method is implemented as an idempotent operation and will yield the same result regardless of how many times it is called. We recommend either implementing a web server route that can be called remotely or by calling the method as part of starting the server. Following is example code for implementing a web server route. <details><summary><h4>Web server route code</h4></summary> ```dart import 'dart:io'; import 'package:serverpod/serverpod.dart'; import 'package:serverpod_auth_server/module.dart' as auth; class MigratePasswordsRoute extends Route { @override Future<bool> handleCall(Session session, HttpRequest request) async { request.response.writeln( 'Migrating legacy passwords, check the server logs for progress updates.', ); _migratePasswords(session); return true; } } Future<void> _migratePasswords(Session session) async { session.log('Starting to migrate passwords.'); var totalMigratedPasswords = 0; while (true) { try { var entriesMigrated = await auth.Emails.migrateLegacyPasswordHashes( session, // Process 100 database entries at a time batchSize: 100, // Stop after 500 entries have been migrated maxMigratedEntries: 500, ); totalMigratedPasswords += entriesMigrated; session.log( 'Migrated $entriesMigrated password entries, total $totalMigratedPasswords.', ); if (entriesMigrated == 0) break; // Delay to avoid overloading the database await Future.delayed(Duration(seconds: 1)); } catch (e) { session.log('Error migrating passwords: $e'); } } session.log('Finished migrating passwords.'); } ``` </details> ### How we migrate existing password hashes Since password hashes can’t be recalculated without knowledge of the plain text password, the method in the email authentication module applies the new algorithm to the already stored password hashes. When the affected users later authenticate, their password hash will be calculated using both algorithms in tandem. If the authentication is accepted, the stored password hash will be updated to only use the new algorithm so that further authentication only needs to run the new algorithm. ### Impact All versions of `serverpod_auth_server` pre `1.2.6` ### Patches Upgrading to version `1.2.6` resolves this issue.

CVE-2024-29886 Affected Serverpod auth server Versions

1 component(s)
Fixed Versions:
1.2.6
Product / Package Ecosystem Affected Versions Fixed Version
serverpod_auth_server
Pub
< 1.2.6
1.2.6

References

Frequently Asked Questions

What is CVE-2024-29886?
CVE-2024-29886 is a security vulnerability in Serverpod auth server involving Serverpod improved security for stored password hashes under CWE-916: Use of Password Hash With Insufficient Computational Effort.
Which Serverpod auth server versions are affected?
Affected versions include releases prior to 1.2.6 across affected packages: serverpod_auth_server.
What version fixes CVE-2024-29886?
Upgrading to 1.2.6 (or the latest patched release for your respective branch) resolves the vulnerability.
Is serverpod_auth_server affected?
Yes, serverpod_auth_server is affected in releases prior to 1.2.6. Upgrade your dependency to 1.2.6 or later.
What is the CVSS score of CVE-2024-29886?
CVE-2024-29886 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N.
What CWE is associated with CVE-2024-29886?
CVE-2024-29886 is classified under CWE-916: Use of Password Hash With Insufficient Computational Effort (The product generates a hash for a password, but it uses a scheme that does not provide a sufficient level of computational effort that would make password cracking attacks infeasible or expensive.).
How can I check Pub dependencies for CVE-2024-29886?
Run the dependency tree command: 'inspect dependencies for serverpod_auth_server'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-r75m-26cq-mjxc",
  "modified" : "2024-03-28T17:53:42Z",
  "published" : "2024-03-28T17:53:42Z",
  "aliases" : [ "CVE-2024-29886" ],
  "summary" : "Serverpod improved security for stored password hashes",
  "details" : "## Description\n\n### Improved security for stored password hashes\nServerpod now uses the OWASP, [source](https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html#introduction), recommended Argon2Id password hash algorithm to store password hashes for the email authentication module.\n\nStarting from Serverpod `1.2.6` all users that either creates an account or authenticates with the server will have their password stored using the safer algorithm. No changes are required from the developer to start storing passwords using the safer algorithm.\n\n### Why did we change how passwords are stored?\nAn issue was identified with the old password hash algorithm that made it susceptible to rainbow attacks if the database was compromised.\n\nIt is strongly recommended to migrate your existing password hashes.\n\n### Migrate existing password hashes\nThe email authentication module provides a helper method to migrate all the existing legacy password hashes in the database. Simply call  `Emails.migrateLegacyPasswordHashes(...)` with a session instance as an argument to migrate the password hashes.\n\nThe method is implemented as an idempotent operation and will yield the same result regardless of how many times it is called.\n\nWe recommend either implementing a web server route that can be called remotely or by calling the method as part of starting the server.\n\nFollowing is example code for implementing a web server route.\n\n<details><summary><h4>Web server route code</h4></summary>\n\n```dart\nimport 'dart:io';\n\nimport 'package:serverpod/serverpod.dart';\nimport 'package:serverpod_auth_server/module.dart' as auth;\n\nclass MigratePasswordsRoute extends Route {\n  @override\n  Future<bool> handleCall(Session session, HttpRequest request) async {\n    request.response.writeln(\n      'Migrating legacy passwords, check the server logs for progress updates.',\n    );\n    _migratePasswords(session);\n    return true;\n  }\n}\n\nFuture<void> _migratePasswords(Session session) async {\n  session.log('Starting to migrate passwords.');\n\n  var totalMigratedPasswords = 0;\n  while (true) {\n    try {\n      var entriesMigrated = await auth.Emails.migrateLegacyPasswordHashes(\n        session,\n        // Process 100 database entries at a time\n        batchSize: 100,\n        // Stop after 500 entries have been migrated\n        maxMigratedEntries: 500,\n      );\n\n      totalMigratedPasswords += entriesMigrated;\n      session.log(\n        'Migrated $entriesMigrated password entries, total $totalMigratedPasswords.',\n      );\n\n      if (entriesMigrated == 0) break;\n\n      // Delay to avoid overloading the database\n      await Future.delayed(Duration(seconds: 1));\n    } catch (e) {\n      session.log('Error migrating passwords: $e');\n    }\n  }\n\n  session.log('Finished migrating passwords.');\n}\n```\n\n</details>\n\n### How we migrate existing password hashes\nSince password hashes can’t be recalculated without knowledge of the plain text password, the method in the email authentication module applies the new algorithm to the already stored password hashes.\n\nWhen the affected users later authenticate, their password hash will be calculated using both algorithms in tandem. If the authentication is accepted, the stored password hash will be updated to only use the new algorithm so that further authentication only needs to run the new algorithm.\n\n### Impact\nAll versions of `serverpod_auth_server` pre `1.2.6`\n\n### Patches\nUpgrading to version `1.2.6` resolves this issue.\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Pub",
      "name" : "serverpod_auth_server"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.2.6"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/serverpod/serverpod/security/advisories/GHSA-r75m-26cq-mjxc"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2024-29886"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/serverpod/serverpod/commit/a78b9e9f1de74d1300633a122b6cc0f064139ad6"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/serverpod/serverpod"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-916" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2024-03-28T17:53:42Z",
    "nvd_published_at" : "2024-03-27T19:15:49Z"
  }
}