September 5, 2026
Remote Code Execution (RCE) in 2026: From Zero to Understanding How Hackers Take Control
When people hear Remote Code Execution (RCE) for the first time, the term itself can look very scary.

By Amit Kumar Biswas @Amitlt2
19 min read
But if we break it into simple words:
Remote โ The attacker is interacting with the target from another system.
Code โ Instructions that the computer can understand.
Execution โ The computer actually runs those instructions.
So, in simple language:
RCE means an attacker is able to make the target server execute code or commands that the attacker should not be allowed to execute.
This is why RCE is considered one of the most serious vulnerabilities in application security.
But one important thing before we start: the examples below are intended for your own application, CTF, intentionally vulnerable lab, or another system where you have explicit permission to test.
1. First Understand the Normal Flow
Suppose we have a simple website:
USER
|
| HTTP Request
v
+-------------------+
| WEB APPLICATION |
+-------------------+
|
v
BACKEND
|
+-------+-------+
| |
v v
DATABASE FILE SYSTEMUSER
|
| HTTP Request
v
+-------------------+
| WEB APPLICATION |
+-------------------+
|
v
BACKEND
|
+-------+-------+
| |
v v
DATABASE FILE SYSTEMThe user sends a request.
The application receives it.
The backend processes it.
The backend may communicate with a database or filesystem.
Normally, user input should be treated as data.
For example:
Username = amitUsername = amitThe server should understand:
"amit" = data"amit" = dataThe problem starts when the application accidentally treats attacker-controlled data as:
code
command
template
object
file
expressioncode
command
template
object
file
expressionThen the flow can become:
Attacker Input
|
v
Web Application
|
v
Unsafe Processing
|
v
Execution
|
v
RCEAttacker Input
|
v
Web Application
|
v
Unsafe Processing
|
v
Execution
|
v
RCEThis is the basic RCE story.
2. A Very Simple Example
Imagine an application has this feature:
Server Health Check
Enter hostname:
[ 127.0.0.1 ]
[ Check ]Server Health Check
Enter hostname:
[ 127.0.0.1 ]
[ Check ]The developer wants the server to perform a ping operation.
Conceptually, the backend might do something like:
ping 127.0.0.1ping 127.0.0.1The intended flow is:
User enters:
127.0.0.1
|
v
Application
|
v
ping 127.0.0.1
|
v
ResultUser enters:
127.0.0.1
|
v
Application
|
v
ping 127.0.0.1
|
v
ResultNow imagine the application directly places the user's input into a shell command.
That is where the security problem starts.
In an authorised lab, a tester might use a harmless proof such as:
127.0.0.1; id127.0.0.1; idThe important part is not the exact payload.
The important part is understanding what happened.
The server may effectively end up processing something conceptually similar to:
ping 127.0.0.1; idping 127.0.0.1; idThe ; can separate shell commands in many shell contexts.
So the application intended to execute:
ping 127.0.0.1ping 127.0.0.1but attacker-controlled input caused another command to be interpreted.
If the response contains something similar to:
uid=1000(webapp) gid=1000(webapp)uid=1000(webapp) gid=1000(webapp)you have evidence that the server executed the id command.
That is a command execution condition, and depending on the context and application, it can constitute RCE.
3. Why id Is Used So Often
As a beginner, you may wonder:
Why do security testers use
id?
Because it is a relatively harmless command that tells you which operating-system user is executing the process.
For example:
$ id
uid=1000(webapp) gid=1000(webapp)$ id
uid=1000(webapp) gid=1000(webapp)It answers an important question:
WHO IS RUNNING THE APPLICATION?WHO IS RUNNING THE APPLICATION?You can also use:
whoamiwhoamiExample:
$ whoami
webapp$ whoami
webappThis is much safer for initial validation than trying something destructive.
4. Command Injection vs RCE
These terms are related but should not be treated as identical in every situation.
Suppose:
User Input
|
v
Command Construction
|
v
Operating SystemUser Input
|
v
Command Construction
|
v
Operating SystemIf you can alter the command being executed, you have a command injection vulnerability.
If that gives you arbitrary command execution on the remote server, the impact is generally described as Remote Code Execution (RCE).
Think of it like this:
Command Injection
|
v
Can attacker control command?
|
v
Yes
|
v
Can server execute attacker-controlled command?
|
v
Yes
|
v
RCECommand Injection
|
v
Can attacker control command?
|
v
Yes
|
v
Can server execute attacker-controlled command?
|
v
Yes
|
v
RCESo don't report every command-injection-looking behaviour as confirmed RCE without validating execution.
5. Example: Command Separators
Different command interpreters support different syntax.
In a typical Unix shell context, examples of command separators/operators include:
;
&&
||
|;
&&
||
|For example, in a controlled lab:
127.0.0.1; whoami127.0.0.1; whoamiAnother simple test could be:
127.0.0.1 && whoami127.0.0.1 && whoamiAnother:
127.0.0.1 || whoami127.0.0.1 || whoamiBut don't assume all of them will work.
Why?
Because the application may:
not use a shell
use a different shell
escape characters
validate the input
use an API instead of a commandnot use a shell
use a different shell
escape characters
validate the input
use an API instead of a commandThis is why understanding the backend matters.
6. Blind Command Injection
Now comes an interesting case.
Sometimes the command executes, but its output is not returned to you.
For example:
POST /diagnostic
host=127.0.0.1POST /diagnostic
host=127.0.0.1The server executes the operation but only responds:
HTTP/1.1 200 OK
Request completed.HTTP/1.1 200 OK
Request completed.You cannot see the command output.
This is called blind command injection when command execution occurs without directly observable output.
Conceptually:
Attacker
|
| Payload
v
Application
|
v
Command executes
|
X
Output not returnedAttacker
|
| Payload
v
Application
|
v
Command executes
|
X
Output not returnedFor safe lab testing, you can use observable behaviour such as timing or a harmless application-side signal.
The important thing is:
No output does not necessarily mean no execution.
7. Time-Based Verification
Suppose your test environment allows you to demonstrate command execution through a harmless delay.
For example, in a Unix shell context:
127.0.0.1; sleep 5127.0.0.1; sleep 5If the vulnerable endpoint normally responds immediately but consistently takes approximately five seconds after the test input, that can indicate command execution.
The idea is:
Normal request
|
v
Response: ~0.2 sec
Test request
|
v
Command executes
|
v
sleep 5
|
v
Response: ~5 secNormal request
|
v
Response: ~0.2 sec
Test request
|
v
Command executes
|
v
sleep 5
|
v
Response: ~5 secThis is called time-based verification.
In professional testing, repeat the test and compare against a normal baseline because network latency can produce false positives.
8. RCE Through SSTI
Now let us move away from operating-system commands.
Suppose an application uses a server-side template.
Imagine the page displays:
Hello AmitHello AmitThe backend may use something conceptually like:
Hello {{ username }}Hello {{ username }}The template engine processes this and generates:
Hello AmitHello AmitNow suppose user-controlled input is inserted into the template itself instead of being treated only as data.
A basic SSTI detection test in many template engines is:
{{7*7}}{{7*7}}If the application returns:
4949instead of literally displaying:
{{7*7}}{{7*7}}that is a strong indication that the input is being evaluated by a template engine.
The flow is:
Input:
{{7*7}}
|
v
Template Engine
|
v
49Input:
{{7*7}}
|
v
Template Engine
|
v
49This is an important distinction.
You have not yet proven RCE.
You have first discovered:
Server-Side Template Injection may be present.
9. SSTI Does Not Automatically Mean RCE
This point is very important.
Suppose:
{{7*7}}{{7*7}}returns:
4949That proves expression evaluation.
It does not automatically prove that you can execute operating-system commands.
The actual path depends on:
Template engine
Version
Configuration
Sandbox
Available objects
Application framework
PermissionsTemplate engine
Version
Configuration
Sandbox
Available objects
Application framework
PermissionsSo your testing process should be:
SSTI Detection
|
v
Identify Template Engine
|
v
Understand its capabilities
|
v
Check whether execution is possible
|
v
Validate safelySSTI Detection
|
v
Identify Template Engine
|
v
Understand its capabilities
|
v
Check whether execution is possible
|
v
Validate safelyThis is much better than blindly copying an RCE payload from the internet.
10. Example: Template Injection Thinking
Suppose you submit:
{{7*7}}{{7*7}}and receive:
4949Then try another harmless expression:
{{10+5}}{{10+5}}and receive:
1515You now know:
Input
|
v
Template Parser
|
v
Expression EvaluationInput
|
v
Template Parser
|
v
Expression EvaluationThe security tester's next question is:
Can this template engine access anything that should not be accessible?
That is where deeper SSTI research starts.
11. File Upload โ RCE
Consider this:
Upload File
[ Choose File ]
[ Upload ]Upload File
[ Choose File ]
[ Upload ]Suppose the application accepts:
profile.jpgprofile.jpgand stores it.
The normal architecture is:
Browser
|
v
Upload
|
v
Validation
|
v
Storage
|
v
DisplayBrowser
|
v
Upload
|
v
Validation
|
v
Storage
|
v
DisplayThe dangerous architecture can look like:
Upload
|
v
Weak Validation
|
v
Server Directory
|
v
Executable File
|
v
Web Server
|
v
Code ExecutionUpload
|
v
Weak Validation
|
v
Server Directory
|
v
Executable File
|
v
Web Server
|
v
Code ExecutionA security tester therefore does not only ask:
"Can I upload a file?"
They ask:
"Can the uploaded file become executable server-side?"
That is the real question.
12. Safe File Upload Testing
For an authorised lab, start with harmless files.
Test:
normal.jpg
test.txt
test.pdfnormal.jpg
test.txt
test.pdfThen examine:
Where is the file stored?
Can it be accessed directly?
What Content-Type is accepted?
Does the server inspect the actual file?
Is the upload directory executable?
Is the filename changed?
Can the file overwrite an existing file?Where is the file stored?
Can it be accessed directly?
What Content-Type is accepted?
Does the server inspect the actual file?
Is the upload directory executable?
Is the filename changed?
Can the file overwrite an existing file?For a deliberately vulnerable lab, the lab may provide a harmless server-side script test.
The key flow to understand is:
Upload
|
v
Storage
|
v
Server interprets file
|
v
ExecutionUpload
|
v
Storage
|
v
Server interprets file
|
v
ExecutionDo not assume that every upload vulnerability is RCE.
13. Deserialization โ RCE
This one is slightly more difficult, so let us make it simple.
Suppose an application converts an object into data:
Object
|
v
Serialization
|
v
DataObject
|
v
Serialization
|
v
DataLater it converts the data back:
Data
|
v
Deserialization
|
v
ObjectData
|
v
Deserialization
|
v
ObjectThe problem comes when the application accepts attacker-controlled serialized data and uses an unsafe deserialization mechanism.
The vulnerable flow becomes:
Attacker-Controlled Data
|
v
Deserializer
|
v
Object Creation
|
v
Dangerous Method
|
v
RCEAttacker-Controlled Data
|
v
Deserializer
|
v
Object Creation
|
v
Dangerous Method
|
v
RCE14. Gadget Chains
This is where deserialization becomes interesting.
Imagine the application already contains:
Class A
Class B
Class C
Class DClass A
Class B
Class C
Class DAn attacker may be able to abuse the way these classes interact.
Conceptually:
Input
|
v
Class A
|
v
Class B
|
v
Class C
|
v
Dangerous Function
|
v
Code ExecutionInput
|
v
Class A
|
v
Class B
|
v
Class C
|
v
Dangerous Function
|
v
Code ExecutionThis sequence is called a gadget chain.
The individual classes may have legitimate purposes.
The vulnerability comes from chaining their existing behaviour together in an unintended way.
15. Java Deserialization
Java applications historically have had many unsafe deserialization issues.
The conceptual flow is:
Serialized Java Object
|
v
Java Deserialization
|
v
Object Creation
|
v
Gadget Chain
|
v
Potential RCESerialized Java Object
|
v
Java Deserialization
|
v
Object Creation
|
v
Gadget Chain
|
v
Potential RCEWhen testing this in a lab, the important learning sequence is:
Find serialized input
โ
Identify serialization format
โ
Identify application/library versions
โ
Understand available gadget paths
โ
Validate in a controlled environmentFind serialized input
โ
Identify serialization format
โ
Identify application/library versions
โ
Understand available gadget paths
โ
Validate in a controlled environmentDo not immediately jump to exploit generation.
First understand what is actually being deserialized.
16. PHP Deserialization
PHP has its own serialization mechanisms.
A PHP application might process serialized data.
Conceptually:
Attacker Data
|
v
PHP unserialization
|
v
Object
|
v
Magic Method
|
v
Dangerous OperationAttacker Data
|
v
PHP unserialization
|
v
Object
|
v
Magic Method
|
v
Dangerous OperationPHP applications can contain special methods such as:
__wakeup()
__destruct()
__toString()__wakeup()
__destruct()
__toString()Depending on the application's classes and behaviour, these can become part of a gadget chain.
Again:
PHP Deserialization
โ
Automatically RCEPHP Deserialization
โ
Automatically RCEThe application-specific object graph determines the actual impact.
17. Python Pickle
Python's pickle format is another famous example.
The important security rule is:
Do not unpickle untrusted data.
The dangerous flow is:
Attacker-Controlled Pickle
|
v
pickle.load()
|
v
Object Reconstruction
|
v
Potential Code ExecutionAttacker-Controlled Pickle
|
v
pickle.load()
|
v
Object Reconstruction
|
v
Potential Code ExecutionThis is one reason developers should not treat serialization formats as automatically safe just because they are used internally.
18. YAML and Unsafe Object Construction
Some YAML libraries have functionality that can construct language-specific objects.
If attacker-controlled YAML reaches an unsafe loader, the flow can become:
Malicious YAML
|
v
Unsafe YAML Loader
|
v
Object Construction
|
v
Dangerous Behaviour
|
v
Potential RCEMalicious YAML
|
v
Unsafe YAML Loader
|
v
Object Construction
|
v
Dangerous Behaviour
|
v
Potential RCEA harmless first step during testing is to determine:
What YAML parser is being used?
What version?
Which loader?
Is object construction enabled?What YAML parser is being used?
What version?
Which loader?
Is object construction enabled?The exact payload depends on the specific library and version.
There is no universal YAML RCE payload.
19. SSRF โ RCE
SSRF is another vulnerability that can sometimes become part of an RCE chain.
Suppose the application provides:
Fetch URL:
[ https://example.com/image.jpg ]
[ Fetch ]Fetch URL:
[ https://example.com/image.jpg ]
[ Fetch ]The server makes the request.
Normal:
User
|
v
Application
|
v
example.comUser
|
v
Application
|
v
example.comWith SSRF:
Attacker
|
v
Application
|
v
Internal ServiceAttacker
|
v
Application
|
v
Internal ServiceNow imagine that internal service has a dangerous administrative endpoint.
The chain could theoretically become:
SSRF
|
v
Internal Service
|
v
Admin Function
|
v
Command Execution
|
v
RCESSRF
|
v
Internal Service
|
v
Admin Function
|
v
Command Execution
|
v
RCESo SSRF itself does not automatically equal RCE.
The internal target and its functionality determine the impact.
20. SQL Injection โ RCE
The same principle applies to SQL injection.
Normally:
Application
|
v
DatabaseApplication
|
v
DatabaseWith SQL injection:
Attacker Input
|
v
Application
|
v
Database QueryAttacker Input
|
v
Application
|
v
Database QueryCertain database technologies and configurations have features that can interact with the operating system.
In those specific situations, the chain can become:
SQL Injection
|
v
Database Feature
|
v
Operating System Interaction
|
v
Potential RCESQL Injection
|
v
Database Feature
|
v
Operating System Interaction
|
v
Potential RCEBut do not make this mistake:
SQLi = RCESQLi = RCEThat is incorrect.
SQL injection is a database injection vulnerability. RCE is an execution impact.
21. Prototype Pollution โ RCE
JavaScript developers need to understand this one.
JavaScript objects can inherit properties through prototypes.
If an application unsafely merges attacker-controlled objects, an attacker may be able to modify prototype properties.
Conceptually:
Attacker Input
|
v
Unsafe Object Merge
|
v
Prototype Pollution
|
v
Application Behaviour Changes
|
v
Dangerous Sink
|
v
Potential RCEAttacker Input
|
v
Unsafe Object Merge
|
v
Prototype Pollution
|
v
Application Behaviour Changes
|
v
Dangerous Sink
|
v
Potential RCEA common detection idea in a controlled application is to check whether a harmless property unexpectedly appears on unrelated objects.
For example, a lab may use a test property such as:
__proto__[test]=123__proto__[test]=123Then check whether the application behaves unexpectedly.
Again:
Prototype Pollution
โ
Automatically RCEPrototype Pollution
โ
Automatically RCEThere needs to be a reachable dangerous sink.
22. CI/CD โ RCE
Now let us connect RCE with DevSecOps.
Imagine:
Developer
|
v
Git Repository
|
v
CI/CD Pipeline
|
v
Build Runner
|
v
ApplicationDeveloper
|
v
Git Repository
|
v
CI/CD Pipeline
|
v
Build Runner
|
v
ApplicationSuppose a pipeline executes a user-controlled value as part of a build command.
The flow becomes:
Untrusted Input
|
v
Build Script
|
v
Shell / Interpreter
|
v
Command Execution
|
v
Build Runner RCEUntrusted Input
|
v
Build Script
|
v
Shell / Interpreter
|
v
Command Execution
|
v
Build Runner RCEThis can be very serious because the runner may have access to:
Source code
Package registries
Deployment credentials
Cloud credentials
Secrets
Internal systemsSource code
Package registries
Deployment credentials
Cloud credentials
Secrets
Internal systemsTherefore, DevSecOps engineers must treat CI/CD pipelines as security-sensitive systems.
23. Dependency Vulnerability โ RCE
Suppose your application uses:
Framework
Library A
Library B
Library CFramework
Library A
Library B
Library COne dependency contains a remotely exploitable RCE vulnerability.
The chain is:
Internet
|
v
Application
|
v
Vulnerable Dependency
|
v
Vulnerable Code Path
|
v
RCEInternet
|
v
Application
|
v
Vulnerable Dependency
|
v
Vulnerable Code Path
|
v
RCEThis is why vulnerability management should include:
Direct dependencies
Transitive dependencies
Frameworks
Runtime
Operating-system packages
Container imagesDirect dependencies
Transitive dependencies
Frameworks
Runtime
Operating-system packages
Container imagesYou should always verify the affected version and vulnerable feature before declaring an RCE finding.
24. Archive Extraction โ RCE
Imagine an application allows:
Upload ZIPUpload ZIPThe backend extracts it.
Normal:
ZIP
|
v
Extractor
|
v
/uploads/file.txtZIP
|
v
Extractor
|
v
/uploads/file.txtA vulnerable extraction process may allow an archive entry to escape the intended directory.
Conceptually:
Malicious Archive
|
v
Unsafe Extraction
|
v
Unexpected File Write
|
v
Overwrite Script/Config
|
v
Application Execution
|
v
Potential RCEMalicious Archive
|
v
Unsafe Extraction
|
v
Unexpected File Write
|
v
Overwrite Script/Config
|
v
Application Execution
|
v
Potential RCEThis is why archive extraction should always constrain the final destination of every extracted file.
25. LFI โ RCE
LFI means Local File Inclusion.
Imagine:
GET /page?file=homeGET /page?file=homeThe application loads a local file.
The security tester asks:
Can I control the filename?
Can I escape the intended directory?
Can I influence another file?
Can the included content be interpreted as code?Can I control the filename?
Can I escape the intended directory?
Can I influence another file?
Can the included content be interpreted as code?The chain can become:
LFI
|
v
Attacker-Controlled Content
|
v
Included File
|
v
Interpreter
|
v
RCELFI
|
v
Attacker-Controlled Content
|
v
Included File
|
v
Interpreter
|
v
RCEBut again, LFI does not automatically mean RCE.
The complete execution chain has to be demonstrated.
26. Log Poisoning โ RCE
This is a classic example of chaining vulnerabilities.
Suppose:
HTTP Request
|
v
Application
|
v
Access LogHTTP Request
|
v
Application
|
v
Access LogIf attacker-controlled information gets written into a log file, and another vulnerability allows that log to be interpreted as executable code, the chain may look like:
Controlled Input
|
v
Log File
|
v
File Inclusion
|
v
Code Interpretation
|
v
RCEControlled Input
|
v
Log File
|
v
File Inclusion
|
v
Code Interpretation
|
v
RCEThe lesson is important:
Sometimes the vulnerability is not dangerous by itself. The combination of two weaknesses creates the final impact.
27. WebSocket โ RCE
Modern applications use WebSockets for real-time communication.
For example:
Browser
|
| WebSocket Message
v
Server
|
v
Application LogicBrowser
|
| WebSocket Message
v
Server
|
v
Application LogicSuppose a WebSocket receives:
{
"action": "process",
"filename": "test.txt"
}{
"action": "process",
"filename": "test.txt"
}The security tester needs to understand:
Where does filename go?
What function processes it?
Is it passed to a command?
Is it passed to a parser?
Is it passed to a template?Where does filename go?
What function processes it?
Is it passed to a command?
Is it passed to a parser?
Is it passed to a template?The possible chain is:
WebSocket Input
|
v
Application Logic
|
v
Dangerous Sink
|
v
ExecutionWebSocket Input
|
v
Application Logic
|
v
Dangerous Sink
|
v
ExecutionThe transport mechanism changed from HTTP to WebSocket, but the security principle is the same.
28. GraphQL โ RCE
GraphQL itself does not normally execute operating-system commands.
However, GraphQL resolvers can call backend functionality.
For example:
GraphQL Query
|
v
Resolver
|
v
Backend Function
|
v
System UtilityGraphQL Query
|
v
Resolver
|
v
Backend Function
|
v
System UtilityIf a resolver passes attacker-controlled input into an unsafe execution function:
GraphQL Input
|
v
Resolver
|
v
Command Injection
|
v
RCEGraphQL Input
|
v
Resolver
|
v
Command Injection
|
v
RCETherefore, when testing GraphQL, do not only look at the query structure.
Look at what the resolver actually does with the supplied arguments.
29. Native Library Vulnerability โ RCE
Some applications process files using native libraries.
For example:
Upload Image
|
v
Image Library
|
v
Native CodeUpload Image
|
v
Image Library
|
v
Native CodeIf a remotely reachable memory corruption vulnerability exists in that library:
Malicious File
|
v
Vulnerable Parser
|
v
Memory Corruption
|
v
Control Flow Manipulation
|
v
Code ExecutionMalicious File
|
v
Vulnerable Parser
|
v
Memory Corruption
|
v
Control Flow Manipulation
|
v
Code ExecutionThis type of RCE is generally much more advanced than simple command injection.
You need knowledge of:
C/C++
Memory
Stack
Heap
Pointers
Assembly
Processes
CPU architecture
Mitigations
Exploit developmentC/C++
Memory
Stack
Heap
Pointers
Assembly
Processes
CPU architecture
Mitigations
Exploit development30. Sandbox Escape
Some applications intentionally allow users to execute code.
For example:
Online Python Runner
|
v
Sandbox
|
v
User CodeOnline Python Runner
|
v
Sandbox
|
v
User CodeThe security boundary is:
User Code
|
X
|
Host SystemUser Code
|
X
|
Host SystemIf a vulnerability allows the code to escape the sandbox:
User Code
|
v
Sandbox Vulnerability
|
v
Sandbox Escape
|
v
Host Code ExecutionUser Code
|
v
Sandbox Vulnerability
|
v
Sandbox Escape
|
v
Host Code ExecutionThis is another form of RCE-related security research.
31. Container Escape
Suppose the vulnerable application is running inside Docker:
HOST
|
+-----------------------+
| CONTAINER |
| |
| Web Application |
| | |
| v |
| RCE |
+-----------------------+HOST
|
+-----------------------+
| CONTAINER |
| |
| Web Application |
| | |
| v |
| RCE |
+-----------------------+RCE inside the container does not automatically mean host compromise.
But if the container has dangerous privileges or a relevant escape vulnerability:
Web RCE
|
v
Container
|
v
Escape
|
v
HostWeb RCE
|
v
Container
|
v
Escape
|
v
HostThis is why we should separate:
RCERCEfrom:
Privilege Escalation
Container Escape
Host CompromisePrivilege Escalation
Container Escape
Host CompromiseThey are different stages.
32. Debug Interface โ RCE
Developers sometimes leave debugging functionality enabled.
For example:
/debug
/admin
/console
/diagnostics/debug
/admin
/console
/diagnosticsSuppose a debug interface provides a powerful evaluation feature.
The architecture may become:
Internet
|
v
Debug Interface
|
v
Code Evaluation
|
v
RCEInternet
|
v
Debug Interface
|
v
Code Evaluation
|
v
RCEThe vulnerability may therefore be caused by:
Exposed interface
+
Insufficient authentication
+
Dangerous functionalityExposed interface
+
Insufficient authentication
+
Dangerous functionalityThis is why production environments should be carefully separated from development environments.
33. A-Z RCE Routes
Now let's put the major concepts together.
A โ Application Code Injection
B โ Build Pipeline Abuse
C โ Command Injection
D โ Deserialization
E โ Expression Injection
F โ File Upload
G โ Gadget Chains
H โ HTTP/WebSocket Input Paths
I โ Inclusion Chains
J โ Java Runtime/Library Vulnerabilities
K โ Kubernetes/Container Chains
L โ Local File Inclusion
M โ Memory Corruption
N โ Native Library Vulnerabilities
O โ OS Command Execution
P โ Prototype Pollution
Q โ Query Injection Chains
R โ Remote File Processing
S โ Server-Side Template Injection
T โ Third-Party Dependency Vulnerabilities
U โ Unsafe Archive/Object Processing
V โ Virtualisation/Sandbox Escape
W โ Web Debug/Admin Interfaces
X โ XML Processing Chains
Y โ YAML Unsafe Loading
Z โ Vulnerability ChainingA โ Application Code Injection
B โ Build Pipeline Abuse
C โ Command Injection
D โ Deserialization
E โ Expression Injection
F โ File Upload
G โ Gadget Chains
H โ HTTP/WebSocket Input Paths
I โ Inclusion Chains
J โ Java Runtime/Library Vulnerabilities
K โ Kubernetes/Container Chains
L โ Local File Inclusion
M โ Memory Corruption
N โ Native Library Vulnerabilities
O โ OS Command Execution
P โ Prototype Pollution
Q โ Query Injection Chains
R โ Remote File Processing
S โ Server-Side Template Injection
T โ Third-Party Dependency Vulnerabilities
U โ Unsafe Archive/Object Processing
V โ Virtualisation/Sandbox Escape
W โ Web Debug/Admin Interfaces
X โ XML Processing Chains
Y โ YAML Unsafe Loading
Z โ Vulnerability ChainingThis is a learning map, not an official OWASP classification. Some of these categories overlap.
34. The Most Important Part: Finding RCE
Now suppose you are testing an application.
Don't immediately start searching Google for:
"RCE payload""RCE payload"First understand the application's data flow.
Take this:
POST /api/diagnostic
{
"host": "127.0.0.1"
}POST /api/diagnostic
{
"host": "127.0.0.1"
}Your first question is:
Where does "host" go?Where does "host" go?Maybe:
host
|
v
API Controller
|
v
Diagnostic Function
|
v
System Commandhost
|
v
API Controller
|
v
Diagnostic Function
|
v
System CommandThat is interesting.
Now ask:
Can I influence the command?Can I influence the command?Then perform safe validation.
For example:
127.0.0.1; whoami127.0.0.1; whoamiIf the response shows the expected command output, you have strong evidence of command execution.
35. Burp Suite Testing Flow
For web/API security testing, Burp Suite is very useful.
The basic setup is:
Browser
|
v
+-----------+
| Burp Suite|
+-----------+
|
v
Web ApplicationBrowser
|
v
+-----------+
| Burp Suite|
+-----------+
|
v
Web ApplicationYou capture a request:
POST /api/diagnostic HTTP/1.1
Host: lab.example
Content-Type: application/json
{"host":"127.0.0.1"}POST /api/diagnostic HTTP/1.1
Host: lab.example
Content-Type: application/json
{"host":"127.0.0.1"}Send it to Repeater.
Then change only the relevant parameter:
{
"host": "127.0.0.1; whoami"
}{
"host": "127.0.0.1; whoami"
}Compare:
Original Response
vs
Modified ResponseOriginal Response
vs
Modified ResponseYou are looking for evidence of unexpected server-side execution.
36. A Good Beginner Testing Process
When you suspect RCE, follow this order:
1. Find Input
|
v
2. Understand Function
|
v
3. Identify Processing
|
v
4. Identify Dangerous Sink
|
v
5. Test Safely
|
v
6. Confirm Execution
|
v
7. Identify Execution Context
|
v
8. Determine Impact
|
v
9. Document Evidence1. Find Input
|
v
2. Understand Function
|
v
3. Identify Processing
|
v
4. Identify Dangerous Sink
|
v
5. Test Safely
|
v
6. Confirm Execution
|
v
7. Identify Execution Context
|
v
8. Determine Impact
|
v
9. Document EvidenceDo not skip step 2.
Many beginners find a parameter and immediately start injecting payloads without understanding what that parameter actually does.
That creates noise and false positives.
37. How to Identify a Dangerous Sink
Depending on the technology, look for functionality involving:
Command execution
Process creation
Dynamic evaluation
Template evaluation
Deserialization
File inclusion
Script execution
Native parsing
Archive extraction
Expression evaluationCommand execution
Process creation
Dynamic evaluation
Template evaluation
Deserialization
File inclusion
Script execution
Native parsing
Archive extraction
Expression evaluationFor example, conceptually:
run(user_input)run(user_input)is worth investigating.
Similarly:
evaluate(user_input)evaluate(user_input)is interesting.
And:
deserialize(user_input)deserialize(user_input)is interesting.
And:
render(user_input)render(user_input)may be interesting depending on how the rendering works.
But remember:
Seeing a dangerous-looking function does not automatically prove a vulnerability.
You need to establish whether attacker-controlled data can actually reach it in a dangerous way.
38. Safe Payloads You Should Know First
As a beginner, learn detection payloads before learning complicated exploitation payloads.
For command injection in an authorised Unix lab:
; whoami; whoamior:
; id; idFor simple timing validation:
; sleep 5; sleep 5For SSTI detection in template engines that use this syntax:
{{7*7}}{{7*7}}For arithmetic-based confirmation:
{{10+5}}{{10+5}}For some parameter-processing tests, simple special characters can help determine how input is handled:
'
"
;
|
&'
"
;
|
&But there is no universal payload that works everywhere.
Payload syntax depends on:
Operating system
Shell
Programming language
Framework
Template engine
Parser
Input validation
Encoding
Application architectureOperating system
Shell
Programming language
Framework
Template engine
Parser
Input validation
Encoding
Application architecture39. Why Payloads Sometimes Fail
Suppose you try:
; whoami; whoamiand nothing happens.
Do not immediately conclude:
"The application is secure."
Several other possibilities exist.
Maybe:
The application does not use a shell.
The input is escaped.
The input is allowlisted.
The application uses a safe API.
The command is executed asynchronously.
The output is not returned.
A WAF modified the request.
The payload reached a different code path.
The endpoint is not vulnerable.The application does not use a shell.
The input is escaped.
The input is allowlisted.
The application uses a safe API.
The command is executed asynchronously.
The output is not returned.
A WAF modified the request.
The payload reached a different code path.
The endpoint is not vulnerable.So a failed payload is only a failed test.
It is not automatically proof of security.
40. Input Transformation
Applications may transform input before using it.
For example:
Your Input
|
v
URL Decode
|
v
JSON Parse
|
v
Validation
|
v
Normalisation
|
v
Backend FunctionYour Input
|
v
URL Decode
|
v
JSON Parse
|
v
Validation
|
v
Normalisation
|
v
Backend FunctionTherefore, what you send may not be what the final function receives.
During testing, understand the transformations.
This is especially important for:
URL encoding
Unicode
JSON
Base64
HTML encoding
Command escaping
CanonicalisationURL encoding
Unicode
JSON
Base64
HTML encoding
Command escaping
Canonicalisation41. Authentication Makes a Huge Difference
An RCE endpoint may be:
PublicPublicor:
AuthenticatedAuthenticatedor:
Admin-onlyAdmin-onlyThese situations can have very different risk profiles.
For example:
Internet
|
v
Unauthenticated RCE
|
v
ServerInternet
|
v
Unauthenticated RCE
|
v
Serveris generally far more concerning than:
Admin User
|
v
Authenticated Admin Function
|
v
RCEAdmin User
|
v
Authenticated Admin Function
|
v
RCEYou must consider the complete attack path.
42. What Happens After RCE?
This is where security impact becomes important.
Suppose you safely confirm:
whoamiwhoamireturns:
webappwebappNow you know:
RCE
|
v
webapp userRCE
|
v
webapp userYou can then assess, within your authorised environment:
What files can the process access?
What application configuration is available?
What network connections are possible?
What privileges does the process have?
Is the application containerised?
What security controls are present?What files can the process access?
What application configuration is available?
What network connections are possible?
What privileges does the process have?
Is the application containerised?
What security controls are present?Do not jump directly to destructive post-exploitation.
The goal of a professional assessment is to establish impact while minimising risk.
43. RCE Does Not Mean Root
This deserves to be repeated.
Suppose:
whoami
webappwhoami
webappThat means the command executed as:
webappwebappIt does not mean:
rootrootThink:
RCE
|
v
Execution Context
|
v
Privileges
|
v
Accessible ResourcesRCE
|
v
Execution Context
|
v
Privileges
|
v
Accessible ResourcesA low-privileged RCE can still be serious, but you should report the actual privilege level.
44. RCE and Confidentiality
If the compromised process can access application secrets, RCE may affect confidentiality.
For example:
RCE
|
+--> Application configuration
|
+--> Database connection information
|
+--> Internal API credentials
|
+--> Application filesRCE
|
+--> Application configuration
|
+--> Database connection information
|
+--> Internal API credentials
|
+--> Application filesDo not unnecessarily retrieve real secrets during testing.
It is normally enough to demonstrate that the process has access to a particular protected resource, following the rules of the engagement.
45. RCE and Integrity
RCE can also affect application integrity.
For example:
RCE
|
v
Application Process
|
+--> Modify application files
+--> Modify temporary files
+--> Alter application dataRCE
|
v
Application Process
|
+--> Modify application files
+--> Modify temporary files
+--> Alter application dataThe exact impact depends on permissions.
Again, never modify production data just to prove a point when a harmless proof is sufficient.
46. RCE and Availability
Code execution can potentially affect availability:
RCE
|
v
Server Process
|
v
Resource Consumption
|
v
Service DisruptionRCE
|
v
Server Process
|
v
Resource Consumption
|
v
Service DisruptionBut intentionally crashing or disrupting a production system is generally unnecessary for proving an RCE vulnerability.
A professional tester demonstrates impact with the minimum necessary action.
47. Vulnerability Chaining
This is where your understanding should become more mature.
Imagine you find:
SSRFSSRFBut SSRF alone does not provide code execution.
Later you discover:
Internal Admin EndpointInternal Admin EndpointAnd that endpoint has:
Command InjectionCommand InjectionNow:
SSRF
|
v
Internal Admin Endpoint
|
v
Command Injection
|
v
RCESSRF
|
v
Internal Admin Endpoint
|
v
Command Injection
|
v
RCEThis is called vulnerability chaining.
Another example:
Prototype Pollution
|
v
Dangerous Configuration
|
v
Command Execution
|
v
RCEPrototype Pollution
|
v
Dangerous Configuration
|
v
Command Execution
|
v
RCEAnother:
File Upload
|
v
Unsafe Storage
|
v
Executable File
|
v
RCEFile Upload
|
v
Unsafe Storage
|
v
Executable File
|
v
RCEThis is how you should start thinking like a security researcher.
48. Common Mistakes Beginners Make
The first mistake is:
"I found a suspicious parameter, so it must be RCE."
No.
You need to understand the complete data flow.
Second mistake:
"The scanner says RCE."
A scanner may report a potential vulnerability.
You need to validate it.
Third mistake:
"SSTI means RCE."
Not always.
SSTI can have different levels of impact depending on the engine and configuration.
Fourth mistake:
"RCE means root."
Wrong.
RCE executes with the privileges of the affected process unless additional privilege escalation occurs.
Fifth mistake:
"One payload should work everywhere."
Wrong again.
Different technologies behave differently.
49. How Developers Fix Command Injection
The best solution is to avoid shell execution when it is unnecessary.
Instead of:
User Input
|
v
Shell CommandUser Input
|
v
Shell Commandprefer:
User Input
|
v
Validated Value
|
v
Safe APIUser Input
|
v
Validated Value
|
v
Safe APIIf command execution is genuinely required:
Strict allowlist
+
Argument separation
+
No shell interpretation
+
Least privilege
+
Input validationStrict allowlist
+
Argument separation
+
No shell interpretation
+
Least privilege
+
Input validationis much safer than simply trying to blacklist characters.
50. How Developers Prevent SSTI
The most important thing is to keep:
TEMPLATETEMPLATEseparate from:
USER DATAUSER DATASafe architecture:
Template
+
Data
|
v
Template EngineTemplate
+
Data
|
v
Template EngineDangerous architecture:
User Input
|
v
Template Source
|
v
Template EngineUser Input
|
v
Template Source
|
v
Template EngineUse safe templating features and avoid dynamically compiling templates from untrusted input.
51. How Developers Prevent Deserialization RCE
The basic rule is:
Do not deserialize untrusted data using a mechanism that can instantiate arbitrary objects or invoke dangerous behaviour.
Better approaches include:
Use simple data formats
Use strict schemas
Use safe parsers
Allowlist expected types
Avoid native object deserialization
Keep dependencies patchedUse simple data formats
Use strict schemas
Use safe parsers
Allowlist expected types
Avoid native object deserialization
Keep dependencies patchedFor APIs, JSON with strict schema validation is often easier to secure than arbitrary native object serialization.
52. How Developers Prevent File-Upload RCE
A secure upload system should consider:
1. File type
2. File content
3. File size
4. Filename
5. Storage location
6. Execution permissions
7. Access control
8. Malware/content scanning where appropriate1. File type
2. File content
3. File size
4. Filename
5. Storage location
6. Execution permissions
7. Access control
8. Malware/content scanning where appropriateMost importantly:
Uploaded Files
|
v
Non-Executable StorageUploaded Files
|
v
Non-Executable Storageshould be the default architecture where possible.
53. How DevSecOps Helps Prevent RCE
RCE prevention should happen throughout the software lifecycle.
Developer
|
v
Source Code
|
v
SAST
|
v
Dependency Scan
|
v
Build Security
|
v
Container Scan
|
v
DAST
|
v
API Security Testing
|
v
Deployment
|
v
Runtime MonitoringDeveloper
|
v
Source Code
|
v
SAST
|
v
Dependency Scan
|
v
Build Security
|
v
Container Scan
|
v
DAST
|
v
API Security Testing
|
v
Deployment
|
v
Runtime MonitoringThis is the DevSecOps approach:
Find security problems as early as possible, but also continue monitoring after deployment.
54. A Simple RCE Investigation Checklist
When you suspect RCE, write down:
[ ] What is the vulnerable endpoint?
[ ] What input can I control?
[ ] Where does the input go?
[ ] Is there a dangerous sink?
[ ] What technology is being used?
[ ] Is command execution involved?
[ ] Is code execution involved?
[ ] Is the execution blind or visible?
[ ] Can I reproduce it?
[ ] Can I verify it safely?
[ ] Which user executes the code?
[ ] What privileges does that user have?
[ ] What is the realistic impact?
[ ] Can I stop testing without causing damage?
[ ] Can I provide clear evidence?[ ] What is the vulnerable endpoint?
[ ] What input can I control?
[ ] Where does the input go?
[ ] Is there a dangerous sink?
[ ] What technology is being used?
[ ] Is command execution involved?
[ ] Is code execution involved?
[ ] Is the execution blind or visible?
[ ] Can I reproduce it?
[ ] Can I verify it safely?
[ ] Which user executes the code?
[ ] What privileges does that user have?
[ ] What is the realistic impact?
[ ] Can I stop testing without causing damage?
[ ] Can I provide clear evidence?This checklist is much more useful than maintaining a huge list of payloads.
55. The RCE Mindset
When you see:
host=127.0.0.1host=127.0.0.1don't immediately think:
"Which payload?""Which payload?"Think:
Where does host go?
|
v
How is it processed?
|
v
Does it reach a command?
|
v
Does a shell interpret it?
|
v
Can I prove execution safely?Where does host go?
|
v
How is it processed?
|
v
Does it reach a command?
|
v
Does a shell interpret it?
|
v
Can I prove execution safely?When you see:
template={{username}}template={{username}}think:
Is username data?
|
v
Or is it becoming template code?
|
v
Can the template engine evaluate it?Is username data?
|
v
Or is it becoming template code?
|
v
Can the template engine evaluate it?When you see:
serialized_data=...serialized_data=...think:
What format?
|
v
Which parser?
|
v
Can attacker control it?
|
v
Does deserialization instantiate objects?
|
v
Can dangerous behaviour occur?What format?
|
v
Which parser?
|
v
Can attacker control it?
|
v
Does deserialization instantiate objects?
|
v
Can dangerous behaviour occur?This is the difference between:
Payload Collector
and
Security Tester.
56. The Complete RCE Picture
Finally, keep this diagram in your mind:
ATTACKER
|
v
INPUT / FILE
|
v
+----------------+
| WEB / API |
| APPLICATION |
+----------------+
|
v
DATA PROCESSING
|
+--------------+--------------+
| | |
v v v
Command Template Deserializer
Execution Engine Parser
| | |
+--------------+--------------+
|
v
DANGEROUS SINK
|
v
CODE EXECUTION
|
v
RCE
|
+------------+------------+
| | |
v v v
Files Processes Network
| | |
+------------+------------+
|
v
IMPACTATTACKER
|
v
INPUT / FILE
|
v
+----------------+
| WEB / API |
| APPLICATION |
+----------------+
|
v
DATA PROCESSING
|
+--------------+--------------+
| | |
v v v
Command Template Deserializer
Execution Engine Parser
| | |
+--------------+--------------+
|
v
DANGEROUS SINK
|
v
CODE EXECUTION
|
v
RCE
|
+------------+------------+
| | |
v v v
Files Processes Network
| | |
+------------+------------+
|
v
IMPACTAnd there are many possible routes:
Command Injection
โ
RCE
SSTI
โ
Code Execution
โ
RCE
Deserialization
โ
Gadget Chain
โ
RCE
File Upload
โ
Executable Processing
โ
RCE
SSRF
โ
Internal Service
โ
Command Injection
โ
RCE
Dependency Vulnerability
โ
Vulnerable Code Path
โ
RCECommand Injection
โ
RCE
SSTI
โ
Code Execution
โ
RCE
Deserialization
โ
Gadget Chain
โ
RCE
File Upload
โ
Executable Processing
โ
RCE
SSRF
โ
Internal Service
โ
Command Injection
โ
RCE
Dependency Vulnerability
โ
Vulnerable Code Path
โ
RCE57. Final Lesson
Don't try to become good at RCE by memorising hundreds of payloads.
Payloads are useful, but they are only one small part of the job.
The real skill is understanding this:
INPUT
โ
PROCESSING
โ
SINK
โ
EXECUTION
โ
PRIVILEGE
โ
IMPACTINPUT
โ
PROCESSING
โ
SINK
โ
EXECUTION
โ
PRIVILEGE
โ
IMPACTFor every suspected RCE, ask:
"Can I control the input?"
"Where does that input go?"
"What interprets it?"
"Does it reach an execution sink?"
"Can I prove execution safely?"
"Under which user does it execute?"
"What is the actual security impact?"
Once you start thinking in this way, RCE stops being a collection of scary payloads and becomes a logical problem of data flow and trust boundaries.
That is the foundation you need before moving into advanced RCE research, exploit analysis, vulnerability chaining, and exploit development.
Follow Like Share Comment downโฆ.