-
Notifications
You must be signed in to change notification settings - Fork 205
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
node-rsa vulnerable to the Marvin Attack #230
Comments
Did I understand correctly that the vulnerability essentially necessitated access to the machine running node-rsa code? |
No, absolutely no. It's measurable over the network, see the linked papers from the vulnerability page. I haven't made an experiment with a side-channel this huge, but I'd say even attacking a server good few hundred kilometers away, with a RTT of few milliseconds should be entirely doable with reasonable attack time. Attack from within the same data centre will be a manner of few hours per decryption. |
Is it same result with default pkcs1_oaep scheme? Also, can you pls confirm same result with |
with
I don't see anything similar when running OAEP (without "browser" set), but then I haven't ran a large sample size, so it may still show up. But the speed of decryption would suggest that in nodejs environment it's just delegating to node? If that's the case, then there's no need to check OAEP: learning about error there doesn't provide information to the attacker |
@rzcoder any progress on this? |
@tomato42 It doesn't seem like anything can be fixed here. The engine on pure JS is used only in client-side code, and shouldn't be vulnerable to such an exploit through many requests. And the nodejs methods relate to nodejs/OpenSSL projects. |
Dropping support for PKCS#1v1.5 encryption would fix the issue... That's what jsrsasign did for CVE-2024-21484
How so? |
as I said, "it looks like the length of the padding is not checked:", that's an outright bug in the implementation... |
Not a real world use case.
Ok, if just this. Can you please check version from https://github.com/rzcoder/node-rsa/tree/check_pkcs1v1.5_padding_size ? Is it gets any better? |
Sorry, this is a security sensitive API. The package has nearly a thousand dependencies and over half a million weekly downloads. I doubt that it's "not a real use case" for each and every user of this library.
sorry, don't have the time to run tests. Having the unittests verifying correct behaviour would make it much easier to review... |
This particular behaviour is present only in the client-side browser, which is usually does not handle incoming requests that can exploit this vulnerability, especially with a specific scheme that is not set by default. Therefore, I am quite sure that there is no real-world use case for this in the wild. Otherwise, this vulnerability will not be the biggest problem, I think... |
I still don't see it: just because the code is running in the browser doesn't mean that the server is trusted. It can be providing malformed messages specifically to decrypt data it has no access to. I mean: why else would anybody run RSA decryption using javascript in the browser otherwise? |
I agree that this is a possible situation. But in any case, the client needs to start interacting with the malicious server himself; this is not a situation where an attacker can connect on his own initiative. Any way, if you'll have time, please run tests on https://github.com/rzcoder/node-rsa/tree/check_pkcs1v1.5_padding_size if it any better I'll merge it to master. |
There are situations where the server doesn't have to be malicious, just a participant: like capturing keys through sound or leaks that happen through power LEDs. Sorry, I won't have the time to test this code any time soon. |
Any update on this? I looked at the script to run the timing attack but I don't even know where to start with that. |
What do you mean you "don't know where to start"? There are step-by-step instructions linked in the first first post of this issue: https://github.com/tomato42/marvin-toolkit/tree/master/example/node-rsa Also, you need to use |
@tomato42 - yes, I looked at those instructions and it's pretty clear that I'd have to spend half a day or longer getting that environment set up. I'm not a security expert so please excuse my ignorance on this but what you're saying about the |
is it possible? yes, and to confirm such large side-channels as those one here, it will work fine. Do I recommend it for verification that the issue was fixed? no. The closer to the hardware the test can be executed, the less noise there should be and thus the less data needs to be collected. Containers may be thin enough to not matter, but I haven't verified it.
the instructions and scripts don't require installation of any software outside of python virtual environments. As long as you have
not exactly sure what you're asking... if it is: "Is it possible to workaround the issue by changing just OpenSSL, without Node.js?", then the answer is Yes. The change in Node.js is just to make sure that an insecure API is not available. If it can be safely used, then the API is re-enabled. If not, then you have to use the command line switch to re-enable it, thus making your application potentially vulnerable. |
(since I have haven't found a security policy or an email to report security vulnerabilities I'm filing it directly here)
I've verified that the node-rsa 1.1.1 package running on node 21.1.0 is vulnerable to the Marvin Attack (a timing variant of the well-known Bleichenbacher attack).
I've executed the script on Ryzen 5 5600X on an isolated cpu core.
The summary of the test:
the description of the probes:
explanation of the probes is in the
step2.py
script.Given the large size of the timing signal, the attack will be easy to perform remotely.
The text was updated successfully, but these errors were encountered: