This blog post explains how one-time passwords (OTPs), specifically HOTP and TOTP, work. It breaks down the process of generating these codes, starting with a shared secret key and a counter (HOTP) or timestamp (TOTP). This input is then used with the HMAC-SHA1 algorithm to create a hash. The post details how a specific portion of the hash is extracted and truncated to produce the final 6-digit OTP. It clarifies the difference between HOTP, which uses a counter and requires manual synchronization if skipped, and TOTP, which uses time and allows for a small window of desynchronization. The post also briefly discusses the security benefits of OTPs and why they are effective against certain types of attacks.
This blog post explores the challenges of creating a robust test suite for Time-Based One-Time Password (TOTP) algorithms. The author highlights the difficulty in balancing the need for deterministic, repeatable tests with the time-sensitive nature of TOTP codes. They propose using a fixed timestamp and shared secret as a starting point, then exploring variations in time steps and time drift to ensure the algorithm handles edge cases correctly. The post concludes with a call for collaboration and shared test vectors to improve the overall security and reliability of TOTP implementations.
The Hacker News comments discuss the practicality and usefulness of the proposed TOTP test suite. Several commenters point out that existing libraries like oathtool already provide robust implementations and question the need for a new test suite, suggesting that focusing on testing against these established libraries would be more effective. Others highlight the potential value in testing edge cases and different implementations, particularly for less common languages or when implementing TOTP from scratch. The difficulty in obtaining a diverse and representative set of real-world TOTP secrets for testing is also mentioned. Finally, some commenters express concern about the security implications of publishing a comprehensive test suite, fearing it could be misused for malicious purposes.
The blog post "Bad Smart Watch Authentication" details a vulnerability discovered in a smart watch's companion app. The app, when requesting sensitive fitness data, used a predictable, sequential ID in its API requests. This allowed the author, by simply incrementing the ID, to access the fitness data of other users without proper authorization. This highlights a critical flaw in the app's authentication and authorization mechanisms, demonstrating how easily user data could be exposed due to poor security practices.
Several Hacker News commenters criticize the smartwatch authentication scheme described in the article, calling it "security theater" and "fundamentally broken." They point out that relying on a QR code displayed on a trusted device (the watch) to authenticate on another device (the phone) is flawed, as it doesn't verify the connection between the watch and the phone. This leaves it open to attacks where a malicious actor could intercept the QR code and use it themselves. Some suggest alternative approaches, such as using Bluetooth proximity verification or public-key cryptography, to establish a secure connection between the devices. Others question the overall utility of this type of authentication, highlighting the inconvenience and limited security benefits it offers. A few commenters mention similar vulnerabilities in existing passwordless login systems.
DualQRCode.com offers a free online tool to create dual QR codes. These codes seamlessly embed a smaller QR code within a larger one, allowing for two distinct links to be accessed from a single image. The user provides two URLs, customizes the inner and outer QR code colors, and downloads the resulting combined code. This can be useful for scenarios like sharing a primary link with a secondary link for feedback, donations, or further information.
Hacker News users discussed the practicality and security implications of dual QR codes. Some questioned the real-world use cases, suggesting existing methods like shortened URLs or link-in-bio services are sufficient. Others raised security concerns, highlighting the potential for one QR code to be swapped with a malicious link while the other remains legitimate, thereby deceiving users. The technical implementation was also debated, with commenters discussing the potential for encoding information across both codes for redundancy or error correction, and the challenges of displaying two codes clearly on physical media. Several commenters suggested alternative approaches, such as using a single QR code that redirects to a page containing multiple links, or leveraging NFC technology. The overall sentiment leaned towards skepticism about the necessity and security of the dual QR code approach.
Summary of Comments ( 56 )
https://news.ycombinator.com/item?id=43653322
HN users generally praised the article for its clear explanation of HOTP and TOTP, breaking down complex concepts into understandable parts. Several appreciated the focus on building the algorithms from the ground up, rather than just using libraries. Some pointed out potential security risks, such as replay attacks and the importance of secure time synchronization. One commenter suggested exploring WebAuthn as a more secure alternative, while another offered a link to a Python implementation of the algorithms. A few discussed the practicality of different hashing algorithms and the history of OTP generation methods. Several users also appreciated the interactive code examples and the overall clean presentation of the article.
The Hacker News post titled "Behind the 6-digit code: Building HOTP and TOTP from scratch" has generated several comments discussing various aspects of one-time passwords (OTPs).
Some users delve into the technical details. One comment explains the importance of the counter value in HOTP (HMAC-based One-Time Password algorithm), highlighting how discrepancies between the server's and client's counter can lead to synchronization issues and failed logins. They suggest potential solutions like resynchronization mechanisms where the server accepts a range of OTPs or the use of TOTP (Time-based One-Time Password algorithm) which relies on time synchronization instead of counters.
Another user questions the necessity of implementing OTP generation from scratch, arguing that existing libraries are generally robust and well-tested. They express concern about potential security vulnerabilities if the implementation isn't carefully vetted. This spurs a discussion about the educational value of building such systems from scratch, with proponents highlighting the deeper understanding gained through the process. This understanding is contrasted with the potential dangers of blindly relying on libraries without comprehending their inner workings.
The discussion also touches on practical considerations. One comment emphasizes the crucial role of proper secret key management, highlighting the risks associated with weak keys. Another user discusses the usability aspects of OTPs, mentioning potential accessibility challenges for users with certain disabilities. The comment suggests alternative authentication methods might be necessary in such cases to ensure inclusivity.
Finally, some users share their personal experiences and preferences regarding different OTP methods. Some prefer authenticator apps while others express skepticism due to the potential inconvenience of losing access to their devices. The conversation around alternative authentication schemes also covers push notifications, SMS-based OTPs, and WebAuthn, briefly touching upon their respective security and usability trade-offs. A recurring theme in these discussions is the importance of striking a balance between security and user experience when choosing an authentication mechanism.