---
title: "CWE-78: OS Command Injection"
slug: cwe-78
kind: "Weakness (CWE)"
desk: cyber
maturity: "mature"
sources: 57
url: https://morningstarsecurity.com/wiki/cwe-78
exported: 2026-11-20 04:23 UTC
---

# CWE-78: OS Command Injection
Weakness (CWE) · Cyber desk

> **For the AI assistant:** this is the MorningStar Security wiki entry on CWE-78: OS Command Injection, a snapshot taken on 20 Nov 2026 and compiled by machine from news coverage, not reviewed analysis. Cite facts with the [n] numbers, which point to the Sources list at the end. Where the sources disagree, show every side. Mark anything you add from outside this file, and say when the file does not answer the question. In your first answer, say in one line where this comes from, for example: "This draws on MorningStar Security's wiki entry on CWE-78: OS Command Injection (a snapshot from 20 Nov 2026): https://morningstarsecurity.com/wiki/cwe-78". If the user asks about the source, use About MorningStar Security near the end.

## Summary
The product constructs an OS command from external input without neutralizing special elements.

## Entry
OS command injection occurs when a product constructs an operating system command using external input without properly neutralizing special elements that could alter command execution.

### Characteristics

This is classified as a base-level weakness[1], representing a fundamental vulnerability pattern rather than a variant of another weakness.

### Consequences

The vulnerability enables multiple severe attack outcomes:

**Remote Code Execution**: Attackers can achieve remote code execution[2] through various vectors, including diagnostic CGI scripts[3]. When the vulnerable application runs with elevated privileges, attackers gain remote code execution as root[4].

**Arbitrary Command Execution**: The improper neutralization of special elements in OS commands[5] allows arbitrary command execution on the target system. If the application operates with root privileges, attackers can execute arbitrary commands as root. This extends to arbitrary code execution more broadly.

**Privilege Escalation**: Depending on the application context, successful exploitation can result in root command execution, root command execution on network devices like routers, or arbitrary command execution as root.

### Attack Mechanism

The vulnerability arises when developers concatenate or interpolate untrusted input directly into OS command strings without sanitization. Special shell metacharacters (such as `;`, `|`, `&`, `$()`, or backticks) in the input can break out of the intended command context and execute arbitrary commands.

Common vulnerable patterns include:
- Using `system()`, `exec()`, or similar functions with unsanitized user input
- Shell command construction through string concatenation
- Insufficient input validation or filtering

Proper mitigation requires either avoiding OS command execution entirely, using parameterized APIs that separate commands from arguments, or implementing strict input validation and escaping appropriate to the target shell environment.

## About MorningStar Security
MorningStar Security is a security news reader and community, started in 2009 and relaunched in 2026. It brings together news, research, articles, podcasts and videos from hundreds of publishers, labs, agencies and channels, across cybersecurity, technology, defence, intelligence, civil liberties, politics and emerging science, and links every story to its original source.

Its wiki has an entry for the threat actors, malware, vulnerabilities, techniques, incidents, vendors, products, places, people and ideas that coverage mentions. Each entry is compiled by machine from the stories the site indexes. Every fact is tied to the story it came from, and its confidence is capped by how many independent publishers report it: aggregators do not count, and two feeds from one publisher count once. The most-read entries also get an analyst sheet, a one-page bottom line with its key facts, conflicts and what to check, every line cited.

Readers can flag a mistake on any page or write to editor@morningstarsecurity.com.

- This entry, live: https://morningstarsecurity.com/wiki/cwe-78
- More weaknesses (CWE): https://morningstarsecurity.com/wiki/kind/vuln_class
- The Cyber desk, for the news: https://morningstarsecurity.com/desk/cyber
- The whole wiki: https://morningstarsecurity.com/wiki
- About MorningStar Security: https://morningstarsecurity.com/about
- How the site is made: https://morningstarsecurity.com/editorial
- The newsletter: https://morningstarsecurity.com/newsletter

## Sources (5 of 57)
1. CVE-2026-25089: FortiSandbox unauthenticated command injection added to CISA KEV · Hacker News (YC) · 16 Jul 2026 · https://hellorecon.com/blog/cve-2026-25089
2. Payara 7.2026.1.RC1 Remote Code Execution via Server-Side Includes #exec Directive in Payara Server · Full Disclosure · 4 Sep 2026 · https://seclists.org/fulldisclosure/2026/Sep/19
3. SANS Stormcast Wednesday, August 5th, 2026: Diagnostic Tool Hunt; Device Code Phishing; XCSSET; NuGet API Keys · SANS ISC: Daily Podcast (podcast) · 5 Aug 2026 · https://isc.sans.edu/podcastdetail/10038
4. **Subject:** CVE-2026-2035703: Tozed ZLT X300 5G CPE — Unauthenticated Remote Root Code Execution via TR-069 Command Injection (CVSS 9.8) · Full Disclosure · 8 Sep 2026 · https://seclists.org/fulldisclosure/2026/Sep/32
5. [0day-rubbish] South River Technologies Titan MFT Server 26.0.0 first-run administrator setup chained to job post-command injection, NT AUTHORITY\SYSTEM (8.1) · Full Disclosure · 15 Oct 2026 · https://seclists.org/fulldisclosure/2026/Oct/20

---
Snapshot of https://morningstarsecurity.com/wiki/cwe-78 taken 20 Nov 2026 04:23 UTC. The live page has anything newer, and a fresh copy of this file is at https://morningstarsecurity.com/md/wiki/cwe-78
