Spiegato, Home

Technology and Gadgets

What is a Command Injection?

  • Published by Spiegato
  • 2 min read

A command injection is an exploit of a system weakness to gain access to the system for the purpose of executing malicious code, harvesting user data, and engaging in other activities. While there is a potential for a command injection to be benign in nature, usually it is not, and it can present a significant security threat. There are a number of workarounds designed to prevent this activity in computer systems.

One of the most common points of vulnerability for a command injection is a form, either on a web page or in a computer system. Forms allow people to input data and are then processed by the system. If there are no constraints on the type of data entered into the form, it is possible for people to input computer code that the system will read and execute. Forms on webpages may also convert the input to display to other users, exposing other people to code as well; for example, someone could leave a malicious script in the comments on a website.

When the code executes, it may do things like providing people with access to the backend of a computer system, including administrative access, and could also plant viruses and malware on a computer system. Command injections may be designed to spread themselves, as infected computers interact with uninfected computers over a network. They can spread very rapidly and may cause substantial damage along the way.

One way to avoid a command injection is to design forms and other inputs in a way designed to restrict what people can enter. On Internet comments, for example, there would likely be no legitimate reason for users to enter scripts, and the comment form could simply reject script, while still allowing HTML for markup and styling. Likewise, in a computer program, the input forms could refuse inputs of certain characters, preventing people from executing code in the form.

The potential risk presented by the command injection was first noted in the 1990s. Numerous designers have tackled the problem and come up with various ways to prevent or stop command injection attacks. Hackers have also attempted to develop their own workarounds, developing new and creative ways to execute code through weak points in a computer system. Some people develop new techniques out of purely academic interest and occasionally wreak havoc by accident when their research escapes into the wild, so to speak.

Key terms in this article

Related articles

  • What are Linux® Commands?

    Linux commands are instructions that are issued on the command line when working under a Linux operating system known as a distribution, “distro” or…

  • What is Native Command Queuing?

    Native command queuing is a system that allows serial advanced technology attachment (SATA) hard drives to govern their own internal queue of read and…

  • What Is a Command Line Interface?

    A command line interface (CLI) is a computer instrument that allows users to control computers through a text command — or command line — instead of a…

  • What is a Command Prompt?

    A command prompt is a text-based interface which allows someone to interact with an operating system via a command line, which allows the user to type…

  • What Is Dependency Injection?

    Dependency injection is a technique used in object-oriented programming (OOP). This technique references, or connects, with another program and makes the…