You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "Mridul Pathak (Jira)" <ji...@apache.org> on 2026/09/26 18:50:00 UTC
[jira] [Updated] (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:all-tabpanel ]
Mridul Pathak updated OFBIZ-13599:
----------------------------------
Fix Version/s: Upcoming Branch
> 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
> Fix For: Upcoming Branch
>
>
> 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)