Command injection is making the target execute an arbitrary shell command. Your input is a text string (the command). Code injection us making the target execute arbitrary native (or managed) code. Your input is a sequence of bytes (a shellcode). They can both be local if you need to be on the machine itself or remote if you can do it from the network. Answer from ProperWerewolf2 on reddit.com
🌐
OWASP Foundation
owasp.org › www-community › attacks › Command_Injection
Command Injection | OWASP Foundation
This attack differs from Code ... In Command Injection, the attacker extends the default functionality of the application, which execute system commands, without the necessity of injecting code....
🌐
Invicti
invicti.com › learn › remote-code-execution-rce
Remote Code Execution (RCE)
Configure your WAFs to detect injection attempts and common RCE attack patterns · Ensure your WAF signatures are frequently updated to keep up with emerging threats · Monitor systems and logs for abnormal command execution activity
Discussions

What is the difference Between Command Injection VS Remote Code Injection and code injection?
Command injection is making the target execute an arbitrary shell command. Your input is a text string (the command). Code injection us making the target execute arbitrary native (or managed) code. Your input is a sequence of bytes (a shellcode). They can both be local if you need to be on the machine itself or remote if you can do it from the network. More on reddit.com
🌐 r/AskNetsec
4
19
March 27, 2023
Need help - routersploit blind command injection

I'm having the same problem just with a Netgear router r8000p (fw: v1.4.1.68_1.3.28). Did you ever find a solution?

I used a normal ubuntu 20.04 LTS and kali nethunter on a oneplus 6t

More on reddit.com
🌐 r/Pentesting
1
1
August 17, 2020
Pwning coworkers thanks to LaTeX

I've always considered latex documents like I would consider a .sh or makefile sent from a colleague: unstrusted but shrug.

I mean, really, if a coworker sends me a shell file that rm -rf --no-preserve-roots my system, hidden in some git-timesheet-csv.sh file, I consider her or him a dick and would probably argue with my boss or team-leader to kick that person out immediately.

I never considered anything that I need to compile (including markdown, sourcecode, latex) as something safe.

Maybe I'm just paranoid, but the actual surprising thing I took from this blogpost is not that latex can be used to run code, but that somehow people consider compiling latex from arbitrary sources as a good idea.

More on reddit.com
🌐 r/netsec
33
159
November 29, 2016
Error based SQL injection how to RCE with xp_cmdshell
Your issue appears to stem from trying to include multiple statements in a context where only single SQL statements are expected. The SQL injection context you're dealing with doesn't seem to support the execution of multiple SQL commands separated by semicolons. I'm guessing this because every command you're saying doesn't work includes a semicolon. The SQL injection may be within a query that expects conditions for a WHERE clause. When you try to append another statement (even with a semicolon), it still treats it as part of the WHERE clause, leading to a syntax error, especially if there are clauses that follow your injection point. There could also be some protections in place or something. That's my guess at least. More on reddit.com
🌐 r/HowToHack
6
2
April 21, 2024
People also ask

What is the difference between RCE and command injection?
Command injection is a type of injection vulnerability that allows attackers to inject and execute malicious system commands. Remote code execution (also called code injection) is a broader concept that covers a wide variety of arbitrary code execution vectors, including deserialization vulnerabilities and buffer overflows.
🌐
invicti.com
invicti.com › learn › remote-code-execution-rce
Remote Code Execution (RCE)
What is OS command injection?
OS command injection is a vulnerability that lets a malicious hacker trick an application into executing operating system commands. OS command injection is also known as command injection or shell injection. · Read an article that explains command injection in detail.
🌐
invicti.com
invicti.com › learn › os-command-injection
OS Command Injection
How to detect command injection?
Dynamic application security testing (DAST) tools are the best way to detect command injection vulnerabilities in web applications. They provide the best coverage and some of them, like Invicti, are able to prove that the vulnerability is real and not a false positive. · Find out more about dynamic application security testing (DAST).
🌐
invicti.com
invicti.com › learn › os-command-injection
OS Command Injection
🌐
Cloudflare
cloudflare.com › learning › security › what-is-remote-code-execution
What is remote code execution? | Cloudflare
Several types of vulnerabilities can be used for RCE, including the following examples: Injection vulnerabilities: An injection vulnerability — such as SQL injection or command injection — is enabled by poor input sanitization.
🌐
Reddit
reddit.com › r/asknetsec › what is the difference between command injection vs remote code injection and code injection?
r/AskNetsec on Reddit: What is the difference Between Command Injection VS Remote Code Injection and code injection?
March 27, 2023 -

