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

Rijndael encryption service: Possible data corruption when using rotating encryption keys v5.2.x #2998

Merged
merged 7 commits into from Oct 21, 2015

Conversation

ramonsmits
Copy link
Member

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

  • #3017 Possibility of data corruption when utilizing multiple encryption keys.
  • #3018 Encryption key similarity checks can cause false positives.
  • #2994 Circuitbreaker for timeout storage connectivity is using the wrong default.
  • #3019 Harden encryption key security by allowing full byte range.

Changes

In this patch release, we addressed these issues:

  • When encrypted messages are sent the endpoint includes a key identification in the message header. The receiver will use this header to select the correct key for decryption.
  • The similarity check is removed to prevent false positives.
  • Encryption keys can now be specified in Base64 format to support the full byte range of 2^256 possible combinations.
  • The circuit breaker timeout is set to to two minutes instead of two seconds.

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:

  • Upgrade steps
  • Compatibility
  • Configuration changes
  • Generating new keys
  • Locating possible corrupted data

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: #2994 #3017 #3018 #3019

@ramonsmits ramonsmits self-assigned this Oct 13, 2015
@ramonsmits ramonsmits added this to the 5.2.9 milestone Oct 13, 2015
@ramonsmits ramonsmits mentioned this pull request Oct 14, 2015
@ramonsmits ramonsmits force-pushed the hotfix-5.2.9 branch 6 times, most recently from 079c2b1 to 74b6780 Compare October 16, 2015 15:24
@ramonsmits ramonsmits changed the title Hotfix 5.2.9 Rijndael encryption service: Possible data corruption when using rotating encryption keys v5.2.x Oct 16, 2015
IDictionary<string, byte[]> keys;
IList<byte[]> decryptionKeys; // Required, as we decrypt in the configured order.

public RijndaelEncryptionService(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SimonCropp @indualagarsamy What do you think of this? I don't like this dependency of objects and configuration but don't know how to improve it. I read something about abstract factory but I don't know if this should be applied at this implementation.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ramonsmits sorry i dont understand what the problem is

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants