Join our Newsletter — 33% off our NHI Course
Home› Glossary› Authentication, Authorisation & Trust› OATH HMAC-Based One-Time Password (HOTP)
Authentication, Authorisation & Trust

OATH HMAC-Based One-Time Password (HOTP)

← Back to Glossary
By NHI Mgmt Group Updated November 3, 2026 Domain: Authentication, Authorisation & Trust

HMAC-based One-Time Password is a one-time password algorithm that generates codes from a shared secret and a moving counter. The server and token keep the same secret and validate the current or next counter value, which makes the code useful for offline generation but weak if the shared secret is exposed.

How HOTP Works

HOTP is a shared-secret, counter-based one-time password scheme. Each code is derived from the same secret on both sides, so the token or app can generate codes offline and the server can verify them without a live challenge-response exchange. The moving counter is what keeps each code distinct.

That design makes HOTP simple and resilient in offline scenarios, but it also means the secret is the real trust anchor. If an attacker obtains the shared secret, they can generate valid codes outside the original token or app.

Where HOTP Fits in Authentication

HOTP is best understood as an authentication factor, not a complete identity system. It can strengthen login flows when paired with a password or another primary authenticator, but it does not solve account recovery, device trust, or phishing resistance by itself. In practice, organisations usually place it inside a broader MFA Guide context.

Compared with time-based codes, HOTP avoids clock drift because it uses a counter rather than wall-clock time. That can make it attractive for hardware tokens, disconnected environments, and users who need a code generator that works without network dependence.

Its operational value depends on predictable counter handling. The server usually allows a small look-ahead window to stay in sync with the token, which improves usability but also creates a bounded verification range that defenders need to govern carefully.

Secret Handling and Verification Logic

The security of HOTP depends on how the shared secret is created, stored, enrolled, backed up, and protected over time. Good implementations treat the secret as high-value authentication material, because compromise of that secret lets an attacker mint valid codes even without the physical token or authenticator app.

That is why HOTP is usually discussed alongside seed protection, migration, and token replacement. The same secret must remain synchronized across the issuer and verifier, and recovery workflows need to preserve access without exposing the secret more broadly than necessary.

HOTP also depends on strict server-side verification controls. If the look-ahead window is too permissive, replay and brute-force attempts become easier; if it is too tight, legitimate users can be locked out when counters drift out of sync.

Operational Use Cases and Limitations

HOTP is useful when offline generation matters, such as with hardware tokens or disconnected authenticator workflows. It can also be easier to support in environments where time sync is unreliable or where a deterministic counter is simpler to audit than device time.

Its limitations are equally important. HOTP codes are short-lived only in the sense that each code is single-use in sequence; they are not automatically time-expiring. If the secret leaks through device theft, backup exposure, malware, or server-side compromise, the attacker can generate codes until the secret is revoked or replaced.

For that reason, many organisations prefer more modern phishing-resistant options where they are available, and reserve HOTP for legacy compatibility or offline constraints rather than as a first-choice mechanism.

Risk and Threat Considerations

HOTP creates a concentrated failure point around the shared secret and the server’s counter validation window. If either is mishandled, the scheme can degrade from a useful offline authenticator into a reusable code generator for an attacker.

Failure mechanism: Secret theft, weak enrollment handling, or excessive counter look-ahead can let an attacker generate valid codes, replay them within the acceptance window, or keep using a stolen secret until rotation.

Impact: The result can be account takeover, persistence after compromise, and wider authentication bypass if the same secret is reused across systems or insufficiently protected during recovery and migration.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

NIST SP 800-53 Rev 5, NIST SP 800-63 and OWASP ASVS set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
NIST SP 800-53 Rev 5IA-5 — Authenticator ManagementHOTP depends on lifecycle protection of the shared secret authenticator.
IA-2 — Identification and Authentication (Organizational Users)HOTP is a user authenticator used in enterprise login flows.
Recommendation — Manage HOTP secrets through issuance, rotation, revocation, and secure storage. Require HOTP only as part of a complete user authentication process.
NIST SP 800-63AAL2 — Authenticator Assurance Level 2HOTP is a familiar OTP authenticator used in digital identity assurance models.
Recommendation — Assess whether HOTP meets the required assurance level for the relying party.
OWASP ASVSV6 — AuthenticationHOTP is an authentication mechanism that must be verified for enrollment and verifier behavior.
V7 — Session ManagementHOTP is commonly used to establish access that then depends on secure session handling.
Recommendation — Verify HOTP enrollment, code validation, and recovery handling under authentication requirements. Bind HOTP login to strong session controls after successful authentication.

Practitioner Guidance

Why practitioners should care: HOTP is not just a code format, it is a secret-management problem disguised as an authenticator. Treat enrollment, backup, replacement, and revocation as part of the control, because the security outcome depends on those lifecycle steps as much as on the algorithm itself.

What to watch for: Review whether the verifier accepts only a narrow counter window, whether failed attempts trigger resynchronisation safeguards, and whether the shared secret is protected at rest and during transfer. If you are maintaining legacy HOTP, document when and why it remains in use, because migration decisions often matter more than the code algorithm alone.

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.

NHIMG Editorial Note
Reviewed and updated by the NHIMG editorial team on November 3, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org