-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Security flaw that should be noted #18
Comments
I agree with your remark on the security flaw and there is one more flaw - the "/captcha" post request returns something like: "validation":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhbnN3ZXIiOiJQUFlCNHYiLCJpYXQiOjE2Nzc5NDk3NzcsImV4cCI6MTY3ODAzMzc3N30.5vbMHRbhvSLyGuc6xLDBBaln-fsfyDUCbOwUVVuXtog" which contains the answer and is easy to decode |
I never used this implementation, I just had a look for inspiration, my implementation uses AES/GCM. But from reading through the code it looks like it shouldn't be able to decrypt ? Did you set CAPTCHA_TOKEN_SECRET like in the example? |
congrats - may I ask how did you manage to prevent the usage of the same captcha/hash multiple times? I am considering embegging expiration time or captcha counter in the hash. But it has flaws:
I implemented the restless-captcha and the above validation code was from my running implementation (as you can see it contains the answer easily decodeable). also in the readme it stands: to verify the user's answer submit an object with the nonce, the answer and the validation string to /captcha/verify
so the validation code needs to be known by the client (thus the answer in it). |
To be noted, my implementation was only an MVP, I generated a random captcha image with 4 digit answers. You can now do nothing, but that leaves the loophole of generating as many keys as you want in that time period. The only issue with that is, It's not really stateless anymore, but it's definitely using less state, and when you have some random bot attack you don't actually have to store anything because they most likely won't solve the captcha anyway. Ram usage would be minimal for storing a bunch of IDs that are cleaned anyway. If you have many nodes, you probably want some simple Redis instance that automatically removes the used keys for you after they expired (you only have to store them for 15 mins max because they expired anyway) and the captcha can only really be used once. I don't see any further loophole in this, but my implementation is only meant to protect from unintelligent bots, and not a human attacker. |
I really like this approach for stateless captcha, and it definitely has its use cases where you only want to prevent automatic and unintelligent spam.
After solving a captcha once, a user can simply generate as many valid JWT tokens as they want and bypass that captcha until the JWT for the captcha expires (which seems to be 1400m if I'm not mistaken)
You should maybe add a disclaimer in the repo, or implement a simple cache to store used captchas until they expiry (and set a shorter expiry), but repo seems abandoned
The text was updated successfully, but these errors were encountered: