CVE-2012-0796: Phpmailer/phpmailer PHPMailer Vulnerable To Email Header Vulnerability

HIGH
Advisory Identifier: GHSA-398j-f7m7-795j
CWE-94
Published
Advisory Summary

CVE-2012-0796 is a HIGH phpmailer vulnerable to email header vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Phpmailer/phpmailer libraries in the Packagist ecosystem. The issue involves phpmailer vulnerable to email header injection. Remediation is available by upgrading affected packages to version 2.2.1.

CVE-2012-0796 at a Glance

CVE Identifier CVE-2012-0796
GHSA Identifier GHSA-398j-f7m7-795j
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-94: Improper Control of Generation of Code ('Code Injection')
Affected Product Phpmailer/phpmailer
Package Ecosystem Packagist
Published Date
Last Updated

How to Fix CVE-2012-0796

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

phpmailer/phpmailer fixed: 2.2.1
Upgrade phpmailer/phpmailer to 2.2.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 phpmailer/phpmailer

How to Check if You Are Affected

To determine whether your application is affected by CVE-2012-0796, inspect your project dependencies for Phpmailer/phpmailer:

inspect dependencies for phpmailer/phpmailer

Analyze the terminal output to locate any version of Phpmailer/phpmailer in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.2.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-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. In Phpmailer/phpmailer, 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

### Impact Arbitrary additional email headers can be injected via crafted From or Sender headers. ### Patches Fixed in 2.2.1 ### Workarounds Filter user-supplied values prior to using them in From or Sender properties. ### References https://nvd.nist.gov/vuln/detail/CVE-2012-0796 ### For more information If you have any questions or comments about this advisory: * Open a private issue in [the PHPMailer project](https://github.com/PHPMailer/PHPMailer)

CVE-2012-0796 Affected Phpmailer/phpmailer Versions

1 component(s)
Fixed Versions:
2.2.1
Product / Package Ecosystem Affected Versions Fixed Version
phpmailer/phpmailer
Packagist
< 2.2.1
2.2.1

References

Frequently Asked Questions

What is CVE-2012-0796?
CVE-2012-0796 is a security vulnerability in Phpmailer/phpmailer involving PHPMailer vulnerable to email header injection under CWE-94: Improper Control of Generation of Code ('Code Injection').
Which Phpmailer/phpmailer versions are affected?
Affected versions include releases prior to 2.2.1 across affected packages: phpmailer/phpmailer.
What version fixes CVE-2012-0796?
Upgrading to 2.2.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is phpmailer/phpmailer affected?
Yes, phpmailer/phpmailer is affected in releases prior to 2.2.1. Upgrade your dependency to 2.2.1 or later.
What CWE is associated with CVE-2012-0796?
CVE-2012-0796 is classified under CWE-94: Improper Control of Generation of Code ('Code Injection') (The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.).
How can I check Packagist dependencies for CVE-2012-0796?
Run the dependency tree command: 'inspect dependencies for phpmailer/phpmailer'. 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-398j-f7m7-795j",
  "modified" : "2023-02-15T19:34:00Z",
  "published" : "2022-10-06T21:25:46Z",
  "aliases" : [ "CVE-2012-0796" ],
  "summary" : "PHPMailer vulnerable to email header injection",
  "details" : "### Impact\nArbitrary additional email headers can be injected via crafted From or Sender headers.\n\n### Patches\nFixed in 2.2.1\n\n### Workarounds\nFilter user-supplied values prior to using them in From or Sender properties.\n\n### References\nhttps://nvd.nist.gov/vuln/detail/CVE-2012-0796\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open a private issue in [the PHPMailer project](https://github.com/PHPMailer/PHPMailer)",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Packagist",
      "name" : "phpmailer/phpmailer"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.2.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/PHPMailer/PHPMailer/security/advisories/GHSA-398j-f7m7-795j"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2012-0796"
  }, {
    "type" : "WEB",
    "url" : "https://bugzilla.redhat.com/show_bug.cgi?id=783532"
  }, {
    "type" : "WEB",
    "url" : "https://git.moodle.org/gw?p=moodle.git&a=commit&h=62988bf0bbc73df655f51884aaf1f523928abff9"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/PHPMailer/PHPMailer"
  }, {
    "type" : "WEB",
    "url" : "http://moodle.org/mod/forum/discuss.php?d=194015"
  }, {
    "type" : "WEB",
    "url" : "http://www.debian.org/security/2012/dsa-2421"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-94" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-10-06T21:25:46Z",
    "nvd_published_at" : "2012-07-17T10:20:00Z"
  }
}