CVE-2026-45376
Decidim: Admin user search allows SQL injection through similarity-based sorting
Decidim is a participatory democracy framework. Prior to 0.30.9, from 0.31.0 before 0.31.5, and in 0.32.0.rc1 before 0.32.0.rc2, the GET /admin/organization/users search interpolates params[:term] into raw Arel.sql ORDER BY similarity expressions before sanitization, allowing an authenticated organization administrator to execute blind PostgreSQL expressions and infer data through timing differences. This issue is fixed in versions 0.30.9, 0.31.5, and 0.32.0.rc2.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- Low
- Privileges needed
- High
- User interaction
- None
What an attacker can affect
- Confidentiality
- High
- Integrity
- None
- Availability
- Low
Exploit likelihood
What each source reports
CVE List Score used
5.5
Decidim: Admin user search allows SQL injection through similarity-based sorting
Decidim is a participatory democracy framework. Prior to 0.30.9, from 0.31.0 before 0.31.5, and in 0.32.0.rc1 before 0.32.0.rc2, the GET /admin/organization/users search interpolates params[:term] into raw Arel.sql ORDER BY similarity expressions before sanitization, allowing an authenticated organization administrator to execute blind PostgreSQL expressions and infer data through timing differences. This issue is fixed in versions 0.30.9, 0.31.5, and 0.32.0.rc2.
- Record
CVE-2026-45376- CVSS 3.1
- 5.5 Medium
CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:N/A:L - Weakness
- CWE-89
- Updated
- 2026-11-02
EUVDEUVD-2026-51678
5.5
Decidim is a participatory democracy framework. Prior to 0.30.9, from 0.31.0 before 0.31.5, and in 0.32.0.rc1 before 0.32.0.rc2, the GET /admin/organization/users search interpolates params[:term] into raw Arel.sql ORDER BY similarity expressions before sanitization, allowing an authenticated organization administrator to execute blind PostgreSQL expressions and infer data through timing differences. This issue is fixed in versions 0.30.9, 0.31.5, and 0.32.0.rc2.
- Record
EUVD-2026-51678- CVSS 3.1
- 5.5 Medium
CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:N/A:L - Updated
- 2026-11-02
GitHub AdvisoriesGHSA-jvqq-cvh4-xm37
6.8
Decidim: Admin user search allows SQL injection through similarity-based sorting
The admin organization user search uses the untrusted term value inside raw SQL ORDER BY expressions. Because the value is interpolated before Rails sanitization is applied, a crafted search string is executed by PostgreSQL as part of the sort expression.
Technical description
The vulnerable endpoint is exposed as GET /admin/organization/users in decidim-admin/config/routes.rb:
resource :organization, only: [:edit, :update], controller: "organization" do
member do
get :users
end
end
That route reaches Decidim::Admin::OrganizationController#users, which forwards the current organization's available users into search:
def users
search(current_organization.users.available)
end
Inside search, the attacker-controlled source is params[:term]:
if (term = params[:term].to_s).present?
The query has two branches. In both branches, the WHERE predicates use bind parameters and are not the injection sink. The vulnerability is in the subsequent .order(Arel.sql(...)) calls, where the untrusted value is interpolated directly into SQL string literals.
Nickname branch:
nickname = term.delete("@")
relation.where("nickname LIKE ?", "#{nickname}%")
.order(Arel.sql(ActiveRecord::Base.sanitize_sql_array("similarity(nickname, '#{nickname}') DESC")))
Name/email branch:
relation.where("name ILIKE ?", "%#{term}%").or(
relation.where("email ILIKE ?", "%#{term}%")
)
.order(Arel.sql(ActiveRecord::Base.sanitize_sql_array("GREATEST(similarity(name, '#{term}'), similarity(email, '#{term}')) DESC")))
.order(Arel.sql(ActiveRecord::Base.sanitize_sql_array("(similarity(name, '#{term}') + similarity(email, '#{term}')) / 2 DESC")))
This use of sanitize_sql_array does not make the code safe. The interpolation happens first, so Rails receives an already-built SQL string rather than a statement with bind placeholders. As a result, a quote in term can terminate the intended string literal and inject attacker-controlled SQL into the ORDER BY expression.
For example, a payload such as slpleak '), COALESCE((SELECT 1 FROM pg_sleep(21)),0)) -- produces a fragment equivalent to:
GREATEST(similarity(name, 'slpleak '), COALESCE((SELECT 1 FROM pg_sleep(21)),0)) --'), similarity(email, 'slpleak '), COALESCE((SELECT 1 FROM pg_sleep(21)),0)) --')) DESC
The injected subquery is therefore evaluated by PostgreSQL as SQL, not treated purely as data. Because the sink is in ORDER BY, the endpoint can still return a normal 200 OK response while exposing the issue through measurable timing differences.
Source-to-sink chain:
- Source:
params[:term] - Propagation:
term = params[:term].to_s - Sink:
.order(Arel.sql(... "#{term}" ...))and.order(Arel.sql(... "#{nickname}" ...)) - Effect: attacker-controlled SQL is executed inside the database sort expression
Reproduction steps:
- Authenticate as an organization admin.
- Ensure the search returns at least one row for the chosen payload. For a deterministic test, create a temporary
user whose
name,email, ornicknamematches the probe string. - Send a control request to
GET /admin/organization/users?term=testwithAccept: application/jsonand record the response time. - Send a payload request such as
GET /admin/organization/users?term=slpleak%20%27%29%2C%20COALESCE%28%28SELECT%201%20FROM%20pg_sleep%2821%29%29%2C0%29%29%20--withAccept: application/json. - Observe that the endpoint still responds successfully, but the response time increases by approximately the sleep
interval, demonstrating time-based SQL execution in the
ORDER BYclause.
Impact
- Exploitation requires an authenticated admin session, which limits exposure but does not remove the underlying SQL injection risk.
- An authenticated admin can inject arbitrary SQL expressions into the query's
ORDER BYclause and use timing differences as a blind SQL oracle. - The injection happens inside a database…
- Record
GHSA-jvqq-cvh4-xm37- CVSS 3.1
- 6.8 Medium
CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:N/A:N - Weakness
- CWE-89
- Updated
- 2026-11-02
NVD
5.5
Decidim is a participatory democracy framework. Prior to 0.30.9, from 0.31.0 before 0.31.5, and in 0.32.0.rc1 before 0.32.0.rc2, the GET /admin/organization/users search interpolates params[:term] into raw Arel.sql ORDER BY similarity expressions before sanitization, allowing an authenticated organization administrator to execute blind PostgreSQL expressions and infer data through timing differences. This issue is fixed in versions 0.30.9, 0.31.5, and 0.32.0.rc2.
- Record
CVE-2026-45376- CVSS 3.1
- 5.5 Medium
CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:N/A:L - Weakness
- CWE-89
- Updated
- 2026-11-02
OSV
5.5
Decidim: Admin user search allows SQL injection through similarity-based sorting
Decidim is a participatory democracy framework. Prior to 0.30.9, from 0.31.0 before 0.31.5, and in 0.32.0.rc1 before 0.32.0.rc2, the GET /admin/organization/users search interpolates params[:term] into raw Arel.sql ORDER BY similarity expressions before sanitization, allowing an authenticated organization administrator to execute blind PostgreSQL expressions and infer data through timing differences. This issue is fixed in versions 0.30.9, 0.31.5, and 0.32.0.rc2.
- Record
CVE-2026-45376- CVSS 3.1
- 5.5 Medium
CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:N/A:L - Weakness
- CWE-89
- Updated
- 2026-11-02
OSVGHSA-jvqq-cvh4-xm37
6.8
Decidim: Admin user search allows SQL injection through similarity-based sorting
The admin organization user search uses the untrusted term value inside raw SQL ORDER BY expressions. Because the value is interpolated before Rails sanitization is applied, a crafted search string is executed by PostgreSQL as part of the sort expression.
Technical description
The vulnerable endpoint is exposed as GET /admin/organization/users in decidim-admin/config/routes.rb:
resource :organization, only: [:edit, :update], controller: "organization" do
member do
get :users
end
end
That route reaches Decidim::Admin::OrganizationController#users, which forwards the current organization's available users into search:
def users
search(current_organization.users.available)
end
Inside search, the attacker-controlled source is params[:term]:
if (term = params[:term].to_s).present?
The query has two branches. In both branches, the WHERE predicates use bind parameters and are not the injection sink. The vulnerability is in the subsequent .order(Arel.sql(...)) calls, where the untrusted value is interpolated directly into SQL string literals.
Nickname branch:
nickname = term.delete("@")
relation.where("nickname LIKE ?", "#{nickname}%")
.order(Arel.sql(ActiveRecord::Base.sanitize_sql_array("similarity(nickname, '#{nickname}') DESC")))
Name/email branch:
relation.where("name ILIKE ?", "%#{term}%").or(
relation.where("email ILIKE ?", "%#{term}%")
)
.order(Arel.sql(ActiveRecord::Base.sanitize_sql_array("GREATEST(similarity(name, '#{term}'), similarity(email, '#{term}')) DESC")))
.order(Arel.sql(ActiveRecord::Base.sanitize_sql_array("(similarity(name, '#{term}') + similarity(email, '#{term}')) / 2 DESC")))
This use of sanitize_sql_array does not make the code safe. The interpolation happens first, so Rails receives an already-built SQL string rather than a statement with bind placeholders. As a result, a quote in term can terminate the intended string literal and inject attacker-controlled SQL into the ORDER BY expression.
For example, a payload such as slpleak '), COALESCE((SELECT 1 FROM pg_sleep(21)),0)) -- produces a fragment equivalent to:
GREATEST(similarity(name, 'slpleak '), COALESCE((SELECT 1 FROM pg_sleep(21)),0)) --'), similarity(email, 'slpleak '), COALESCE((SELECT 1 FROM pg_sleep(21)),0)) --')) DESC
The injected subquery is therefore evaluated by PostgreSQL as SQL, not treated purely as data. Because the sink is in ORDER BY, the endpoint can still return a normal 200 OK response while exposing the issue through measurable timing differences.
Source-to-sink chain:
- Source:
params[:term] - Propagation:
term = params[:term].to_s - Sink:
.order(Arel.sql(... "#{term}" ...))and.order(Arel.sql(... "#{nickname}" ...)) - Effect: attacker-controlled SQL is executed inside the database sort expression
Reproduction steps:
- Authenticate as an organization admin.
- Ensure the search returns at least one row for the chosen payload. For a deterministic test, create a temporary
user whose
name,email, ornicknamematches the probe string. - Send a control request to
GET /admin/organization/users?term=testwithAccept: application/jsonand record the response time. - Send a payload request such as
GET /admin/organization/users?term=slpleak%20%27%29%2C%20COALESCE%28%28SELECT%201%20FROM%20pg_sleep%2821%29%29%2C0%29%29%20--withAccept: application/json. - Observe that the endpoint still responds successfully, but the response time increases by approximately the sleep
interval, demonstrating time-based SQL execution in the
ORDER BYclause.
Impact
- Exploitation requires an authenticated admin session, which limits exposure but does not remove the underlying SQL injection risk.
- An authenticated admin can inject arbitrary SQL expressions into the query's
ORDER BYclause and use timing differences as a blind SQL oracle. - The injection happens inside a database…
- Record
GHSA-jvqq-cvh4-xm37- CVSS 3.1
- 6.8 Medium
CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:C/C:H/I:N/A:N - Weakness
- CWE-89
- Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
decidim-adminRubyGems |
before 0.30.9 | 0.30.9 |
decidim-adminRubyGems |
0.31.0.rc1 up to 0.31.5 | 0.31.5 |
decidim-adminRubyGems |
0.32.0.rc1 up to 0.32.0 | 0.32.0 |
decidim-adminRubyGems |
before 0.30.9, plus listed versions 0.0.10.0.1.alpha30.0.1.alpha40.0.1.alpha50.0.1.alpha6 Show 45 moreShow less0.0.1.alpha70.0.1.alpha80.0.1.alpha90.0.20.0.30.0.50.0.60.0.70.0.8.10.1.00.10.00.10.10.11.0.pre10.11.10.11.20.12.00.12.0.pre0.12.10.12.20.13.00.13.0.pre10.13.10.14.10.14.20.14.30.14.40.15.00.15.10.15.20.16.00.16.10.17.00.17.10.17.20.18.00.18.10.19.00.19.10.2.00.20.00.20.10.21.00.22.00.23.00.23.1 |
0.30.9 |
decidim-adminRubyGems |
0.31.0.rc1 up to 0.31.5, plus listed versions 0.31.00.31.0.rc20.31.10.31.20.31.30.31.4 |
0.31.5 |
decidim-adminRubyGems |
0.32.0.rc1 up to 0.32.0, plus listed versions 0.32.0.rc20.32.0.rc3 |
0.32.0 |
History
| Recorded | Changed | Sources |
|---|---|---|
| first indexed | CVE List, EUVD, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2026-45376 is a medium vulnerability (CVSS 5.5) in Decidim, published July 13, 2026. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.60%, the 48th percentile. Fixed in decidim-admin 0.30.9.
References
github.com/decidim/decidim/security/advisories/GHSA-jvqq-cvh4-xm37
github.com/decidim/decidim/commit/27335957b363516e23919a9006812f1c458c88e0
github.com/decidim/decidim/commit/e4d21b41fb462d9436035a043962a4090f2cc240
github.com/decidim/decidim/commit/f3817fac448a4e3facd6bcb346167048b3421124
github.com/decidim/decidim/releases/tag/v0.30.9
github.com/decidim/decidim/releases/tag/v0.31.5
Left out here: 110 versions and the rest of 2 source descriptions. The JSON record has them.