In short
A Remote Code Execution (RCE) vulnerability allows an attacker to execute their own commands on a server or workstation remotely, without having legitimate access to it. This is the most serious category of vulnerability: it most often grants control of the machine and then serves as a foothold to gain access to the rest of the network. Log4Shell (CVE-2021-44228), rated 10 out of 10 on the CVSS, is the best-known example.
Where Do RCE Vulnerabilities Come From?
RCE is not a single type of vulnerability; it is an outcome resulting from several families of vulnerabilities.
| Cause | Mechanism | Reference |
|---|---|---|
| Command injection | User data is injected into a system command (image conversion, ping) | CWE-78 |
| Code injection | The application dynamically evaluates code constructed from an input (using functions such as `eval`) | CWE-94 |
| Insecure deserialization | A serialized object provided by the attacker triggers code when it is deserialized | CWE-502 |
| Template Injection (SSTI) | An input is interpreted by the server-side template engine | CWE-1336 |
| File Upload | A script (PHP, JSP) is placed in a directory served by the web server, then called | CWE-434 |
| Memory corruption | An out-of-bounds write in software written in C or C++ causes the program to malfunction | CWE-787 |
Why is RCE so critical?
With an RCE, the attacker acts with the privileges of the vulnerable process: reading configuration files and secrets, accessing databases, and installing a backdoor or ransomware. RCE vulnerabilities affecting devices exposed to the Internet (VPNs, firewalls, email servers) feature prominently in CISA’s KEV catalog, which tracks vulnerabilities actively exploited in the wild.
Reducing the Risk
- Never pass user input to an interpreter (shell, eval, template engine); use APIs that separate the command from its arguments.
- Apply patches as a priority to components exposed to the Internet and to the vulnerabilities listed in the KEV catalog.
- Run services using an account with minimal privileges, within a compartmentalized environment (container, network segmentation).
- Disable execution in upload directories and verify the actual file type of received files.
- Monitor for abnormal processes launched by applications, such as a web server opening a shell.
Frequently asked questions
What is the difference between RCE and command injection?
Command injection is one of the possible causes of an RCE. The term RCE describes the result—executing code remotely—regardless of the path taken to achieve it.
Sources
Find out where an attacker would get in.
Our AI agents actually attack your scope, fully automated, and hand you the proof of every vulnerability.
