What Is Remote Code Execution (RCE)?

ObaidaAlsulaiman

Obaida Al-Sulaiman, Information Security Manager at ScanTitan,

Attacker laptop sending code to a server through a cracked padlock, illustrating remote code execution
Table of Contents

Remote code execution (RCE) is a flaw that lets an attacker run their own code on a server or device from another computer, usually over the internet and without physical access. The code runs with the permissions of the vulnerable program, so a flaw in a web server hands the attacker the web server’s power. Security teams rate RCE flaws critical because one request can lead to stolen data, ransomware or a foothold inside the network. This entry explains how RCE works, what causes it, and how to prevent it.

Quick definitionRCE is a flaw that lets an attacker run code on your system over a network. Fix any RCE flaw on the CISA exploited list first, and patch the rest by how exposed the system is.

What Is Remote Code Execution (RCE)?

Remote code execution (RCE) is a security flaw that lets an attacker run their own code on a computer they do not own, from another location over a network. The flaw sits in software that mishandles input, memory or files, and the code runs with the permissions of the affected program. RCE is both the name of the vulnerability class and the result an attacker achieves when they exploit one. The questions below cover the terms people mix up most.

What Does RCE Stand For?

RCE stands for remote code execution. Remote means the attacker acts from another computer, usually across the internet, with no physical access. Code is any instruction the target will run, such as a script, a shell command or a compiled program. Execution means the system actually runs it. Outside security the same three letters have unrelated meanings, for example in insurance, which is why searches for the acronym alone return mixed results. Inside security, RCE always refers to this flaw class, and vendors put it in advisory titles, such as the Microsoft SMBv1 Remote Code Execution Vulnerability, the name CISA gives EternalBlue in its catalog.

Is Remote Code Execution a Vulnerability or an Attack?

It is both, depending on the sentence. An RCE vulnerability is the flaw in the software, which a CVE record names. An RCE exploit is the code or request that triggers the flaw, and an RCE attack is the act of using that exploit against a real target. A scanner reports the vulnerability, a firewall may block the exploit, and an incident responder investigates the attack. Keeping the three apart helps when you read an advisory, because a patch removes the vulnerability, while a firewall rule only blocks one known exploit and leaves the flaw in place.

Why Is Remote Code Execution Considered Critical?

Security teams treat RCE as critical because code execution is the most powerful result a flaw can give, and everything else follows from it. Once code runs, the attacker can read files, steal credentials, install a web shell, deploy ransomware or reach other machines. Scoring systems reflect this: a flaw reachable over the network with no login and no user action earns a 9.8 under CVSS 3.1, as BlueKeep does in NVD. The risk rises when the system faces the internet, because automated scanners find exposed software quickly. Not every RCE reaches 9.8, since a flaw that needs an account scores lower, as the scoring section below explains.

Remote Code Execution vs Arbitrary Code Execution vs Command Injection

These terms overlap, and mixing them up causes confusion in reports. Arbitrary code execution (ACE) is the broad category: an attacker runs code of their choosing, whether locally or remotely. RCE is arbitrary code execution reached over a network. Command injection and code injection are two ways to get there: command injection makes an application pass attacker input to an operating system shell, while code injection makes it run the input as code in its own language. A vulnerability record can use any of these labels, so check the CVSS vector for network access and the weakness ID for the underlying cause. Our guide to command injection shows the shell version in detail.

Term What it means CWE Example
Arbitrary code execution (ACE) The attacker runs code of their choice, locally or remotely Varies A booby-trapped file that runs code when a user opens it
Remote code execution (RCE) Arbitrary code execution reached over a network Varies CVE-2019-0708 (BlueKeep) in Windows Remote Desktop Services
OS command injection Input reaches an operating system shell CWE-78 A web form that passes a hostname to a ping command unchecked
Code injection Input is run as code by the application’s own language CWE-94 User input passed to eval in a PHP script

How Does Remote Code Execution Work?

Remote code execution works when a program treats attacker-supplied input as instructions instead of data. The attacker sends a crafted request, file or network packet to a vulnerable service, and a flaw in how the service handles it, such as an unsafe function, a memory error or an unchecked upload, makes the service run the attacker’s code. That code inherits the service’s account, so on a web server it can read the site’s files and database credentials, write new files and start other programs. Attackers then plant a web shell for return access, steal data, deploy ransomware or move to other machines. Some flaws need no login at all, which is why internet-facing servers are attacked first.

