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

Warning: Use Cipheriv for counter mode of aes-256-ctr #296

Closed
bdharrington7 opened this issue Jan 17, 2018 · 17 comments · Fixed by #380
Closed

Warning: Use Cipheriv for counter mode of aes-256-ctr #296

bdharrington7 opened this issue Jan 17, 2018 · 17 comments · Fixed by #380

Comments

@bdharrington7
Copy link
Contributor

Starting in at least node v8.7.0, this warning is emitted when using the default algorithm. The recommended approach is to use an iv and call crypto.createCipheriv(algorithm, key, iv) instead of crypto.createCipher(algorithm, key). I'm guessing this would change the API of secure-keys to require an iv in addition to a secret in the options to instantiate it.

@cacola
Copy link

cacola commented Jan 19, 2018

how to fix

@bdharrington7
Copy link
Contributor Author

@mhamann Any comment since this is a potential vulnerability?

@mhamann
Copy link
Collaborator

mhamann commented Feb 10, 2018

@bdharrington7 yes...obviously something that should be fixed. Unfortunately the easy fix requires the upstream to update first, and I don't think I've seen any progress there.

I would like to revisit the crypto that nconf uses at some point anyway, so maybe the guidance for now is simply to handle encrypted values outside of the package.

@bnoordhuis
Copy link

I left a comment on jcrugzz/secure-keys#1. I don't know critical the data is that nconf stores encrypted but an attacker that manages to obtain a ciphertext can decrypt other ciphertexts that were encrypted with the same secret.

@mhamann
Copy link
Collaborator

mhamann commented Mar 31, 2018

Thanks. Seems like secure-keys has been abandoned.

The next major release of nconf would be 1.0, which would be a good opportunity to re-work nconf's encrypted value capability. Any interest in PRing some enhancements in that area (specifically to remove the dependency on secure-keys)?

@bnoordhuis
Copy link

I've opened #299.

@nichojo89
Copy link

bump

@mhamann
Copy link
Collaborator

mhamann commented Dec 8, 2020

@nichojo89 this was mostly fixed in #322, but still needs a few changes before releasing.

There will be a v1.0.0 beta in the future that contains this change. I'm working on the release for that as time allows.

@andreasonny83
Copy link

Any update on this? Node 8 is officially not supported from 2020. I believe the v1 needs to be released ASAP

@mhamann
Copy link
Collaborator

mhamann commented Jun 21, 2021

Hi there, thanks for the reminder on this. I'm fairly close to having a v1 beta available and I think a full v1 can follow on fairly quickly, given the breaking changes are not extensive.

I am hoping to have this available within the next two weeks. Feel free to hold me accountable! :-)

@andreasonny83
Copy link

andreasonny83 commented Jun 30, 2021

@mhamann ,
just something else I forgot to mention in my previous message. There is a backward compatibility check in the code that still uses the deprecated crypto.createDecipher . This will still cause deprecation warnings output to the terminal with modern versions of NodeJS.

decipher = crypto.createDecipheriv(value.alg, self.secure.secret, Buffer.from(value.iv, 'hex'));

I was wandering if you're planning to remove that condition in the version 1.
Thanks again.

@mhamann
Copy link
Collaborator

mhamann commented Jul 2, 2021

@andreasonny83 yeah, i think we should remove deprecated APIs, since we're breaking a few things with this. feel free to submit a PR around it or I'll hopefully get to it here shortly.

@mhamann
Copy link
Collaborator

mhamann commented Jul 6, 2021

@andreasonny83 offending code has been removed and tests updated. I'll leave the PR (#380) open for a bit before merging if you want to have a look.

@andreasonny83
Copy link

Thanks for sharing @mhamann . The PR looks good to me.
Looking forward to testing the new version.
Thanks

@andreasonny83
Copy link

@mhamann Any ETA for releasing v1?

@mhamann
Copy link
Collaborator

mhamann commented Jul 11, 2021

v1 beta 1 coming this week!

@mhamann
Copy link
Collaborator

mhamann commented Aug 4, 2021

@andreasonny83 at long last, v1.0.0-beta.0 is now available on npm. To install, run npm i nconf@beta, but note you might run into some backward-incompatible stuff along the way.

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

Successfully merging a pull request may close this issue.

6 participants