CVE-2022-35956
update_by_case before 0.1.3 can be vulnerable to sql injection
Severity by source
Trivy's own label is CRITICAL. Rated critical by NVD. Rated lower by GHSA (medium), Ruby Advisory DB (medium).
Description
This Rails gem adds two methods to the ActiveRecord::Base class that allow you to update many records on a single database hit, using a case sql statement for it. Before version 0.1.3 `update_by_case` gem used custom sql strings, and it was not sanitized, making it vulnerable to sql injection. Upgrade to version >= 0.1.3 that uses `Arel` instead to construct the resulting sql statement, with sanitized sql.
Affected packages and fixed versions
| Source | Package | Fixed in |
|---|---|---|
| rubygems::GitHub Security Advisory RubyGems | update_by_case | 0.1.3 |
| rubygems::Ruby Advisory Database | update_by_case | >= 0.1.3 |
References
- https://github.com/camilova/activerecord-update-by-case
- https://github.com/camilova/activerecord-update-by-case/releases/tag/v0.1.3-stable
- https://github.com/camilova/activerecord-update-by-case/security/advisories/GHSA-33wh-w4m7-c6r8
- https://github.com/rubysec/ruby-advisory-db/blob/master/gems/update_by_case/CVE-2022-35956.yml
- https://nvd.nist.gov/vuln/detail/CVE-2022-35956