-
Notifications
You must be signed in to change notification settings - Fork 23
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
@peculiar/webcrypto is vulnerable to the Marvin Attack #66
Comments
@microshine any progress on this? |
@tomato42, thank you for your detailed report on the vulnerability of @peculiar/webcrypto package 1.4.3 to the Marvin Attack, and I apologize for the delayed response. Your findings regarding the side-channel vulnerability, are concerning. We understand the gravity of the situation. To clarify our project's scope, we do not implement our own cryptography but provide a layer over the NodeJS cryptography API to enable compatibility with WebCrypto (peculiar/webcrypto -> NodeJS -> OpenSSL) projects. For reference your test specifically exercises this block of code. Addressing the issue at our layer, such as by introducing a counter-based rate limit, poses significant challenges. Without detailed insights into how various applications utilize our library, such changes would likely unintentionally, and potentially unnecessarily break these applications. We say this because this would include scenarios where an attacker doesn't have adequate control or visibility to perform the attack. The option to switch to a different cryptography layer, moving away from Nodejs Crypto (and as a result OpenSSL), has been considered as well. However, this library was initially created to minimize maintenance costs relative to its predecessor which directly consumed OpenSSL, and with our current funding limitations, returning to a more integrated approach may not be sustainable. We understand this is a complex issue, and unfortunately, there might be more harm than good in attempting a solution at our layer. Do we have any insights from the NodeJS and OpenSSL teams on how they intend to address this? We are open to suggestions and would welcome any recommendations you might have for addressing this vulnerability, considering it is not inherent to our codebase. Thank you once again for bringing this to our attention and for your contribution to the security of open-source software. |
sorry, the code you linked is used for signing with RSA-PSS: https://github.com/PeculiarVentures/webcrypto/blob/master/src/mechs/rsa/crypto.ts#L196-L213 as far as fixes go: the thing is that current webcrypto doesn't support For OpenSSL the fix is limited to openssl/openssl#13817, which shipped upstream only in the 3.2.x branch. |
My apologies, I shared that link in a hurry. You're right; it was for the PSS wrapper code, but the answer remains the same, we just call Node's crypto libraries. The original design of the library aimed to provide support for web crypto before Node.js had its own support. It has since evolved to also offer algorithms not supported by webcrypto, to enable those libraries that use WebCrypto to interoperate with the rest of the world. it is our understanding the majority of the consumers of this library do so in the name of achieving that interoperability. Since we don't know which applications are using it, removing this functionality could potentially break applications, including those that are not vulnerable. Do you know what Node's plan is? |
I've tested @peculiar/webcrypto package 1.4.3 on node 21.1.0 and verified that's it's vulnerable to the Marvin Attack.
The size of the side channel is very large, so even remote exploitation will be rather easy. Both correctness of the PKCS#1 v1.5 ciphertext is leaking as well as the length of the returned message. Less than 100 measurements per probe are necessary for highly statistically significant results, so a local attack taking as little as few hours is quite realistic.
I've executed the reproducer in the marvin-toolkit repo on an AMD Ryze 5 5600X CPU running with core isolation.
After collecting 10 thousand measurements per sample, I've got the following results:
With a graph of confidence intervals of:
legend for the graph:
explanation of the probes is in the step2.py script.
Results of the pairwise statistical tests are in this file:
report.txt
note: the p-values of 0 mean that the actual calculated p-value is smaller than what double precision floating point number can represent
The text was updated successfully, but these errors were encountered: