CAPEC-183
IMAP/SMTP Command Injection
An adversary exploits weaknesses in input validation on web-mail servers to execute commands on the IMAP/SMTP server. Web-mail servers often sit between the Internet and the IMAP or SMTP mail server. User requests are received by the web-mail servers which then query the back-end mail server for the requested information and return this response to the user. In an IMAP/SMTP command injection attack, mail-server commands are embedded in parts of the request sent to the web-mail server. If the web-mail server fails to adequately sanitize these requests, these commands are then sent to the back-end mail server when it is queried by the web-mail server, where the commands are then executed. This attack can be especially dangerous since administrators may assume that the back-end server is protected against direct Internet access and therefore may not secure it adequately against the execution of malicious commands.
On this page
Ask an AI about this attack pattern
Show the prompt
Explain the attack pattern CAPEC-183: IMAP/SMTP Command Injection: how it unfolds, what it needs and how to prevent and detect it in my systems. Use https://capec.mitre.org/data/definitions/183.html and https://cve.bz/cve/capec/183?via=ask-ai-copy, which lists recent CVEs with the weaknesses it exploits. Cite the sources.Opens a third-party assistant; its answer is its own, not cve.bz's. The prompt holds only this attack pattern's id and public links.
How the attack unfolds
Explore
The attacker looks for a way in.
[Identify Target Web-Mail Server] The adversary first identifies the web-mail server they wish to exploit.
Experiment
They probe what they found.
[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.
5 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.
[Determine Level of Injection] After identifying all vulnerable parameters, the adversary determines what level of injection is possible.
2 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
They carry out the attack.
[Inject IMAP/SMTP Commands] The adversary manipulates the vulnerable parameters to inject an IMAP/SMTP command and execute it on the mail-server.
2 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.
Prerequisites
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.
Resources required
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.
Weaknesses it exploits
- CWE-77 Improper Neutralization of Special Elements used in a Command
Recent CVEs with these weaknesses
- 8.5CVE-2026-140041
A flaw has been found in WAVLINK WL-WN530BE1-A M30BE1_V251117. The impacted element is the function FUN_0001f94c of the file /protocol.csp of the component ioos. Executing a manipulation of the argument mac can lead to os command injection…
- 8.6CVE-2026-140040
A vulnerability was detected in WAVLINK WL-WN530BE1-A M30BE1_V251117. The affected element is the function port_forward of the file /protocol.csp of the component ioos. Performing a manipulation of the argument Name results in os command i…
- 8.5CVE-2026-138436
A vulnerability was identified in TRENDnet TEW-824DRU 1.00b18. Affected by this issue is some unknown functionality of the file /cgi/ssi. The manipulation of the argument syslog_server leads to os command injection. It is possible to initi…
- 9.3CVE-2026-138417
A vulnerability was determined in Tenda AX9 22.03.01.46. This issue affects the function system of the file /goform/setMacFilterCfg of the component Web Management Backend. Executing a manipulation of the argument macFilterType can lead to…
- 8.6CVE-2026-138416
A vulnerability was found in D-Link R15 1.22.01. This vulnerability affects the function save_CSID_SetDeviceSettings of the file /bin/httpd of the component DHMAPI. Performing a manipulation of the argument TZLocation results in command in…
- 9.4CVE-2026-138392
A vulnerability was found in Tenda CP3 Pro 27.5.52.101. This affects the function CNetApp::OnConfigNetwork of the file /bin/Kylin. The manipulation results in command injection. The attack may be launched remotely.
- 8.6CVE-2026-138358
A vulnerability was identified in D-Link DMS-3130 and DXS-3130 1.20.P006. Affected by this issue is the function http_import_nuclias_manager_profile of the file 464_Nuclias_Manager_Settings.lua of the component Nuclias Manager Profile Impo…
- 8.6CVE-2026-138357
A vulnerability was determined in D-Link DMS-3130 and DXS-3130 1.20.P006. Affected by this vulnerability is an unknown functionality of the file 898_ssl_global.lua of the component SSL Certificate Import Endpoint. This manipulation of the …
The newest records naming one of them. Each weakness's page lists them all.
Related attack patterns
- Part of
- CAPEC-248 Command Injection
MITRE's words, unchanged: CAPEC-183 at MITRE. CAPEC is Copyright © 2007–2026, The MITRE Corporation, used under the CAPEC terms of use: “The MITRE Corporation (MITRE) hereby grants you a non-exclusive, royalty-free license to use Common Attack Pattern Enumeration and Classification (CAPEC™) for research, development, and commercial purposes. Any copy you make for such purposes is authorized provided that you reproduce MITRE’s copyright designation and this license in any such copy.” CAPEC and the CAPEC logo are trademarks of The MITRE Corporation. Credits. All attack patterns.