-
Notifications
You must be signed in to change notification settings - Fork 578
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
AV on certain AEAD OCB decryption input calls under Windows. #3812
Comments
Nothing that comes to mind immediately, unfortunately. Which version did you update from? |
@reneme Thanks for the reply! |
I managed to build RNP on my machine and can reproduce the crash. Looking into it. Edit: I have a lead and am digging deeper. |
The root cause is indeed a bug in Botan's OCB implementation. Perhaps already in 2.x, actually.
Here's the implementation of botan/src/lib/modes/aead/ocb/ocb.cpp Lines 45 to 51 in 3005ae6
... now, if we hit an Below is an excerpt of the function that uses botan/src/lib/modes/aead/ocb/ocb.cpp Lines 58 to 84 in 3005ae6
We're calling I suspect, the reason that this crashes on some platforms and not on all is, that Because of the above, it might be tough to build a reasonable regression test, but I'll try regardless and of course build a fix. Thanks a lot for reporting this! @randombit I'm assuming we want to have a backport to 2.x for this? |
This caused an access violation when re-allocating the m_L vector (due to a lazy .push_back()) and invalidating local references in the process. See also randombit#3812 for details.
@reneme Wow, thanks for fixing this and for the details! Another lurking magical bug with simple and logical explanation :) |
This caused an access violation when re-allocating the m_L vector (due to a lazy .push_back()) and invalidating local references in the process. See also randombit#3812 for details.
@reneme Was this backported to 2.19.4? Do not see it in the changelog. |
I'm afraid that fell through the cracks. 😨 I'm going to open a PR for it. Unfortunately, only for the next maintenance release, then. Sorry for that and thanks for the reminder. |
Np, thanks for confirming! |
This caused an access violation when re-allocating the m_L vector (due to a lazy .push_back()) and invalidating local references in the process. See also randombit#3812 for details.
As it turns out, this bug is much much easier to hit in 3.x than it is in 2.x. I had to invent a toy cipher with a different intrinsic block-parallelism to be able to produce a situation where the access violation would hit. Though, the odds are also dependent on the re-allocation behavior of |
We use Botan as cryptography backend for RNP OpenPGP library. And recently, after updating CI runners to Botan 3.1.1, started to receive failures, only for Windows platform. After isolating the issue and enabling sanitizers got the following call stack. Suspecting something in RNP which may corrupt the memory (however sanitizers doesn't repor that), I was able to isolate the issue to pure botan calls with some certain input.
Do you have any idea why this happens?
Should I provide some more input, like test data file/order of decryption calls causing the failure?
The text was updated successfully, but these errors were encountered: