CVE-2012-0796 — phpmailer
CVE-2012-0796 is a Code Injection vulnerability in phpmailer/phpmailer. A fix is available for phpmailer/phpmailer — see the affected versions and patch details below.
PHPMailer vulnerable to email header injection
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
Real-World Exposure
phpmailer/phpmailerReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects Packagist packages — download data is not available via public APIs for these ecosystems.
Description
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
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐘Packagist | phpmailer/phpmailer | all versions | 2.2.1composer require phpmailer/phpmailer:^2.2.1 |
Affected Products
moodlemoodleDetection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for phpmailer/phpmailer, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update phpmailer/phpmailer to 2.2.1 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2012-0796 is resolved across your whole dependency graph.
Workarounds
Stop passing untrusted input into the interpreter or shell: call the affected binary with an argument array rather than a composed command string, reject anything outside a strict allowlist of expected values, and run the component under an account that cannot reach beyond the work it legitimately does.
Frequently Asked Questions
Is CVE-2012-0796 in your dependencies?
Find it across Packagist, including transitive dependencies.