Four steps of a remote code execution attack: crafted request, flaw in the service, code runs as the service and attacker takes control

What Causes Remote Code Execution?

Five weakness types cause most RCE flaws, and each maps to a CWE.

  • Command injection: Command injection (CWE-78) is a flaw where an application passes user input to an operating system shell, so the attacker adds commands of their own.
  • Code injection: Code injection (CWE-94) is a flaw where input is evaluated as code, for example through the PHP eval function.
  • Insecure deserialization: Insecure deserialization (CWE-502) is a flaw where an application rebuilds objects from untrusted data and the object runs code as it loads. The NVD record for Log4Shell lists it.
  • Memory corruption: Memory corruption, such as use after free (CWE-416), is a flaw where a program touches memory it should not, which a skilled attacker can turn into code execution. NVD lists CWE-416 for both BlueKeep and the PHP2Shell flaws.
  • Unsafe file upload: Unsafe file upload (CWE-434) is a flaw where a site accepts an executable file, such as a PHP script, and the attacker runs it by visiting its address. See our guide to the WordPress file upload vulnerability.

Real Remote Code Execution Examples

Log4Shell (CVE-2021-44228)

Log4Shell is an RCE flaw in the JNDI features of Apache Log4j2, a logging library, and it let an attacker who controlled a log message run code loaded from an LDAP server. NVD scores it CVSS 3.1 10.0, the maximum, and published it on 10 December 2021, the same day CISA added it to its exploited vulnerabilities list. The flaw worked because applications logged text that attackers controlled, such as a browser header, so no login was needed. It is the standard example of how one library can put thousands of products at risk at once.

EternalBlue (CVE-2017-0144)

EternalBlue is an RCE flaw in the SMBv1 server of Microsoft Windows, which Microsoft patched as MS17-010 in March 2017. The WannaCry ransomware spread through it. NVD scores it CVSS 3.1 8.8 and not 9.8, because its vector requires a low-privilege account, which is a useful reminder that RCE does not always mean no login. CISA added it to the exploited list on 10 February 2022, under the name Microsoft SMBv1 Remote Code Execution Vulnerability. Our guide to the port 445 vulnerability covers how to check and close the exposed port.

PHP2Shell (CVE-2026-109618 and CVE-2026-109619)

PHP2Shell is the name for two RCE flaws in the PHP engine itself, fixed on 21 October 2026 in versions 8.5.12, 8.4.27, 8.3.36 and 8.2.35. NVD scores CVE-2026-109618 at CVSS 3.1 9.8 and CVE-2026-109619 at 8.1, and CISA added both to its exploited list on 26 October. The PHP team describes a demonstrated attack on the Apache PHP module in which an unauthenticated request triggers the flaw before any application code runs. Because the flaw sits below the application, every PHP site is in scope, including WordPress, Joomla and Drupal. Our PHP2Shell guide explains who is affected and how to check.

How Is Remote Code Execution Scored and Prioritized?

A CVSS score rates the technical severity of an RCE flaw, and the highest scores go to flaws reachable over the network with no login and no user action, which is how BlueKeep reaches 9.8. An EPSS score adds the probability of exploitation in the next 30 days, and the CISA KEV catalog confirms that attackers already use the flaw. Treat RCE on an internet-facing system that appears on the catalog as a same-day fix, and schedule the rest by exposure. Do not rely on the CVSS number alone, because a flaw that needs a low-privilege account can still be the one attackers use. The table shows how the four examples above compare.

CVE Flaw CVSS 3.1 (NVD) Added to KEV
CVE-2021-44228 Log4Shell in Apache Log4j2 10.0 10 Dec 2021
CVE-2019-0708 BlueKeep in Remote Desktop Services 9.8 3 Nov 2021
CVE-2017-0144 EternalBlue in Windows SMBv1 8.8 10 Feb 2022
CVE-2026-109618 PHP2Shell, out-of-memory corruption 9.8 26 Oct 2026
CVE-2026-109619 PHP2Shell, stale global state 8.1 26 Oct 2026
Prioritizing remote code execution flaws with CVSS for severity, EPSS for likelihood and CISA KEV for confirmed exploitation

How to Detect Remote Code Execution

