Passwords Stored in Plain Text or Reversible Form

User passwords are stored as plain text, in an encoding, or encrypted with a key the application holds, so anyone who reads the store and key can recover every password.

SeverityHigh
CVSS 3.17.4 CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N Open in the calculator
CVSS 4.09.1 CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N Open in the calculator
CWECWE-257: Storing Passwords in a Recoverable Format
MITRE ATT&CKT1552 Unsecured Credentials, T1078 Valid Accounts
CategoryCryptographic Failures

Description

The application stores user passwords in a form from which the original value can be recovered: as plain text, in an encoding such as Base64 or hexadecimal, or encrypted with a key that the application itself holds and uses to decrypt them.

Encryption does not change the outcome much, because the key is normally kept on the same servers, in configuration or in the code, and anyone with the access needed to read the passwords is likely to be able to read the key as well. Anyone who can read the password store, or the store and its key, obtains every user's password at once, with no cracking needed: attackers exploiting another weakness such as SQL injection, anyone holding a backup or database export, and administrators and support staff, who should never be able to see passwords. The passwords give access to every account in the application, including administrative ones, and, because passwords are widely reused, often to the same users' accounts on other services and on the organisation's own systems.

The weakness can be identified directly, by inspecting the user table or an export where testing gives database access, or indirectly from the application's behaviour: a password reminder that emails the current password, a profile or administration page that displays it, support staff who can tell a user their password, or a response that returns it. Source code and configuration review show it plainly, for example a password column written without any hashing step, or a call to an encryption routine where a password hashing function is expected.

Remediation

Store only a one-way password hash, and remove every recoverable copy:

  • Hash passwords with a dedicated password hashing function (Argon2id, scrypt, bcrypt, or PBKDF2 where FIPS compliance is required), with a unique salt per password and the work factors recommended in the OWASP Password Storage Cheat Sheet, using the platform's maintained implementation.
  • Convert all existing passwords in one operation: because the plain text or decryptable values are available, each can be hashed immediately, without waiting for users to sign in.
  • Then delete the plain text or encrypted column, destroy the encryption key that protected it, and remove old copies from exports, logs and test environments, and from backups as they are rotated.
  • Replace any feature that reveals the password, such as a reminder email or a display to support staff, with a secure reset link that lets the user set a new password.

Because the existing passwords may already have been seen by anyone with database, backup or key access, consider requiring all users to change their password after the migration, and notify them if a compromise is suspected. Confirm the fix by inspecting newly stored values and the migrated records, and by checking that no feature or response can return a user's password.

References


Add This Finding to Your Library

In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.

Free trial  ·  No card required

Only need the reporting? Our reporting tool is free and open source, with the same library.


More Authentication and Sessions Findings

Every Authentication and Sessions finding