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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Security] Static IV during encryption/decryption #33

Closed
stypr opened this issue Sep 27, 2022 · 2 comments
Closed

[Security] Static IV during encryption/decryption #33

stypr opened this issue Sep 27, 2022 · 2 comments

Comments

@stypr
Copy link

stypr commented Sep 27, 2022

Leaving notes on this repository as well (Originated from mcndt/obsidian-quickshare#21)


Came from https://mcndt.dev/posts/how-to-e2e-encryption/ 馃憢馃徎

Describe the bug

Currently the code sets the IV to static value of 0s, and this is considered to be insecure.. Consider randomizing your IVs.

https://github.com/mcndt/obsidian-quickshare/blob/73733c0292cb3f0d6775c69c734e80c690932777/src/crypto/crypto.ts#L45-L49

const md = await window.crypto.subtle.decrypt(
{ name: 'AES-CBC', iv: new Uint8Array(16) },
await _getAesKey(secret),
ciphertext_buf
);
return new TextDecoder().decode(md);

Also, please consider reading https://security.stackexchange.com/a/17046 with regards to secure usage of AES-CBC on your service. I honestly think it's better off to do something with GCM than with CBC mode.

@mcndt
Copy link
Owner

mcndt commented Nov 11, 2022

Closing as duplicate of mcndt/obsidian-quickshare#21.

@mcndt mcndt closed this as completed Nov 11, 2022
@mcndt
Copy link
Owner

mcndt commented Nov 13, 2022

Shipped in plugin version 1.0.2 and live on production.

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