CVE-2008-4094: Activerecord SQL Injection Vulnerability

HIGH
Advisory Identifier: GHSA-xf96-32q2-9rw2
CWE-89
Published
Advisory Summary

CVE-2008-4094 is a HIGH sql injection vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting Activerecord libraries in the RubyGems ecosystem. The issue involves rails activerecord gem vulnerable to sql injection. Remediation is available by upgrading affected packages to version 2.1.1.

CVE-2008-4094 at a Glance

CVE Identifier CVE-2008-4094
GHSA Identifier GHSA-xf96-32q2-9rw2
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
Package Ecosystem RubyGems
Published Date
Last Updated

How to Fix CVE-2008-4094

To remediate this vulnerability, upgrade all affected Activerecord 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 fixed: 2.1.1
Upgrade activerecord to 2.1.1
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

How to Check if You Are Affected

To determine whether your application is affected by CVE-2008-4094, inspect your project dependencies for Activerecord:

inspect dependencies for activerecord

Analyze the terminal output to locate any version of Activerecord in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.1.1), 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, 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

Multiple SQL injection vulnerabilities in Ruby on Rails before 2.1.1 allow remote attackers to execute arbitrary SQL commands via the (1) `:limit` and (2) `:offset` parameters, related to ActiveRecord, ActiveSupport, ActiveResource, ActionPack, and ActionMailer.

CVE-2008-4094 Affected Activerecord Versions

1 component(s)
Fixed Versions:
2.1.1
Product / Package Ecosystem Affected Versions Fixed Version
activerecord
RubyGems
< 2.1.1
2.1.1

References

NVD — CVE-2008-4094 NVD
https://nvd.nist.gov/vuln/detail/CVE-2008-4094
Security Fix Commit FIX COMMIT
https://github.com/rails/rails/commit/ef0ea782b1f5cf7b08e74ea3002a16c708f66645
exchange.xforce.ibmcloud.com/vulnerabilities/451... WEB
https://exchange.xforce.ibmcloud.com/vulnerabilities/45109
Activerecord Source Repository REPOSITORY
https://github.com/rails/rails
Activerecord Source Repository REPOSITORY
https://github.com/rubysec/ruby-advisory-db/blob/master/gems/activerecord/CVE-2008-4094.yml
web.archive.org/web/20080620000955/... WEB
https://web.archive.org/web/20080620000955/http://blog.innerewut.de/2008/6/16/why-you-should-upgrade-to-rails-2-1
web.archive.org/web/20080620201733/... WEB
https://web.archive.org/web/20080620201733/http://blog.innerewut.de/files/rails/activerecord-1.15.3.patch
web.archive.org/web/20080620201744/... WEB
https://web.archive.org/web/20080620201744/http://blog.innerewut.de/files/rails/activerecord-2.0.2.patch
web.archive.org/web/20081104151751/... WEB
https://web.archive.org/web/20081104151751/http://gist.github.com/8946
web.archive.org/web/20081113122736/... WEB
https://web.archive.org/web/20081113122736/http://secunia.com/advisories/31875
web.archive.org/web/20081207211431/... WEB
https://web.archive.org/web/20081207211431/http://secunia.com/advisories/31909
web.archive.org/web/20081207211436/... WEB
https://web.archive.org/web/20081207211436/http://secunia.com/advisories/31910
web.archive.org/web/20091101000000*... WEB
https://web.archive.org/web/20091101000000*/http://www.vupen.com/english/advisories/2008/2562
Activerecord Security Information SECURITY
https://web.archive.org/web/20120120194518/http://www.securityfocus.com/bid/31176
Activerecord Security Information SECURITY
https://web.archive.org/web/20201207112829/http://www.securitytracker.com/id?1020871
Activerecord Security Information SECURITY
http://lists.opensuse.org/opensuse-security-announce/2008-12/msg00002.html
rails.lighthouseapp.com/projects/8994/ticke... WEB
http://rails.lighthouseapp.com/projects/8994/tickets/288
rails.lighthouseapp.com/projects/8994/ticke... WEB
http://rails.lighthouseapp.com/projects/8994/tickets/964
Activerecord Security Information SECURITY
http://www.openwall.com/lists/oss-security/2008/09/13/2
Activerecord Security Information SECURITY
http://www.openwall.com/lists/oss-security/2008/09/16/1
Activerecord Security Information SECURITY
http://www.rorsecurity.info/2008/09/08/sql-injection-issue-in-limit-and-offset-parameter

