[SERVER-47733] SymmetricEncryptorWindows shouldn't pad when update is called Created: 23/Apr/20  Updated: 29/Oct/23  Resolved: 25/Jun/20

Status: Closed
Project: Core Server
Component/s: Security
Affects Version/s: None
Fix Version/s: 4.2.9, 4.4.1, 4.7.0, 4.0.21

Type: Bug Priority: Major - P3
Reporter: Adam Cooper (Inactive) Assignee: Adam Cooper (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v4.4, v4.2, v4.0
Sprint: Security 2020-05-04, Security 2020-05-18, Security 2020-06-01, Security 2020-06-15, Security 2020-06-29
Participants:
Linked BF Score: 16

 Description   

Currently, the Windows BCryptEncrypt function is called with padding enabled every time SymmetricEncryptorWindows::update is called. This means that if it adds padding and then is called again, there is padding stuck in the middle of the encrypted buffer that won't be removed upon decryption.

Instead, SymmetricEncryptorWindows should maintain its own buffer equal to one block width, and only flush it to BCryptEncrypt when it is full, with no padding. SymmetricEncryptorWindows::finalize will also be refactored to make one last call to BCryptEncrypt, to encrypt whatever is left in the buffer, with padding enabled.



 Comments   
Comment by Githook User [ 03/Sep/20 ]

Author:

{'name': 'Mark Benvenuto', 'email': 'mark.benvenuto@mongodb.com', 'username': 'markbenvenuto'}

Message: SERVER-47733 Fix build
Branch: v4.0
https://github.com/10gen/mongo-enterprise-modules/commit/cadd6b54dd259e52ba79b31375ea4a2df2c269a1

Comment by Githook User [ 28/Aug/20 ]

Author:

{'name': 'Adam Cooper', 'email': 'adam.cooper@mongodb.com', 'username': 'super-cooper'}

Message: SERVER-47733 SymmetricEncryptorWindows shouldn't pad when update is called

(cherry picked from commit 2f6e5d0f94c06fde943ed6a25a9b7ecf6f774ce5)
Branch: v4.0
https://github.com/mongodb/mongo/commit/68ea7fc139fa26ffbf26265b43b6ba68d5a281e8

Comment by Githook User [ 28/Aug/20 ]

Author:

{'name': 'Adam Cooper', 'email': 'adam.cooper@mongodb'}

Message: SERVER-47733 SymmetricEncryptorWindows shouldn't pad when update is called

(cherry picked from commit b11222096cdbe34a5c479613a2a1fd268663f721)
Branch: v4.0
https://github.com/10gen/mongo-enterprise-modules/commit/b83160459639161e73148aea2601b1aee3eaadb0

Comment by Githook User [ 24/Aug/20 ]

Author:

{'name': 'Adam Cooper', 'email': 'adam.cooper@mongodb.com', 'username': 'super-cooper'}

Message: SERVER-47733 SymmetricEncryptorWindows shouldn't pad when update is called

(cherry picked from commit 2f6e5d0f94c06fde943ed6a25a9b7ecf6f774ce5)
Branch: v4.4
https://github.com/mongodb/mongo/commit/4f4adc1cf23281036dc4d9b61eb24c538e1d9863

Comment by Githook User [ 24/Aug/20 ]

Author:

{'name': 'Adam Cooper', 'email': 'adam.cooper@mongodb'}

Message: SERVER-47733 SymmetricEncryptorWindows shouldn't pad when update is called

(cherry picked from commit b11222096cdbe34a5c479613a2a1fd268663f721)
Branch: v4.4
https://github.com/10gen/mongo-enterprise-modules/commit/55008d4a3e9ba0ea6a863792284b1234fe4b21a0

Comment by Githook User [ 14/Jul/20 ]

Author:

{'name': 'Adam Cooper', 'email': 'adam.cooper@mongodb.com', 'username': 'super-cooper'}

Message: SERVER-47733 SymmetricEncryptorWindows shouldn't pad when update is called

(cherry picked from commit 2f6e5d0f94c06fde943ed6a25a9b7ecf6f774ce5)
Branch: v4.2
https://github.com/mongodb/mongo/commit/5930b503079130f0df11415dc76d196755524ee5

Comment by Githook User [ 14/Jul/20 ]

Author:

{'name': 'Adam Cooper', 'email': 'adam.cooper@mongodb'}

Message: SERVER-47733 SymmetricEncryptorWindows shouldn't pad when update is called

(cherry picked from commit b11222096cdbe34a5c479613a2a1fd268663f721)
Branch: v4.2
https://github.com/10gen/mongo-enterprise-modules/commit/53420a985a32f66db51197ea7eb239371d8287e8

Comment by Githook User [ 25/Jun/20 ]

Author:

{'name': 'Adam Cooper', 'email': 'adam.cooper@mongodb.com', 'username': 'super-cooper'}

Message: SERVER-47733 SymmetricEncryptorWindows shouldn't pad when update is called
Branch: master
https://github.com/mongodb/mongo/commit/2f6e5d0f94c06fde943ed6a25a9b7ecf6f774ce5

Comment by Githook User [ 25/Jun/20 ]

Author:

{'name': 'Adam Cooper', 'email': 'adam.cooper@mongodb'}

Message: SERVER-47733 SymmetricEncryptorWindows shouldn't pad when update is called
Branch: master
https://github.com/10gen/mongo-enterprise-modules/commit/b11222096cdbe34a5c479613a2a1fd268663f721

Generated at Thu Feb 08 05:15:04 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.