CVE-2022-35956 update_by_case before 0.1.3 vulnerable to sql injection

Medium 5.8 Published Updated

Attackers can execute arbitrary SQL commands via unsanitized inputs in the update_by_case gem, potentially reading or modifying database records.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
A user has to click or open something
Fix
Available

What is CVE-2022-35956?

CVE-2022-35956 is a medium-severity SQL injection vulnerability in camilova activerecord-update-by-case, published on 12 Aug 2022. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

Official 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.

Weakness: CWE-89

Which versions are affected by CVE-2022-35956?

2 open source packages ship an affected version, including update_by_case. It affects 1 product.

PackageAffectedFixed in
update_by_case RubyGemsAll versions0.1.3
update_by_case RubyGemsAll versions0.1.3

Products include Update by Case Project Update by Case.

How do I fix CVE-2022-35956?

Upgrade update_by_case to 0.1.3 or later.

Use parameterised queries everywhere and never build SQL by joining strings. Upgrade affected software first; a web application firewall only buys time. More about SQL injection.

Is CVE-2022-35956 being exploited?

There is no known exploitation of CVE-2022-35956 in the wild and no public exploit code.

Sources

Also known as GHSA-33wh-w4m7-c6r8.

Is CVE-2022-35956 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free