Frequently Asked Questions

What is CVE-2008-4094?
CVE-2008-4094 is a security vulnerability in Activerecord involving Rails ActiveRecord gem vulnerable to SQL injection under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
Which Activerecord versions are affected?
Affected versions include releases prior to 2.1.1 across affected packages: activerecord.
What version fixes CVE-2008-4094?
Upgrading to 2.1.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is activerecord affected?
Yes, activerecord is affected in releases prior to 2.1.1. Upgrade your dependency to 2.1.1 or later.
What CWE is associated with CVE-2008-4094?
CVE-2008-4094 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 CVE-2008-4094?
Run the dependency tree command: 'inspect dependencies for activerecord'. 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-xf96-32q2-9rw2",
  "modified" : "2023-05-26T16:40:08Z",
  "published" : "2017-10-24T18:33:38Z",
  "aliases" : [ "CVE-2008-4094" ],
  "summary" : "Rails ActiveRecord gem vulnerable to SQL injection",
  "details" : "Multiple SQL injection vulnerabilities in Ruby on Rails before 2.1.1 allow remote attackers to execute arbitrary SQL commands via the (1) `:limit` and (2) `:offset` parameters, related to ActiveRecord, ActiveSupport, ActiveResource, ActionPack, and ActionMailer.",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "activerecord"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.1.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2008-4094"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rails/rails/commit/ef0ea782b1f5cf7b08e74ea3002a16c708f66645"
  }, {
    "type" : "WEB",
    "url" : "https://exchange.xforce.ibmcloud.com/vulnerabilities/45109"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/rails/rails"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/activerecord/CVE-2008-4094.yml"
  }, {
    "type" : "WEB",
    "url" : "https://web.archive.org/web/20080620000955/http://blog.innerewut.de/2008/6/16/why-you-should-upgrade-to-rails-2-1"
  }, {
    "type" : "WEB",
    "url" : "https://web.archive.org/web/20080620201733/http://blog.innerewut.de/files/rails/activerecord-1.15.3.patch"
  }, {
    "type" : "WEB",
    "url" : "https://web.archive.org/web/20080620201744/http://blog.innerewut.de/files/rails/activerecord-2.0.2.patch"
  }, {
    "type" : "WEB",
    "url" : "https://web.archive.org/web/20081104151751/http://gist.github.com/8946"
  }, {
    "type" : "WEB",
    "url" : "https://web.archive.org/web/20081113122736/http://secunia.com/advisories/31875"
  }, {
    "type" : "WEB",
    "url" : "https://web.archive.org/web/20081207211431/http://secunia.com/advisories/31909"
  }, {
    "type" : "WEB",
    "url" : "https://web.archive.org/web/20081207211436/http://secunia.com/advisories/31910"
  }, {
    "type" : "WEB",
    "url" : "https://web.archive.org/web/20091101000000*/http://www.vupen.com/english/advisories/2008/2562"
  }, {
    "type" : "WEB",
    "url" : "https://web.archive.org/web/20120120194518/http://www.securityfocus.com/bid/31176"
  }, {
    "type" : "WEB",
    "url" : "https://web.archive.org/web/20201207112829/http://www.securitytracker.com/id?1020871"
  }, {
    "type" : "WEB",
    "url" : "http://lists.opensuse.org/opensuse-security-announce/2008-12/msg00002.html"
  }, {
    "type" : "WEB",
    "url" : "http://rails.lighthouseapp.com/projects/8994/tickets/288"
  }, {
    "type" : "WEB",
    "url" : "http://rails.lighthouseapp.com/projects/8994/tickets/964"
  }, {
    "type" : "WEB",
    "url" : "http://www.openwall.com/lists/oss-security/2008/09/13/2"
  }, {
    "type" : "WEB",
    "url" : "http://www.openwall.com/lists/oss-security/2008/09/16/1"
  }, {
    "type" : "WEB",
    "url" : "http://www.rorsecurity.info/2008/09/08/sql-injection-issue-in-limit-and-offset-parameter"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-89" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-06-16T22:03:04Z",
    "nvd_published_at" : "2008-09-30T17:22:09Z"
  }
}