Skip to content
This repository was archived by the owner on Jan 24, 2025. It is now read-only.

Insecure default: phonetic alphabet with keyLength=10 is brute-forcible #452

Closed
JorianWoltjer opened this issue May 24, 2024 · 2 comments
Closed
Labels

Comments

@JorianWoltjer
Copy link

I found that this software has a slight vulnerability by default. All files generated get a random ID like /oraxirinic.sh which looks pretty random but is fairly guessable when calculating the odds. The trick here is that by default, the "phonetic" generator is used with a length of 10, implemented here:

https://github.com/zneix/haste-server/blob/master/lib/key_generators/phonetic.js

It randomly chooses vowels or consonants based on whether the index is even or odd, causing a pattern like 1010101010 where 1 is a vowel, and 0 is a consonant. This significantly reduces the number of possibilities down to a brute-forcible range:

>>> len("aeiouy")**5 * len('bcdfghjklmnpqrstvwxyz')**5
31757969376  # requests
>>> (len("aeiouy")**5 * len('bcdfghjklmnpqrstvwxyz')**5) / (1000 * 60 * 60 * 24)
367.56909  # days

For a malicious actor trying at 1000 requests per second, they will be able to test every possible path in just a year, and likely find them earlier the more files exist or the faster they can request. Users may store sensitive things here and expect the paths not to be guessable.
This can be worked around in config.js file by setting keyLength higher or keyGenerator.type to a greater search space like "random" or "dictionary", but I think it is not a good idea to make the default configuration contain this risk.

Copy link

This issue is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Jun 24, 2024
Copy link

github-actions bot commented Jul 8, 2024

This issue was closed because it has been inactive for 14 days since being marked as stale.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant