You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2026/09/23 09:37:00 UTC
[jira] [Commented] (OFBIZ-13599) EntityCrypto uses AES in ECB mode for encrypt="true" fields, producing deterministic ciphertext
[ https://issues.apache.org/jira/browse/OFBIZ-13599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18118296#comment-18118296 ]
ASF subversion and git services commented on OFBIZ-13599:
---------------------------------------------------------
Commit cae2bb65c1cdfdd26044e706a1d7f09bb445abe1 in ofbiz-framework's branch refs/heads/trunk from Mridul Pathak
[ https://gitbox.apache.org/repos/asf?p=ofbiz-framework.git;h=cae2bb65c1 ]
Fixed: EntityCrypto uses AES in ECB mode for encrypt="true" fields, producing deterministic ciphertext (OFBIZ-13599) (#2055)
- Route EncryptMethod.TRUE through the same cipher default already used by SALT, instead of forcing AES into ECB mode (no IV, deterministic ciphertext for identical plaintext). Keep the old ECB cipher only as a decrypt fallback for values written before this fix.
- Retire encrypt="salt" as a separate option, now redundant with encrypt="true".
- Fix reencryptFields (OFBIZ-6694): select the primary key alongside the target field so store() can find the row afterward, and skip view entities, since storing through a view fails.
- Remove encrypt="true" from FinAccount.finAccountCode: the field is used for exact-match lookup as a redemption code (FinAccountHelper.getFinAccountFromCode), which is incompatible with non-deterministic encryption. finAccountPin remains encrypted. Add decryptFinAccountCodes, in the accounting component (not framework/entityext, to avoid a framework-to-application dependency), to migrate existing ciphertext values back to plain text.
- Remove the cardNumber search parameter from the findOrders service and admin order search, since exact-match search against an encrypted field is no longer possible.
- Document the required post-upgrade migration steps.
> EntityCrypto uses AES in ECB mode for encrypt="true" fields, producing deterministic ciphertext
> -----------------------------------------------------------------------------------------------
>
> Key: OFBIZ-13599
> URL: https://issues.apache.org/jira/browse/OFBIZ-13599
> Project: OFBiz
> Issue Type: Bug
> Components: framework/entity
> Affects Versions: Upcoming Branch, 24.09.07
> Reporter: Mridul Pathak
> Assignee: Mridul Pathak
> Priority: Major
>
> h3. Problem
> {{EntityCrypto}}'s {{ShiroStorageHandler}} explicitly configures its AES cipher with
> {{cipherService.setMode(OperationMode.ECB)}} for the {{EncryptMethod.TRUE}} case, used by
> every entity field with {{encrypt="true"}} in entitydef XML. ECB mode has no initialization
> vector and is deterministic: identical plaintext under the same key always produces
> identical ciphertext. The {{EncryptMethod.SALT}} path ({{encrypt="salt"}}) does not override
> the cipher mode and gets Shiro's own default (GCM, authenticated encryption with a random
> nonce) for free -- but {{encrypt="salt"}} is currently used only in the test entity model,
> never by a real entity, so effectively every encrypted field in production goes through the
> weaker ECB path.
> h3. Proposed fix
> * Remove the explicit {{setMode(OperationMode.ECB)}} override so {{EncryptMethod.TRUE}}
> falls through to the same safe default already used by {{SALT}}.
> * Retire {{encrypt="salt"}} as a separate option now that it is redundant with
> {{encrypt="true"}}; update {{entitymodel_test.xml}} accordingly.
> * {{decryptValue}} needs to keep decrypting legacy ECB-encrypted values as a fallback until
> they are migrated, mirroring the existing 3-DES fallback retained since the 2015 AES
> rewrite.
> * Fix the existing {{reencryptFields}} service (see OFBIZ-6694) so it can serve as the
> migration path -- it currently selects only the target field and omits the primary key,
> causing {{store()}} to fail after re-encryption.
> * Upgrade documentation should clearly instruct operators to run the migration after
> upgrading.
> h3. Acceptance criteria
> * New values written via {{encrypt="true"}} are no longer deterministic.
> * Existing ECB-encrypted values remain decryptable until migrated.
> * {{reencryptFields}} successfully re-encrypts existing rows without throwing
> {{GenericEntityNotFoundException}}.
> * {{encrypt="salt"}} is removed as a distinct option; {{entitymodel_test.xml}} updated to
> use {{encrypt="true"}}.
> * Upgrade notes documented.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)