Rijndael encryption service: Possible data corruption when using rotating encryption keys v3.3.x #3010
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
We have discovered a scenario with the current implementation of property encryption that might lead to data corruption (this is NOT a security issue).
The issue affects all versions of NServiceBus that have the Rijndael encryption service when multiple encryption keys are used.
Along with fixing this bug, we are also taking this opportunity to improve the capability of the property encryption feature.
Issues
Changes
In this patch release, we addressed these issues:
How to know if you might be affected
You might be affected if you use Rijndael message property encryption and have multiple keys configured at the same time, or you change your encryption keys over time.
The probability of data corruption increases for failed messages that remain in the error queue when the security key changes. When an old message is retried, get decrypted with the newer key first. If this attempt succeeds, then the decrypted data will get corrupted.
Upgrade guidance
The Encryption key identifiers upgrade
document describes:
Documentation
Background
Every time some value is encrypted we make use of a new random initialization vector (IV). It can happen that an IV in combination with a piece of data can be successfully decrypted with an incorrect key, resulting in corrupted data. In such a case there is no way of knowing if data is corrupt or not.
Connects to Particular/PlatformDevelopment#423
Fixes: #3017 #3018