5 ms·
I have been thinking about a useless TOTP app that works the other way around. Instead of giving you the current code, it gives you the timestamps when the code
by landgenoot 2y ago
I have been thinking about a useless TOTP app that works the other way around. Instead of giving you the current code, it gives you the timestamps when the code is e.g. 000000, 123456 or 777777.
With a window of 30 seconds and 1e6 possibilities, the expected time it takes to get to a particular number is 347 days. Should be easy to brute force.
- hi-v-rocknroll 2y agoIn a deep voice: Your wish is my command. https://gist.github.com/skull-squadron/8f806b28abbcaa1ba9c256391e5bd8f9 https://gist.github.com/skull-squadron/8f806b28abbcaa1ba9c25... Unfortunately, it may take several years before a certain TOTP value is reached because the values are nondeterministic rather than ordered and so there will be hash collisions of other values as well. Example: JBSWY3DPEHPK3PXP 999999 TOTP will match 999999 between 2024-11-29 16:37:00 -0600 and 2024-11-29 16:37:29 -0600
- landgenoot 2y agoThe community here keeps impressing me. Nice job! Yes it could be several years, however the expected value is less than a year. Just like the expected dice rolls before rolling 6 is 6.
- hi-v-rocknroll 2y agoYes, it's good to disambiguate that it's expected in a statistical sense but it's not an upper bound or confidence interval. I also wrote a program to find CRC32 hash collisions that can be injected into a text file or script to make a text hash to that value. https://gist.github.com/skull-squadron/c85d295cf9e6124dd7e90716dc7b7310 https://gist.github.com/skull-squadron/c85d295cf9e6124dd7e90... Doing so MD5, SHA1, or even SHA256 would be extremely slow and expensive, but not impossible.
- nayuki 2y agoYou don't need to brute-force CRC-32. I do a preimage attack directly using linear algebra: https://www.nayuki.io/page/forcing-a-files-crc-to-any-value https://www.nayuki.io/page/forcing-a-files-crc-to-any-value
- hi-v-rocknroll 2y agoThat's neat but I'm embedding the CRC-32 hex digest itself in a TBD location rather than a chosen text. It's moot because the time savings would be premature optimization. Brute force takes only a couple of minutes and I barely use it. Thanks for the thought though.
- ahazred8ta 2y agoSelective partial SHA1/SHA2 matches only take a few seconds. https://github.com/not-an-aardvark/lucky-commit https://github.com/not-an-aardvark/lucky-commit
- robxorb 2y agoNot so useless. A user of that could memorise the times/dates where a particular easy-recall code comes up. With that, they have effectively "transferred" 2FA for those times into their brain, and not need to use any 2FA app (at only those times).
- hnbad 2y agoGood luck memorising a number of 30 second windows and hitting them exactly. That would require a level of organisation, timing and self-discipline I can not fathom.
- robxorb 2y agoWell, the thirty second window in practice is usually a 2 - 3 minute window, as TOTP servers are set up to allow for drift, network issues, human slowness etc. For sure, memorising more than a handful may be hard but it's just "11 Nov 14:35", etc. I wonder if something could be set up to be both more secure, and more tailored to this use-case. Be pretty sweet to embed a 2FA in users brains somehow.
- 8organicbits 2y agoI think it would be easier to use HOTP for that as the codes are one time use and aren't time based. The user just needs to memorize one of the next N codes.
- masfuerte 2y agoIf you are able to choose the seed you could brute force it so that it produced a memorable code at a memorable time.
- robxorb 2y agoThat's a very cool idea, with the caveat that if an attacker knew you were doing that, the search space for your key would shrink.
- 2y ago
- svarrall 2y agoYou mean like this? You can get push notifications when your codes are “cool” https://open.substack.com/pub/jacobbartlett/p/building-a-2fa-app-that-detects-patterns https://open.substack.com/pub/jacobbartlett/p/building-a-2fa...