An active reverse shell is one of the clearest signs that a web vulnerability has crossed from potentially exploitable to exploited and dangerous. Instead of waiting for an inbound connection, a compromised system running a reverse shell initiates an outbound connection to an external host and exposes command-line access through a channel that may blend in with ordinary traffic.
This reverse shell cheatsheet is written for defenders, AppSec teams, security operations center (SOC) analysts, DevSecOps engineers, and authorized security practitioners. It explains reverse shell behavior, typical payload patterns, detection signals, prevention controls, and the web vulnerabilities that make reverse shells possible. It does not provide executable payloads, listener commands, shell upgrade steps, obfuscation techniques, or instructions for unauthorized access.

A reverse shell is a remote access technique where a compromised system initiates an outbound connection to an external host and exposes a command shell over that connection.
Attackers commonly pursue reverse shells after exploiting vulnerabilities that allow command or code execution, including operating system (OS) command injection, remote code execution (RCE), unsafe file upload, server-side template injection (SSTI), insecure deserialization, or chained injection flaws.
The important word is “reverse.” In a typical remote access scenario, an operator connects inbound to a system. In a reverse shell, the target connects outward. That distinction is crucial because most organizations restrict inbound access more tightly and carefully than outbound access. A server that cannot be reached directly from the internet might still be allowed to make outbound connections to APIs, update services, logging platforms, package repositories, and other external systems. A reverse shell attempts to abuse that permitted egress path.
A reverse shell is a post-exploitation technique rather than an initial vulnerability. The shell is the outcome of successful exploitation, while the root cause is usually a weakness that let an attacker execute code, invoke a system command, upload executable content, or reach another service that could do so. OS command injection is the vulnerability class that usually offers the most direct path from vulnerability to shell access.
MITRE ATT&CK maps abuse of command and scripting interpreters to T1059. The technique covers adversary use of shells and scripting environments to execute commands, scripts, or binaries across platforms.
A reverse shell usually follows a simple conceptual flow:
From a defender’s point of view, the practical detection model is not “identify a specific payload.” Payloads vary across operating systems, interpreters, runtimes, and available utilities. A stronger model is to correlate three conditions:
Each condition can be legitimate on its own. Together, especially immediately after a suspicious web request or application error, they form a much stronger signal.
Reverse shells and bind shells both provide remote command access when used maliciously, but they establish the connection in opposite directions.
Reverse shells are attractive because production servers, containers, and cloud workloads usually need at least some outbound access even when inbound is locked down. Firewall policy should account for both inbound and outbound communication rather than focusing only on internet-facing services.
A web shell is usually malicious server-side code or a malicious file placed on a web server to expose shell-like functionality via an exploited vulnerability and accept inbound commands. A reverse shell is any live command session carried over an outbound connection. The two concepts are related but not interchangeable.
A web shell persists as a file on the server and accepts inbound commands via HTTP, making it accessible as long as the file remains in place. A reverse shell session is ephemeral – it exists only while the connection is active. That said, attackers routinely pair reverse shells with persistence mechanisms such as cron jobs, startup scripts, or scheduled tasks that re-initiate the outbound connection after a reboot or session drop. An attacker may upload a web shell first and then use it to launch a reverse shell, or may reach a reverse shell directly through command injection or another RCE path without ever placing a file on the server.
A reverse shell is rarely the first vulnerability in an attack chain. It is usually the result of a weakness that lets an attacker execute something or reach a trusted service that can. The AppSec priority is to identify and fix those enabling weaknesses before they become shell access.
This is where dynamic application security testing (DAST) is especially relevant. A scanner does not need to observe an active reverse shell to reduce reverse shell risk. It needs to find externally reachable vulnerabilities that can lead to command execution, arbitrary code execution, unsafe file handling, or a chainable path into trusted services – and by closing those gaps, you reduce the risk of a reverse shell being deployed in the first place.
A reverse shell payload usually combines three elements:
As a defender, you don’t need working payload strings to recognize this behavior. You need to understand which process created the connection, which child process started, what identity was used, and whether the sequence is normal for that workload.
The examples below describe broad payload families without providing syntax, commands, listener setup, or operational details.
Language and tool names can be useful search terms, but detections should not depend on a fixed payload signature. Attackers can change syntax, use a different interpreter, rename utilities, or rely on built-in runtime capabilities. Behavior-based correlation is more durable.
Reverse shell detection is strongest when network, endpoint, process, identity, cloud, and application telemetry are correlated. A single suspicious signal might get lost in the noise or be insufficient to take action – a suspicious sequence is more useful.
MITRE’s web shell detection strategy highlights suspicious chains such as unexpected file creation in web directories followed by web server processes spawning command shells or script interpreters. The same parent-child process logic is relevant when hunting for reverse shell behavior launched from web-facing systems.
Reverse shells vary by operating system, runtime, and available tooling, but the process relationships are often recognizable.
To tell legitimate and suspicious activity apart, context matters. A shell started by an administrator during a documented maintenance window may be legitimate. A shell started by a web worker, application pool, database process, image conversion library, template engine, or upload handler is a much stronger warning sign.
Baselines should therefore account for workload purpose, environment, deployment stage, approved administrative activity, and known automation. The goal is not to alert on every interpreter launched but to reliably identify interpreters and outbound connections in process contexts where they do not belong.
No single log source can reliably identify every reverse shell. Detection works best as a correlation problem: connect the application event that enabled execution to the process that launched, the identity that ran it, and the network session that followed.
Start with egress logging. Review outbound connections from systems that should not initiate arbitrary external communication, especially web servers, application servers, database servers, CI/CD infrastructure, containers, and cloud workloads.
Investigate:
A destination being unknown is not yet proof of compromise. The strongest network evidence comes from combining unusual egress with process and application context.
Application logs can help identify the entry point. Look for suspicious parameters, unusual upload activity, unexpected template or serialization errors, requests to rare endpoints, and bursts of probing before a successful request.
Investigate:
Preserve the full request context where policy permits, including headers, route parameters, user identity, session information, and correlation IDs. A web log entry alone may look routine, but its timing relative to process creation and egress can expose the attack path.
Endpoint detection and response (EDR) telemetry is often where reverse shell behavior becomes clearest. Review process creation, parent-child relationships, network connections, command interpreter activity, file writes, credential access, and service changes.
Investigate:
Getting a clear process-tree view is central to triaging reverse shell signals because it connects network behavior to the application or service that initiated the shell process.
Cloud workloads add identity and control-plane context. A reverse shell launched inside a container, virtual machine, build runner, or serverless workload may be followed by metadata access, internal service probing, credential use, or unusual control-plane API calls.
Investigate:
Cloud audit logs can show what happened after the initial shell, while container and host telemetry can show how the session started. Both are needed to assess blast radius.
A high-confidence reverse shell investigation may collect the following sequence of signals:
Security information and event management (SIEM) rules should prioritize such sequences over isolated indicators. The exact command line may change, but the relationship between exploitation, process execution, and egress is harder to hide.
Preventing reverse shells requires defense in depth: remove vulnerabilities that permit execution, restrict outbound network paths, limit application privileges, and monitor for behavior that should not occur in production workloads. The following security practices help minimize the risk of reverse shells being established:
Use the following condensed reference during triage, control reviews, and remediation planning.
Treat any suspected reverse shell as an active compromise until evidence shows otherwise. Your immediate goals are to contain the identified session without unnecessarily destroying evidence, determine the entry point, assess blast radius, and prevent the same path from being reused. General response and remediation steps are:
CISA’s incident and vulnerability response playbooks emphasize coordinated procedures to identify, remediate, recover, and track mitigations for cybersecurity incidents and vulnerabilities. That discipline matters because terminating a reverse shell without fixing its root cause only resets the clock – the session will most likely respawn in the near future.
Invicti provides an application security platform that helps security teams reduce reverse shell risk by identifying exploitable web vulnerabilities such as command injection, remote code execution, unsafe file handling, and injection flaws before attackers can chain them into shell access. Invicti’s proof-based DAST provides an outside-in view of how a running application or API behaves to assist in tracking down attack paths that are reachable through the deployed application.
For supported vulnerability classes, Invicti’s proof-based scanning can safely validate exploitable behavior and provide evidence that helps teams distinguish confirmed application risk from findings that still require investigation. This can improve prioritization and reduce the manual effort needed to reproduce certain issues, especially for injection and code execution vulnerabilities.
Application security testing is essential but should not be treated as a replacement for EDR, SIEM, network monitoring, cloud detection, or incident response tooling. Those controls are responsible for detecting and investigating active reverse shell behavior at runtime. Invicti’s tools come earlier in the chain to help teams find, validate, prioritize, and remediate the web application and API vulnerabilities that can make shell access possible.
Used as part of a broader AppSec program, Invicti can test web applications and APIs for externally reachable weaknesses, support recurring scans to catch regressions after code or configuration changes, and route findings into established remediation workflows. By reducing exploitable application-layer entry points, it complements the runtime controls that monitor process and network behavior.
To see how you can systematically scan your systems to find and eliminate vulnerabilities that can lead to reverse shell access, request a demo of the Invicti Platform.
A reverse shell is a script or executable program that allows interactive shell access to a system through an outgoing connection from that system. Malicious hackers often use reverse shells as a means to send commands to a compromised system. Reverse shells perform a similar function to web shells.
A reverse shell makes the target system connect outward to an external host. Once connected, input and output from a command shell or equivalent execution process are redirected through the network session, allowing remote commands to be issued.
Attackers use reverse shells because outbound traffic is often less restricted than inbound traffic. A reverse shell may also work from a server, container, or private workload that cannot accept direct inbound connections but can still reach external systems.
Common paths for reverse shell deployment include OS command injection, remote code execution, unsafe file upload, server-side template injection, insecure deserialization, file inclusion, SQL injection chains, and SSRF chains that reach internal services capable of executing code.
Detection usually requires correlating network, process, endpoint, application, identity, and cloud telemetry. Strong indicators include unexpected outbound connections from servers, web processes spawning command interpreters, unusual parent-child process chains, and suspicious traffic immediately after an exploit attempt.
Fix vulnerabilities that permit command or code execution, restrict outbound network access, apply least privilege, harden file upload and processing paths, remove unnecessary interpreters and utilities, segment workloads, and continuously test applications for exploitable weaknesses.
A web application firewall (WAF) may block some exploit attempts that could lead to a reverse shell, including some command injection requests, but it should not be the only defense. The root vulnerability must be fixed, and organizations still need egress controls, runtime monitoring, secure configuration, and application security testing.
Invicti provides an application security testing platform to detect vulnerabilities in applications and APIs. Detecting live reverse shell sessions is the domain of EDR or network monitoring tools. Invicti’s DAST, SAST, and other built-in scanners help to reduce the risk of reverse shells being deployed in the first place by flagging web application and API vulnerabilities that attackers could use to gain command or code execution.
