Vulnerabilities in pkg:gem/activerecord-jdbc-adapter

PACKAGE
Advisory Summary

GHSA-5qw5-wf2q-f538 is a HIGH sql injection vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting Activerecord jdbc adapter libraries in the RubyGems ecosystem. The issue involves activerecord-jdbc-adapter (ar-jdbc) lib/arjdbc/jdbc/adapter.rb sql.gsub() function sql injection. Remediation is available by upgrading affected packages to version 1.2.8.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:gem/activerecord-jdbc-adapter

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:gem/activerecord-jdbc-adapter. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-5qw5-wf2q-f538 - HIGH ActiveRecord-JDBC-Adapter (AR-JDBC) lib/arjdbc/jdbc/adapter.rb sql.gsub() Function SQL Injection

GHSA-5qw5-wf2q-f538 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-5qw5-wf2q-f538
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
Affected Product Activerecord jdbc adapter
Package Ecosystem RubyGems
Published Date
Last Updated

How to Fix GHSA-5qw5-wf2q-f538

To remediate this vulnerability, upgrade all affected Activerecord jdbc adapter dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

activerecord-jdbc-adapter fixed: 1.2.8
Upgrade activerecord-jdbc-adapter to 1.2.8
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for activerecord-jdbc-adapter

How to Check if You Are Affected

To determine whether your application is affected by GHSA-5qw5-wf2q-f538, inspect your project dependencies for Activerecord jdbc adapter:

inspect dependencies for activerecord-jdbc-adapter

Analyze the terminal output to locate any version of Activerecord jdbc adapter in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.2.8), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where the product constructs all or part of an sql command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended sql command when it is sent to a downstream component. without sufficient removal or quoting of sql syntax in user-controllable inputs, the generated sql query can cause those inputs to be interpreted as sql instead of ordinary user data. In Activerecord jdbc adapter, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

ActiveRecord-JDBC-Adapter (AR-JDBC) contains a flaw that may allow carrying out an SQL injection attack. The issue is due to the sql.gsub() function in lib/arjdbc/jdbc/adapter.rb not properly sanitizing user-supplied input before using it in SQL queries. This may allow a remote attacker to inject or manipulate SQL queries in the back-end database, allowing for the manipulation or disclosure of arbitrary data.

GHSA-5qw5-wf2q-f538 Affected Activerecord jdbc adapter Versions

1 component(s)
Fixed Versions:
1.2.8
Product / Package Ecosystem Affected Versions Fixed Version
activerecord-jdbc-adapter
RubyGems
< 1.2.8
1.2.8

References

Frequently Asked Questions

What is GHSA-5qw5-wf2q-f538?
GHSA-5qw5-wf2q-f538 is a security vulnerability in Activerecord jdbc adapter involving ActiveRecord-JDBC-Adapter (AR-JDBC) lib/arjdbc/jdbc/adapter.rb sql.gsub() Function SQL Injection under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
Which Activerecord jdbc adapter versions are affected?
Affected versions include releases prior to 1.2.8 across affected packages: activerecord-jdbc-adapter.
What version fixes GHSA-5qw5-wf2q-f538?
Upgrading to 1.2.8 (or the latest patched release for your respective branch) resolves the vulnerability.
Is activerecord-jdbc-adapter affected?
Yes, activerecord-jdbc-adapter is affected in releases prior to 1.2.8. Upgrade your dependency to 1.2.8 or later.
What CWE is associated with GHSA-5qw5-wf2q-f538?
GHSA-5qw5-wf2q-f538 is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') (The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data.).
How can I check RubyGems dependencies for GHSA-5qw5-wf2q-f538?
Run the dependency tree command: 'inspect dependencies for activerecord-jdbc-adapter'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-5qw5-wf2q-f538",
  "modified" : "2026-01-21T16:35:36Z",
  "published" : "2026-01-16T19:20:40Z",
  "aliases" : [ ],
  "summary" : "ActiveRecord-JDBC-Adapter (AR-JDBC) lib/arjdbc/jdbc/adapter.rb sql.gsub() Function SQL Injection",
  "details" : "ActiveRecord-JDBC-Adapter (AR-JDBC) contains a flaw that may allow carrying out an SQL injection attack. The issue is due to the sql.gsub() function in lib/arjdbc/jdbc/adapter.rb not properly sanitizing user-supplied input before using it in SQL queries. This may allow a remote attacker to inject or manipulate SQL queries in the back-end database, allowing for the manipulation or disclosure of arbitrary data.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N/E:P"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "activerecord-jdbc-adapter"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.2.8"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/jruby/activerecord-jdbc-adapter/issues/322"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/jruby/activerecord-jdbc-adapter"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/jruby/activerecord-jdbc-adapter/blob/master/lib/arjdbc/jdbc/adapter.rb"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/activerecord-jdbc-adapter/GHSA-5qw5-wf2q-f538.yml"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/activerecord-jdbc-adapter/OSVDB-114854.yml"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-89" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-01-16T19:20:40Z",
    "nvd_published_at" : null
  }
}