CVE-2013-4662: Civicrm/civicrm core SQL Injection Vulnerability

MODERATE
Advisory Identifier: GHSA-4465-r2hg-v4rj
CWE-89
Published
Advisory Summary

CVE-2013-4662 is a MODERATE sql injection vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting Civicrm/civicrm core libraries in the Packagist ecosystem. The issue involves civicrm sql injection vulnerability via quick search api. Remediation is available by upgrading affected packages to version 4.2.9, 4.3.3.

CVE-2013-4662 at a Glance

CVE Identifier CVE-2013-4662
GHSA Identifier GHSA-4465-r2hg-v4rj
Severity MODERATE
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 Civicrm/civicrm core
Package Ecosystem Packagist
Published Date
Last Updated

How to Fix CVE-2013-4662

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

civicrm/civicrm-core fixed: 4.2.9
Upgrade civicrm/civicrm-core to 4.2.9
civicrm/civicrm-core fixed: 4.3.3
Upgrade civicrm/civicrm-core to 4.3.3
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 civicrm/civicrm-core

How to Check if You Are Affected

To determine whether your application is affected by CVE-2013-4662, inspect your project dependencies for Civicrm/civicrm core:

inspect dependencies for civicrm/civicrm-core

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

The Quick Search API in CiviCRM 4.2.0 through 4.2.9 and 4.3.0 through 4.3.3 allows remote authenticated users to bypass the validation layer and conduct SQL injection attacks via a direct request to the "second layer" of the API, related to contact.getquick.

CVE-2013-4662 Affected Civicrm/civicrm core Versions

2 component(s)
Fixed Versions:
4.2.94.3.3
Product / Package Ecosystem Affected Versions Fixed Version
civicrm/civicrm-core
Packagist
≥ 4.2.0
< 4.2.9
4.2.9
civicrm/civicrm-core
Packagist
≥ 4.3.0
< 4.3.3
4.3.3

References

Frequently Asked Questions

What is CVE-2013-4662?
CVE-2013-4662 is a security vulnerability in Civicrm/civicrm core involving CiviCRM SQL injection vulnerability via Quick Search API under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
Which Civicrm/civicrm core versions are affected?
Affected versions include releases prior to 4.2.9, 4.3.3 across affected packages: civicrm/civicrm-core.
What version fixes CVE-2013-4662?
Upgrading to 4.2.9, 4.3.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is civicrm/civicrm-core affected?
Yes, civicrm/civicrm-core is affected in releases prior to 4.2.9, 4.3.3. Upgrade your dependency to 4.2.9, 4.3.3 or later.
What CWE is associated with CVE-2013-4662?
CVE-2013-4662 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 Packagist dependencies for CVE-2013-4662?
Run the dependency tree command: 'inspect dependencies for civicrm/civicrm-core'. 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-4465-r2hg-v4rj",
  "modified" : "2023-08-29T18:45:53Z",
  "published" : "2022-05-17T04:52:06Z",
  "aliases" : [ "CVE-2013-4662" ],
  "summary" : "CiviCRM SQL injection vulnerability via Quick Search API",
  "details" : "The Quick Search API in CiviCRM 4.2.0 through 4.2.9 and 4.3.0 through 4.3.3 allows remote authenticated users to bypass the validation layer and conduct SQL injection attacks via a direct request to the \"second layer\" of the API, related to contact.getquick.",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "civicrm/civicrm-core"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.2.0"
      }, {
        "fixed" : "4.2.9"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "civicrm/civicrm-core"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.3.0"
      }, {
        "fixed" : "4.3.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2013-4662"
  }, {
    "type" : "WEB",
    "url" : "https://civicrm.org/advisory/civi-sa-2013-004-limited-sql-injection-quick-search-api"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/civicrm/civicrm-core"
  }, {
    "type" : "WEB",
    "url" : "https://issues.civicrm.org/jira/browse/CRM-12765"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-89" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-08-29T18:45:53Z",
    "nvd_published_at" : "2014-01-29T18:55:00Z"
  }
}