Skip to content
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 warning: Replay attack possible #4

Open
clecap opened this issue Sep 21, 2017 · 1 comment
Open

Security warning: Replay attack possible #4

clecap opened this issue Sep 21, 2017 · 1 comment

Comments

@clecap
Copy link

clecap commented Sep 21, 2017

If I am not completely mistaken the encryption lacks a proper randomization and therefore is susceptible to a replay attack.

Who would prevent an attacker from intercepting an encrypted cookie and sending the encrypted packet a second time, not bothering that she does not know the key - since she already has the encrypted version and could deduce the meaning from context?

@erikeckhardt
Copy link

This is a good point and the developer needs to reason about the fact that encryption makes details opaque and hides information in its original form, but does not remove the possibility of, as you say, understanding the meaning of the encrypted message and reusing it.

My suggestion is that developers think of encrypted cookies as if they were credit cards protected by a chip. Without the card, no one can do anything, because the chip's action can't be spoofed. However, with the card, or a copy of the card, one can do anything the original card allowed.

This means the encrypted cookies should have an expiration date and should be protected with additional measures as much as possible, such as using the flags httpOnly, secure, and potentially making sure the caller presents an additional value (from a form or script or local storage) that matches the cookie, making it harder to use the cookie outside of its original time/context/browser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants