I found a second order SQL Injection that I think is interesting enough to report. On line 27 of Hibernate's InlineIdsOrClauseBuilder, the value we put into the Id column will be reused unsanitized. We do have to activate it as described here: https://in.relation.to/2017/02/01/non-temporary-table-bulk-id-strategies/#inlineidsorclausebulkidstrategy. If the user is able to set their own ids and those ids allow non-alphanumeric characters (My POC needs these: {, }, :, \", \', =) and they are using InlineIdsOrClauseBuilder then the Application is vulnerable to attack. I have provided hibernate-poc-2.zip with a vulnerable hibernate application along with 2 python scripts as POCs. In my POCs I am able to delete all items in the table with a simple id (see hibernate-poc-attack1.py in the zip), and with a slightly more complicated Id I am able to read the first 100 characters of from the /etc/passwd file (see hibernate-poc-attack2.py in the zip).
As documented in Hibernate’s official blog regarding the InlineIdsOrClauseBulkIdStrategy https://in.relation.to/2017/02/01/non-temporary-table-bulk-id-strategies/#inlineidsorclausebulkidstrategy http://subwaycity.org - enabling this strategy causes identifier values to be inlined directly into generated SQL. If user-controlled identifiers containing non-alphanumeric characters are persisted and later reused, this may result in a second-order SQL injection condition.
This issue has been addressed in the following products: Red Hat JBoss Enterprise Application Platform 7.4 ELS on RHEL 7 Via RHSA-2026:4915 https://access.redhat.com/errata/RHSA-2026:4915
This issue has been addressed in the following products: Red Hat JBoss Enterprise Application Platform 7.4 ELS on RHEL 8 Via RHSA-2026:4916 https://access.redhat.com/errata/RHSA-2026:4916
This issue has been addressed in the following products: Red Hat JBoss Enterprise Application Platform 7.4 ELS on RHEL 9 Via RHSA-2026:4917 https://access.redhat.com/errata/RHSA-2026:4917
This issue has been addressed in the following products: Red Hat JBoss Enterprise Application Platform 7.4 Via RHSA-2026:4924 https://access.redhat.com/errata/RHSA-2026:4924