Summary
Serverpod improved security for stored password hashes
Description
Improved security for stored password hashes
Serverpod now uses the OWASP, source, 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.
Web server route code
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.');
}
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
CVE-2024-29886 has a CVSS score of 5.3 (Medium). The vector is network-reachable, no privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (1.2.6); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Already deployed Kodem?
See it in your environmentNew to Kodem? Get a demo →Remediation advice
Upgrading to version 1.2.6 resolves this issue.
Frequently Asked Questions
- What is CVE-2024-29886? CVE-2024-29886 is a medium-severity security vulnerability in serverpod_auth_server (pub), affecting versions < 1.2.6. It is fixed in 1.2.6.
- How severe is CVE-2024-29886? CVE-2024-29886 has a CVSS score of 5.3 (Medium). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which versions of serverpod_auth_server are affected by CVE-2024-29886? serverpod_auth_server (pub) versions < 1.2.6 is affected.
- Is there a fix for CVE-2024-29886? Yes. CVE-2024-29886 is fixed in 1.2.6. Upgrade to this version or later.
- Is CVE-2024-29886 exploitable, and should I be worried? Whether CVE-2024-29886 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2024-29886 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2024-29886? Upgrade
serverpod_auth_serverto 1.2.6 or later.