Using Meta-characters in E-mail Headers to SecurityDatabase\Alert\Inject Malicious Payloads
Attack Pattern ID: 41 (Detailed Attack Pattern Completeness: Complete)Typical Severity: HighStatus: Draft
+ Description

Summary

This type of attack involves an attacker leveraging meta-characters in email headers to inject improper behavior into email programs.

Email software has become increasingly sophisticated and feature-rich. In addition, email applications are ubiquitous and connected directly to the Web making them ideal targets to launch and propagate attacks. As the user demand for new functionality in email applications grows, they become more like browsers with complex rendering and plug in routines. As more email functionality is included and abstracted from the user, this creates opportunities for attackers. Virtually all email applications do not list email header information by default, however the email header contains valuable attacker vectors for the attacker to exploit particularly if the behavior of the email client application is known. Meta-characters are hidden from the user, but can containt scripts, enumerations, probes, and other attacks against the user's system.

Attack Execution Flow

Experiment
  1. Identify and characterize metacharacter processing vulnerabilities in email headers:

    An attacker creates emails with headers containing various metacharacter-based malicious payloads in order to determine whether the target application processes the malicious content and in what manner it does so.

    Attack Step Techniques

    IDAttack Step Technique DescriptionEnvironments
    1

    Use an automated tool (fuzzer) to create malicious emails headers containing metacharacter-based payloads.

    env-Web
    2

    Manually tampering email headers to inject malicious metacharacter-based payload content in them.

    env-Web

    Indicators

    IDtypeIndicator DescriptionEnvironments
    1Positive

    The email client processes metacharacters in email headers.

    env-Local
    2Negative

    The email client does not process metacharacters in email headers.

    env-Local
    3Negative

    The email server will strip the headers that contain metacharacters

    env-Web
    4Inconclusive

    The email server lets the malicious metacharacters in the email headers.

    env-Web

    Outcomes

    IDtypeOutcome Description
    1Success
    The email client executes the malicious payload.
    2Failure
    No malicious content is being delivered in the email by the server.

    Security Controls

    IDtypeSecurity Control Description
    1Detective
    Monitor email headers for malicious content in metacharacters.
Exploit
  1. An attacker leverages vulnerabilities identified during the Experiment Phase to inject malicious email headers and cause the targeted email application to exhibit behavior outside of its expected constraints.

    Attack Step Techniques

    IDAttack Step Technique DescriptionEnvironments
    1

    Send emails with specifically-constructed, metacharater-based malicious payloads in the email headers to targeted systems running email processing applications identified as vulnerable during the Experiment Phase.

    env-Local

    Outcomes

    IDtypeOutcome Description
    1Success
    The payload executes on the target user's system.

    Security Controls

    IDtypeSecurity Control Description
    1Preventative
    Filtering email headers for malicious content.
+ Attack Prerequisites

This attack targets most widely deployed feature rich email applications, including web based email programs.

+ Typical Likelihood of Exploit

Likelihood: High

+ Methods of Attack
  • Injection
  • API Abuse
+ Examples-Instances

Description

To:<someone@example.com>

From:<badguy@example.com>

Header<SCRIPT>payme</SCRIPT>def: whatever

Description

Meta-characters are among the most valuable tools attackers have to deceive users into taking some action on their behalf. E-mail is perhaps the most efficient and cost effective attack distribution tool available, this has led to the phishing pandemic.

Meta-characters like \w \s \d ^ can allow the attacker to escape out of the expected behavior to execute additional commands. Escaping out the process (such as email client) lets the attacker run arbitrary code in the user's process.

+ Attacker Skills or Knowledge Required

Skill or Knowledge Level: Low

To distribute email

+ Solutions and Mitigations

Design: Perform validation on email header data

Implementation: Implement email filtering solutions on mail server or on MTA, relay server.

Implementation: Mail servers that perform strict validation may catch these attacks, because metacharacters are not allowed in many header variables such as dns names

+ Attack Motivation-Consequences
  • Run Arbitrary Code
+ Injection Vector

Email

+ Payload

Metacharacters

+ Activation Zone

Email processing routines of Email program

+ Payload Activation Impact

Enables attacker to execute server side code with any commands that the program owner has privileges to.

+ Related Weaknesses
CWE-IDWeakness NameWeakness Relationship Type
150Improper Neutralization of Escape, Meta, or Control SequencesTargeted
88Argument Injection or ModificationTargeted
697Insufficient ComparisonTargeted
713OWASP Top Ten 2007 Category A2 - Injection FlawsTargeted
+ Related Attack Patterns
NatureTypeIDNameDescriptionView(s) this relationship pertains toView\(s\)
ChildOfAttack PatternAttack Pattern134Email Injection 
Mechanism of Attack (primary)1000
ChildOfAttack PatternAttack Pattern242Script Injection 
Mechanism of Attack (primary)1000
+ Purposes
  • Penetration
+ CIA Impact
Confidentiality Impact: HighIntegrity Impact: HighAvailability Impact: High
+ Technical Context
Architectural Paradigms
All
Frameworks
All
Platforms
All
Languages
All
+ References
G. Hoglund and G. McGraw. "Exploiting Software: How to Break Code". Addison-Wesley. February 2004.
+ Content History
Submissions
SubmitterOrganizationDate
G. Hoglund and G. McGraw. Exploiting Software: How to Break Code. Addison-Wesley, February 2004.Cigital, Inc2007-01-01
Modifications
ModifierOrganizationDateComments
Gunnar PetersonCigital, Inc2007-02-28Fleshed out content to CAPEC schema from the original descriptions in "Exploiting Software"
Sean BarnumCigital, Inc2007-03-09Review and revise
Richard StruseVOXEM, Inc2007-03-26Review and feedback leading to changes in Name, Description and Examples
Sean BarnumCigital, Inc2007-04-13Modified pattern content according to review and feedback
Romain GaucherCigital, Inc2009-02-10Created draft content for detailed description
Sean BarnumCigital Federal, Inc2009-04-13Reviewed and revised content for detailed description