Dark Mode
Capec-183 Detail
IMAP/SMTP Command Injection
Standard Software Typical Severity: Medium
Parents: 248
Threats: T290
Not present
| External ID | Source | Link | Description |
|---|---|---|---|
| CAPEC-183 | capec | https://capec.mitre.org/data/definitions/183.html | |
| CWE-77 | cwe | http://cwe.mitre.org/data/definitions/77.html | |
| REF-49 | reference_from_CAPEC | https://www.owasp.org/www-project-web-security-testing-guide/latest/4-Web_Application_Security_Testing/07-Input_Validation_Testing/10-Testing_for_IMAP_SMTP_Injection | OWASP Web Security Testing Guide, The Open Web Application Security Project (OWASP) |
Explore
-
Identify Target Web-Mail Server: The adversary first identifies the web-mail server they wish to exploit.
Experiment
-
Identify Vulnerable Parameters: Once the adversary has identified a web-mail server, they identify any vulnerable parameters by altering their values in requests. The adversary knows that the parameter is vulnerable if the web-mail server returns an error of any sort. Ideally, the adversary is looking for a descriptive error message.
-
Determine Level of Injection: After identifying all vulnerable parameters, the adversary determines what level of injection is possible.
| Techniques |
|---|
| Assign a null value to a parameter being used by the web-mail server and observe the response. |
| Assign a random value to a parameter being used by the web-mail server and observe the response. |
| Add additional values to a parameter being used by the web-mail server and observe the response. |
| Add non standard special characters (i.e.: \, ', ", @, #, !, |) to a parameter being used by the web-mail server and observe the response. |
| Eliminate a parameter being used by the web-mail server and observe the response. |
| Techniques |
|---|
| Evaluate error messages to determine what IMAP/SMTP command is being executed for the vulnerable parameter. Sometimes the actually query will be placed in the error message. |
| If there aren't descriptive error messages, the adversary will analyze the affected functionality to deduce the possible commands that could be being used by the mail-server. |
Exploit
-
Inject IMAP/SMTP Commands: The adversary manipulates the vulnerable parameters to inject an IMAP/SMTP command and execute it on the mail-server.
| Techniques |
|---|
| Structure the injection as a header, body, and footer. The header contains the ending of the expected message, the body contains the injection of the new command, and the footer contains the beginning of the expected command. |
| Each part of the injection payload needs to be terminated with the CRLF (%0d%0a) sequence. |
- The target environment must consist of a web-mail server that the attacker can query and a back-end mail server. The back-end mail server need not be directly accessible to the attacker.
- The web-mail server must fail to adequately sanitize fields received from users and passed on to the back-end mail server.
- The back-end mail server must not be adequately secured against receiving malicious commands from the web-mail server.
- None: No specialized resources are required to execute this type of attack. However, in most cases, the attacker will need to be a recognized user of the web-mail server.
Not present
Not present
Not present