Command/Code Injection vulnerabilities
12 real-world command/code injection CVEs, from the bug in the code to the exploit. Each one is a short hands-on exercise in Hexret: find the vulnerable line, follow the exploit and learn the fix.
- CVE-2024-9474high 7.22024
PAN-OS audit-log username command injection
The audit logger shell-escapes the message but concatenates the session username directly into a command, allowing shell metacharacters in that username to execute with root privileges.
- CVE-2024-45519critical 9.82024
Zimbra postjournal SMTP recipient command injection
The postjournal service carried the RCPT TO recipient through address expansion into read_maps, interpolated the address into a shell command, and passed the string to popen. Shell substitution syntax remained active inside the command's double quotes. The patch adds input validation and uses execvp with an argument vector.
- CVE-2023-36664high 7.82023
Ghostscript pipe-device command injection (CVE-2023-36664)
A path-permission check normalizes the target path before validating it, so a special device string that the normalizer rewrites slips past the sandbox and opens a command pipe, giving code execution from a crafted document.
- CVE-2023-1389high 8.82023
TP-Link Archer locale command injection
An unauthenticated locale API places the country parameter inside a command string that firmware executes with popen as root.
- CVE-2022-26134critical 9.82022
Confluence OGNL injection in the request path
An unauthenticated request whose URL path becomes a routing value is passed to a variable-interpolation helper that evaluates the value as an OGNL expression, giving remote code execution.
- CVE-2022-22963critical 9.82022
Spring Cloud Function header-supplied SpEL injection
The function router evaluated a routing expression taken from an HTTP-derived message header with Spring's powerful standard expression context, allowing untrusted input to invoke Java types and methods instead of merely selecting a function.
- CVE-2021-44228critical 10.02021
Log4Shell: JNDI lookup in logged input (CVE-2021-44228)
A string logged by Log4j with message lookups enabled can carry a JNDI reference, making the logger resolve an attacker-controlled name through JNDI and load a remote class. Nicknamed Log4Shell (Log4j plus shell), it scored a perfect 10.0, was reported by Chen Zhaojun of Alibaba Cloud, and became one of the most widely exploited vulnerabilities ever.
- CVE-2021-26084critical 9.82021
Confluence Webwork Unicode-escape OGNL injection
Several Velocity templates placed request-controlled values inside quoted OGNL expressions. OGNL decoded Java-style Unicode escapes while tokenizing, so an input containing the escape for a quote could terminate the intended string literal and append a new expression.
- CVE-2019-10149critical 9.82019
Exim recipient-address command injection (Return of the WIZard)
The recipient address is spliced into a string that Exim's recursive expander evaluates, so a ${run{...}} carried in the local part runs a shell command as root.
- CVE-2019-5736high 8.62019
runc container escape via /proc/self/exe
A container runtime re-executes its own on-disk binary through /proc/self/exe to enter the sandbox, so code running in the sandbox can grab a writable handle to that binary and overwrite it, taking over the host.
- CVE-2017-5638critical 9.82017
Apache Struts Jakarta parser OGNL injection (S2-045)
An invalid Content-Type on a multipart upload makes the Jakarta parser throw an exception whose message carries the raw header, and Struts passes that message to an error formatter that evaluates OGNL, so a crafted expression in the header runs commands on the server.
- CVE-2014-6271critical 9.82014
Bash environment function import command injection (Shellshock, CVE-2014-6271)
Bash imported environment variables that looked like exported functions by parsing them with its full evaluator, which did not stop at the end of the function body, so any commands appended after it ran at shell startup. Nicknamed Shellshock (a pun on the WWI term shell shock, reframed as a shock to the Unix shell), it became remote code execution wherever a server passed untrusted data into bash's environment, most notably CGI.