Summary
OpenMage generates customer confirmation keys and password-reset tokens using predictable, non-cryptographic functions. An unauthenticated attacker may brute-force a customer confirmation key through an unrate-limited endpoint, or may predict administrator reset tokens after recovering the generator state.
Affected context
The issue affects OpenMage Magento-LTS releases before 20.18.2 and 21.0.0-beta pre-releases before 21.0.0-beta3. It arises in customer email-confirmation and customer or administrator password-reset token generation. Risk depends on the relevant endpoints being reachable and, for administrator reset-token prediction, on an attacker being able to recover the token generator state.
Exploit preconditions
- Attack surface: Customer confirmation and password-reset flows
- Required access: No authentication is needed to attempt confirmation-key brute force; administrator token prediction additionally depends on recovering generator state
- Trigger point: The customer confirmation endpoint, or an administrator password-reset flow
- Why exploitation is possible: Confirmation keys have roughly 20 bits of uncertainty and the endpoint is unrate-limited; reset tokens rely on non-cryptographic generators that may be predictable
Why this happens
The application uses md5(uniqid()) for customer email-confirmation keys and uniqHash() for customer and administrator password-reset tokens. These are not suitable cryptographic random generators for security-sensitive tokens. This maps to CWE-330: Use of Insufficiently Random Values, because attackers may guess or predict tokens used to authorize account-related actions.
Potential impact
- An attacker could confirm a pending customer account and log in as that customer
- An attacker may be able to reset customer passwords
- An attacker who recovers generator state could predict administrator reset tokens and take over an administrator account
- Account compromise could enable access to customer data or administrative functions
General mitigation guidance
Defensive patterns for token generation include:
- Generate security-sensitive tokens with a cryptographically secure random number generator and sufficient entropy
- Use purpose-specific, unpredictable tokens and validate them only in their intended flow
- Apply rate limits, attempt limits, and monitoring to confirmation and reset endpoints
- Expire tokens promptly, invalidate them after use, and avoid exposing token-generation state
- Restrict account and administrative privileges to the minimum needed, and require additional protections for sensitive actions
How teams detect issues like this
Review token-generation code for time-based, sequential, hash-based, or otherwise non-cryptographic sources of randomness. Use static analysis and code review checks to flag such APIs in authentication, confirmation, and password-reset flows. Also assess endpoint policies for rate limits, attempt limits, token expiry, and single-use enforcement; automated security review tools may help identify risky patterns.

