Skip to content

Security: Plain text password storage in Registration entity#835

Closed
tomaioo wants to merge 1 commit into
nextcloud:masterfrom
tomaioo:fix/security/plain-text-password-storage-in-registrat
Closed

Security: Plain text password storage in Registration entity#835
tomaioo wants to merge 1 commit into
nextcloud:masterfrom
tomaioo:fix/security/plain-text-password-storage-in-registrat

Conversation

@tomaioo
Copy link
Copy Markdown

@tomaioo tomaioo commented May 10, 2026

Summary

Security: Plain text password storage in Registration entity

Problem

Severity: High | File: lib/Db/Registration.php:L29

The Registration entity (lib/Db/Registration.php) stores passwords in plain text. The password field is defined as a string type with no hashing applied before storage. While this is for pending registrations that haven't been created as users yet, storing plain text passwords temporarily in the database is a security concern.

Solution

Consider hashing passwords before storing them in the registration table, or ensure the password is only stored temporarily and never logged or exposed.

Changes

  • lib/Db/Registration.php (modified)

The Registration entity (lib/Db/Registration.php) stores passwords in plain text. The password field is defined as a string type with no hashing applied before storage. While this is for pending registrations that haven't been created as users yet, storing plain text passwords temporarily in the database is a security concern.

Signed-off-by: tomaioo <203048277+tomaioo@users.noreply.github.com>
@tcitworld
Copy link
Copy Markdown
Member

Passwords are encrypted before being stored:

$password = $this->crypto->encrypt($password);
$registration->setPassword($password);

We can't save just the hash because the password is then decrypted and used to create the actual account:

$password = $this->crypto->decrypt($registration->getPassword());

$user = $this->userManager->createUser($loginName, $password);

@tcitworld tcitworld closed this May 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants