# CVE-2016-5013: Moodle email header injection vulnerability

Source: https://junglewise.ai/threats/cve-2016-5013-moodle-email-header-injection-vulnerability  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2017-01-20. Updated: 2026-05-13  
License: CC BY 4.0 with a link back

CVE-2016-5013 · Severity: medium · CVSS 5.4 · Published 2017-01-20

Moodle, a widely used learning management system, is vulnerable to a flaw that allows unauthorized text to be inserted into email headers. An attacker could exploit this to send spam or malicious emails that appear to originate from the trusted Moodle server. This can damage an organization's reputation and lead to the server being blacklisted by email providers.

Technologies: [Moodle](https://junglewise.ai/threats/technologies/moodle), [moodle/moodle (Packagist)](https://junglewise.ai/threats/technologies/moodle-moodle). Vendors: [Moodle](https://junglewise.ai/threats/vendors/moodle), [Packagist](https://junglewise.ai/threats/vendors/packagist).

## Quick answers

**Is CVE-2016-5013 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2016-5013 being exploited in the wild.

**How severe is CVE-2016-5013?** Medium severity, with a CVSS score of 5.4, published 20 January 2017.

**Which products and versions are affected?** Moodle 2.x, 3.0.x, 3.1.0; moodle/moodle (Packagist) ECOSYSTEM:introduced=3.1,fixed=3.1.1.

**Is there a fix for CVE-2016-5013?** Yes. moodle/moodle (Packagist): upgrade to 3.1.1 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2016-5013 attacked?** It is attacked over the network, in a web application.

**Am I affected by CVE-2016-5013?** Check whether you run Moodle or moodle/moodle (Packagist) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- moodle/moodle (Packagist): upgrade to 3.1.1 or later

  ```sh
  composer require moodle/moodle:^3.1.1
  ```


## Technical details

A text injection vulnerability exists in Moodle's email handling component due to improper neutralization of special elements (CWE-74). By providing specially crafted input that is subsequently used in email headers, a remote attacker can inject additional SMTP commands or headers. This is typically achieved via CRLF injection, allowing the attacker to modify the 'To', 'Subject', or other header fields to redirect emails or send unsolicited bulk messages (spam). The vulnerability affects Moodle versions 2.x, 3.0.x, and 3.1.0. Patches have been released by the vendor to address this issue.

## Affected products

- Moodle Moodle 2.x, 3.0.x, 3.1.0

## Identifiers

- CVE-2016-5013
- GHSA-2hh3-jmv8-5fmx

## Timeline

- 2016-07-18: disclosed: Initial disclosure date based on external references.
- 2017-01-20: advisory: NVD publication date.

## References

- [http://www.securityfocus.com/bid/92040](http://www.securityfocus.com/bid/92040)
- [https://moodle.org/mod/forum/discuss.php?d=336698](https://moodle.org/mod/forum/discuss.php?d=336698)

## Related threats

- [Moodle insufficient access control in H5P content files](https://junglewise.ai/threats/cve-2026-123655-a-flaw-was-found-in-moodle-insufficient-access-control-checks-on)
- [Moodle missing capability check in core_grades_get_gradeitems](https://junglewise.ai/threats/cve-2026-119556-moodle-4-2-0-through-4-5-15-5-0-0-through-5-0-11-5-1-0-through-5)
- [Moodle core_grades_get_feedback information disclosure](https://junglewise.ai/threats/cve-2026-119555-moodle-4-2-0-through-4-5-15-5-0-0-through-5-0-11-5-1-0-through-5)
- [Moodle SQL injection in External database enrolment plugin](https://junglewise.ai/threats/cve-2026-119554-moodle-5-3-0-5-2-0-through-5-2-4-5-1-0-through-5-1-8-5-0-0)
- [Moodle path traversal in Blackboard question import](https://junglewise.ai/threats/cve-2026-119553-moodle-5-3-0-5-2-0-through-5-2-4-5-1-0-through-5-1-8-5-0-0)