Detection combines what a scanner can see from outside with what your own servers record. Use all four checks, because each one catches something the others miss.

  • Scan from outside with a vulnerability scanner, which matches the software and version it can see against known CVEs. It can only report what the server reveals, so confirm versions on the host.
  • Watch web server processes, because a web worker that starts a shell, downloads a tool or opens an unexpected outbound connection is the clearest sign of RCE. CISA gives the same advice for PHP2Shell.
  • Check files for new scripts in upload folders and for changed core files, using our guide to WordPress core files modified.
  • Read logs for repeated requests to one script and for errors that appear before the application starts.

What to Do If You Suspect an Active RCE Attack

If a server may already be running attacker code, act in this order, because speed matters and evidence is easy to destroy. Our guide on what to do when a website is hacked covers the website version in more depth.

  1. Isolate the server from the network, or take the vulnerable service offline, so the attacker loses access.
  2. Preserve logs and a snapshot of the disk before you change anything.
  3. Search for persistence, such as web shells, new administrator accounts and scheduled tasks.
  4. Rotate every credential the server could read, including database passwords, API keys and hosting logins.
  5. Patch the flaw, then restore from a clean backup and reconnect only after a fresh scan.

How to Prevent Remote Code Execution

Prevention starts with the controls that cut the most paths, and our guide on how to protect a website from hackers ranks them for a small site.

  • Patch internet-facing software within days, and the same day for any flaw on the CISA exploited list.
  • Remove plugins, libraries and services you do not use, because unused code is still reachable.
  • Validate every input and use safe interfaces, such as prepared statements and APIs that never pass input to a shell or an eval function.
  • Run each service with the least privilege it needs, so a successful exploit reaches less.
  • Block script execution in upload folders and restrict which file types a form accepts.
  • Add a web application firewall as a stopgap, and remember that CISA calls its protection for PHP2Shell partial.
  • Segment the network so a compromised server cannot reach everything else.

Frequently Asked Questions

What is RCE in cyber security?

RCE stands for remote code execution. It is a vulnerability that lets an attacker run their own code on another computer over a network, with the permissions of the program they exploited. Security teams rate it critical because it can lead to full control of a server.

Is remote code execution the same as arbitrary code execution?

Not exactly. Arbitrary code execution means an attacker runs code of their choice, anywhere. Remote code execution is the case where they do it over a network. Every RCE flaw is a form of arbitrary code execution, but not every arbitrary code execution flaw is remote.

Can RCE happen without a login?

Yes, for many flaws. BlueKeep and the PHP2Shell flaw CVE-2026-109618 are rated with no privileges required, so an unauthenticated request can be enough. Others need an account: NVD scores EternalBlue with a low-privilege requirement, which is why its score is 8.8 and not 9.8.

What is the difference between RCE and command injection?

Command injection is one way to achieve RCE. It abuses an application that passes input to an operating system shell. RCE is the outcome, and it can also come from memory corruption, insecure deserialization, code injection or an unsafe file upload.

How do I know if my website is vulnerable to RCE?

Check that your software, plugins and server runtime are on patched versions, and compare them with the CISA exploited list. Then run an outside scan to see which versions and exposed services an attacker can see, and check the host for versions the scan cannot reveal.

These five entries explain the scores and labels that appear next to every RCE flaw.

  • CVE: A CVE is the public identifier, such as CVE-2021-44228, that names one specific vulnerability.
  • CVSS: A CVSS score is the 0 to 10 rating of how severe a flaw is.
  • EPSS: An EPSS score is the probability that attackers will exploit a flaw within 30 days.
  • CISA KEV: The CISA KEV catalog lists flaws with confirmed exploitation in the wild.
  • CWE: A CWE names the type of weakness behind a flaw, such as CWE-78 for command injection.

Sources: the National Vulnerability Database records for the CVEs above, the CISA KEV catalog, and MITRE CWE.

A website vulnerability scanner finds the known CVEs that affect your software. Rank them with the free CVE Priority Checker and fix the remote code execution flaws first.

o

Information Security Manager · Dubai, UAE · 12+ years InfoSec experience

Obaida specialises in web application security, vulnerability management, and external attack surface reduction for SMB and mid-market organisations. All ScanTitan content is reviewed against live scan findings before publication.

Share :

Facebook
LinkedIn

Continue reading