Back to Labs
Weakness (CWE)

CWE-77

Improper Neutralization of Special Elements used in a Command ('Command Injection')

About

The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component.

Many protocols and products have their own custom command language. While OS or shell command strings are frequently discovered and targeted, developers may not realize that these other command languages might also be vulnerable to attacks.

Common consequences

  • Integrity, Confidentiality, Availability → Execute Unauthorized Code or Commands

Mitigations

  • Architecture and Design: If at all possible, use library calls rather than external processes to recreate the desired functionality.
  • Implementation: If possible, ensure that all external commands called from the program are statically created.
  • Implementation: Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a list of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does. When performing input validation, consider all potentially relevant properties, including length, type of input
  • Operation: Run time: Run time policy enforcement may be used in an allowlist fashion to prevent use of any non-sanctioned commands.
  • System Configuration: Assign permissions that prevent the user from accessing/opening privileged files.

CVEs with this weakness

Frequently asked questions

What is CWE-77?

The product constructs all or part of a command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended command when it is sent to a downstream component. Many protocols and products have their own custom command language.

How likely is CWE-77 to be exploited?

MITRE rates the likelihood of exploit for CWE-77 as high.

Which platforms does CWE-77 affect?

CWE-77 has been observed on: AI/ML.

How many CVEs does Rainforest track for CWE-77?

Rainforest Labs currently tracks 5 published CVEs mapped to CWE-77. They are listed on this page.

Empower Your Security Strategy with Rainforest

Discover vulnerabilities early, prioritize critical threats, and protect what truly matters. Rainforest streamlines your security operations, saving you time and reducing costs, so you can focus on what drives your business forward.