Break direct dependence on prior values when only a limited output range remains predictable. Introduce fresh randomness, stronger state updates or server-side generation so an attacker cannot narrow the next value by watching earlier ones. Review any logic that increments, cycles or truncates values used for tokens, codes or session-related data.
What makes this weakness predictable from prior values?
The core issue is state dependence. If each new value is derived from a previous one by a simple increment, cycle, truncation, or other low-entropy transformation, an observer can learn enough about the sequence to reduce the search space for the next result. That matters when the value is used for tokens, codes, reset links, or session-related data, because predictability turns a convenience feature into an attack surface.
A useful way to think about it is whether the next output can be inferred from what has already been seen. If the answer is yes, the weakness is not the value itself but the relationship between outputs. The safer pattern is to make each value independent of the prior value stream, or at least unpredictable even when earlier outputs are known.
When this pattern appears in application logic, it often comes from trying to avoid collisions or preserve ordering while still using a value as a security-sensitive identifier. That trade-off is usually the wrong one. Sequential behavior is acceptable for internal bookkeeping, but not for anything that an attacker could observe and then reuse as a hint about future values.
How should the generation logic be changed?
The strongest mitigation is to stop deriving the security-sensitive value from the previous one in a way that preserves a visible pattern. Use fresh randomness, server-side generation, or a stronger state update that does not reveal a narrow progression from one value to the next. If the value must be meaningful to the system, keep the meaning server-side and expose only an unpredictable reference externally.
Server-side generation is especially useful when the value is part of a workflow that also depends on authorization, expiration, or one-time use. In that case, the externally visible string should be treated as a handle, not as a meaningful signal about how the next value will be formed. That removes the attacker’s ability to infer the next value by observing the current one.
CWE Top 25 Guide is a useful reference when you want to place this weakness in the broader software weakness landscape and compare it with other root causes that also produce predictable outputs.
If a sequence must exist for operational reasons, the sequence should be separated from any security-bearing token or code. A business counter can increment safely while the token itself is generated independently, but the two should never be conflated. That separation is the practical boundary that keeps predictability from becoming abuse.
What should you review in existing implementations?
Inspect any code that increments, cycles, truncates, or reuses values for authentication-adjacent purposes. Pay particular attention to reset links, one-time codes, session identifiers, invitation tokens, API keys, and values that are echoed back to users. The risky pattern is often subtle because the value may look sufficiently random at a glance while still exposing a narrow range or repeated structure.
Review the full lifecycle, not just the generator. A value can be well generated and still become predictable if it is reused too early, exposed in logs, copied across environments, or created from a counter that is shared across requests. Also check whether the surrounding logic narrows the space by fixed prefixes, timestamps, modulus operations, or truncation after generation.
CISA cyber threat advisories are a good place to confirm whether the broader attack pattern you are seeing has active exploitation relevance, while your own code review should focus on where the value becomes guessable in practice.
Risk and Threat Considerations
This weakness is risky because predictability often gives an attacker a cheap path from observation to exploitation. If the next value can be guessed from prior values, then rate limits, one-time use assumptions, and token secrecy can fail even without a direct system compromise.
Failure mechanism: An attacker observes or samples prior outputs, identifies the generation rule, and narrows the remaining value space enough to guess the next valid token, code, or session-related identifier.
Impact: That can lead to unauthorized access, account recovery abuse, session hijacking, or replay-style misuse of values that were supposed to be unguessable.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
MITRE ATT&CK addresses the attack and risk surface, while OWASP ASVS, NIST SP 800-53 Rev 5 and CIS Controls v8 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP ASVS | V9 — Self-contained Tokens | Predictable security tokens and codes fall under token design and verification. |
| Recommendation — Generate tokens with sufficient entropy and no predictable relationship to prior values. | ||
| NIST SP 800-53 Rev 5 | IA-5 — Authenticator Management | The weakness affects lifecycle and generation of authenticators and related secret values. |
| Recommendation — Use IA-5 to enforce secure generation, storage, rotation, and replacement of authenticators. | ||
| CIS Controls v8 | CIS-5 — Account Management | Tokens and session-related data require strong lifecycle handling to prevent predictable reuse. |
| Recommendation — Apply CIS-5 to manage credential and account artifacts with controlled issuance and revocation. | ||
| MITRE ATT&CK | T1110 — Brute Force | Predictable ranges let attackers guess valid values by repeated attempts. |
| Recommendation — Detect and throttle repeated guessing attempts against tokens and session-related values. | ||
Practitioner Guidance
What to verify: Confirm that the value is generated independently of prior outputs and that any business sequence, counter, or rollover state is not exposed as a security-sensitive identifier. If the same routine serves both tracking and access, split those responsibilities.
Decision rule: If the value can be used to authenticate, recover, or continue a session, treat predictability as a security defect rather than a cosmetic weakness, even when the exposed range seems small.
Common mistake: Teams often keep a sequential or truncated format because it is easy to debug, then assume the surrounding authorization layer will absorb the risk. That assumption fails when the token itself becomes the attacker’s entry point.
Practitioner takeaway: The right fix is not just “make it harder to guess,” but “remove the attacker’s ability to infer the next value from the last one.”
Related resources from NHI Mgmt Group
Deepen Your Knowledge
Free weekly newsletter
Subscribe to the NHI & AI Identity Journal
The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.
Bonus 33% off our NHI Course when you subscribe.
Reviewed and updated by the NHIMG editorial team on October 18, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org