Hi I was learning about web vulnerabilities and got confused about RCE and CI, Can anyone please explain me what is the difference between remote code injection & Command injection and code injection ?

Top answer
1 of 4
24
Command injection is making the target execute an arbitrary shell command. Your input is a text string (the command). Code injection us making the target execute arbitrary native (or managed) code. Your input is a sequence of bytes (a shellcode). They can both be local if you need to be on the machine itself or remote if you can do it from the network.
2 of 4
6
Remote (or the absence of remote) just indicates the position of the attacker. If I can inject commands into an application it's command injection. If I can do it via some web service and carry out the attack across the network (or web) then it's remote command injection. Command injection is usually used to signify the attacker is injecting information into some prebuild command that is already being run. For example if I had a script that did this... system(touch $fileName); and the attacker controlled the $fileName variable that would be command injection. Code Execution is just being able to execute code on a system. All examples of command injection are code execution, but not all examples of code execution are command injection. It's a broader category. An example of this would be memory corruption vulnerabilities. It let's me execute actions (shellcode), but it wasn't done through injecting into a pre-built command. Code injection is almost synonymous with code execution imo. Typically though it's used in the context of one process interacting with another. I might have a binary where it will open a second process, "inject" code into it, and make it run under that second binary. You'll notice the purpose of code injection is almost always to execute that code, hence they can be confusing sometimes. If you held a gun to my head to define the two differently I'd say the injection is placing the code into the process, and the execution is what happens (typically) as a consequence.
🌐
HackTricks
book.hacktricks.xyz › home › pentesting web › command injection
Command Injection - HackTricks
POST /cgi-bin/cstecgi.cgi HTTP/1.1 Content-Type: application/x-www-form-urlencoded # Flip options in a downstream tool via argv injection topicurl=<handler>&param=-n # Unauthenticated RCE when a handler concatenates into a shell topicurl=setEasyMeshAgentCfg&agentName=;id; Any primitive that lets you inject JVM command-line arguments (_JAVA_OPTIONS, launcher config files, AdditionalJavaArguments fields in desktop agents, etc.) can be turned into a reliable RCE without touching application bytecode:
🌐
Hakluke
hakluke.com › remote-code-execution-vs-remote-command-execution-vs-code-injection-vs-command-injection-vs-rce
Hakluke | Remote Code Execution vs. Remote Command Execution vs. Code Injection vs. Command Injection vs. RCE
In other words, RCE is the impact of a vulnerability that allows an attacker to execute code and/or commands remotely. TL;DR: Injection is a type of vulnerability, execution is a type of impact.
Find elsewhere
🌐
Medium
dewcode.medium.com › remote-code-execution-vs-command-execution-df75707aed91
Remote Code Execution Vs Command Execution | by Dewanand Vishal | Medium
November 21, 2022 - This type of attack exploits poor handling of untrusted data. These types of attacks are usually made possible due to a lack of proper input/output data validation. RCE stands for Remote Code Execution.
🌐
ExtraHop
extrahop.com › resources › attacks › remote-code-execution
What is a Remote Code Execution (RCE) Attack? Definition & Prevention | ExtraHop
Remote code execution (RCE), also known as code injection or remote code evaluation, is a technique to exploit an application's input validation flaws to execute malicious code over a network.
🌐
Invicti
invicti.com › learn › os-command-injection
OS Command Injection
Note that OS command injection is often confused with remote code execution (RCE), also known as code injection. In the case of RCE, the attacker executes malicious code in the language of the application and within the application context. In the case of OS command injection, the attacker ...
🌐
Acunetix
acunetix.com › home › web security blog › what is code injection (remote code execution)
What is Code Injection (Remote Code Execution) | Acunetix
December 23, 2022 - Code Injection or Remote Code Execution (RCE) enables the attacker to execute malicious code as a result of an injection attack. Code Injection attacks are different than Command Injection attacks.
🌐
PortSwigger
portswigger.net › web-security › os-command-injection
What is OS command injection, and how to prevent it? | Web Security Academy
In this section, we explain what OS command injection is, and describe how vulnerabilities can be detected and exploited. We also show you some useful ...
🌐
Akamai
akamai.com › blog › security research › exploit me, baby, one more time: command injection in kubernetes log query
Exploit Me, Baby, One More Time: Command Injection in Kubernetes Log Query | Akamai
January 24, 2025 - The vulnerability allows remote code execution (RCE) with SYSTEM privileges on all Windows endpoints within a Kubernetes cluster.
🌐
Qwiet AI
shiftleft.io › blog › find-command-injection-in-source-code
Find command injection in source code - Preventing the Unpreventable | Qwietᴬᴵ
July 31, 2023 - If the untrusted user input can get from “source” to “sink” without proper sanitization or validation, there is a command injection vulnerability. Many common vulnerabilities can be identified by tracking this “dataflow” from appropriate ...
🌐
Splunk
splunk.com › en_us › blog › learn › rce-remote-code-execution.html
Remote Code Execution (RCE) Explained in Detail | Splunk
Attackers inject malicious code ... ... Exploit vulnerabilities in the deserialization process of an application. Attackers manipulate serialized data to execute malicious code during deserialization. This occurs when an attacker writes data beyond the boundaries of a memory buffer or data structure...
🌐
Medium
fdzdev.medium.com › top-10-ways-to-achieve-remote-code-execution-rce-on-web-applications-d923246b916b
Top 10 Ways to Achieve Remote Code Execution (RCE) on Web Applications | by Facundo Fernandez | Medium
July 1, 2025 - Explanation: OS command injection occurs when an application takes untrusted user input and inserts it into a system command (shell command) without proper sanitization This allows an attacker to break out of the intended command context and ...
🌐
SentinelOne
sentinelone.com › cybersecurity-101 › threat-intelligence › what-is-remote-code-execution-rce
What is RCE (Remote Code Execution)? Working and Use Cases
November 13, 2025 - By injecting malicious code through input fields or exploiting vulnerabilities like SQL injection, they can compromise web servers and execute arbitrary code. Vulnerabilities in software and operating systems are also prime targets for RCE attacks. Malicious actors seek out and exploit these weaknesses to execute code, gain unauthorized access, and potentially compromise the entire system. In some cases, RCE is achieved through command injection attacks...
🌐
LinkedIn
linkedin.com › pulse › remote-code-execution-rce-deepak-baghel
REMOTE CODE EXECUTION (RCE)
September 2, 2019 - In Command injection, the attacker can executed different type of codes and gain the important data of the company, also attacker can extend the functionality of the application without injection their own code into the application.
🌐
Trend Micro
success.trendmicro.com › en-US › solution › KA-0017998
SECURITY BULLETIN: Trend Micro Cloud Edge Command Injection RCE Vulnerability
October 15, 2024 - Release Date: October 15, 2024 CVE Identifiers: CVE-2024-48904 Platform: Appliance CVSS 3.0 Score(s): 9.8 Severity Rating(s): Critical Trend Micro has released new builds for the Trend Micro Cloud Edge appliance that resolves a command injection remote code execution (RCE) vulnerability.
🌐
Akamai
akamai.com › glossary › what is remote code execution (rce) vulnerability?
What Is Remote Code Execution (RCE) Vulnerability? | Akamai
One way in which an RCE vulnerability is exploited is by exploiting input fields or parameters that allow for user-generated data. This is accomplished by injecting carefully designed input that contains executable commands or scripts, allowing ...
🌐
GitHub
github.com › baserproject › basercms › security › advisories › GHSA-qxmc-6f24-g86g
OS Command Injection Leading to Remote Code Execution (RCE)
baserCMS のコアアップデー...が存在します。 この問題により、認証済みの CMS 管理者がサーバー上で任意の OS コマンドを実行できる(Remote Code Execution, RCE) 状態となり...