Web shell
Malicious script planted on a web server that gives an attacker remote access to the machine, often stealthy and long-lasting.

A web shell is a malicious script planted on a web server that lets an attacker run commands on the machine remotely, using nothing more than web requests. MITRE ATT&CK files it under persistence techniques (T1505.003): it is a backdoor hidden among the site's files, acting as a gateway into the rest of the network.
How a web shell gets onto a server
The attacker first needs a way to write a file to the server. CISA's TA15-314A alert lists the usual entry points:
- A flaw in an internet-facing application: an unpatched CMS, plugin or business application, SQL injection, file inclusion.
- Poorly controlled uploads: a file upload form that accepts a script and stores it in a directory where it can run.
- An exposed admin interface, or stolen or default credentials that provide seemingly legitimate access.
According to Microsoft, attackers scan the internet for vulnerable servers and often exploit flaws the vendor fixed long ago but the organization never patched.
Why it is stealthy and persistent
It blends into the site
A web shell is one file among thousands, written in the same language as the application. Its traffic uses the same port as legitimate visitors, and the NSA guidance stresses that web shells are hard to detect precisely because they blend into the existing application. In April 2026, Microsoft described PHP web shells that stay dormant during normal traffic and only respond to a specific value set in a cookie.
It outlives the patch
Fixing the original flaw does not remove a file that has already been planted. The web shell lets the attacker come back, pull data, or use the server as a foothold to move deeper into the network.
Documented cases
- Centreon servers (CERT-FR, 2021): France's ANSSI found a backdoor of the webshell type on several internet-facing Centreon servers. The first compromises dated back to late 2017 and continued until 2020, mostly hitting IT service providers and web hosting companies. ANSSI notes many similarities with earlier campaigns by the Sandworm intrusion set.
- Intrusions run with ARTEX (FBI, 2026): in its FLASH alert of November 13, 2026, the FBI lists the deployment of JSP and PHP web shells, and the exploitation of anonymous file uploads, among the activity observed with this agentic attack framework. It flags .aspx or .jsp files in unexpected web application paths as an indicator to look for.
Detecting a web shell
Guidance from the NSA, Australia's ASD and CISA points the same way:
- File integrity: compare the server against a known-good copy and monitor any file creation or change in web directories.
- Server behavior: alert when the web server process launches a command shell or reconnaissance tools.
- Access logs: look for rarely requested URLs hit by very few clients, or non-script files (an image) receiving data.
- Upstream filtering: a WAF or reverse proxy that only allows the application's known paths blocks part of the attempts.
None of these signals is a verdict on its own: CISA points out that antivirus tools often detect web shells poorly and that a suspicious file is a lead to validate. Combining several methods, in a defense in depth approach, works better.
Prevention
- Patch internet-facing applications and the operating system, starting with actively exploited flaws.
- Least privilege: the web server account should not be able to write to code directories.
- Non-executable upload directories: a file sent by a user must never be able to run as a script.
- Close what does not need to be open: filter admin interfaces, remove default accounts, require multi-factor authentication on hosting access.
- Segment internet-facing servers from the internal network, so a web shell does not become a way into the whole information system.
Standards and Specifications
MITRE ATT&CK T1505.003: Web Shell
Reference entry for the technique: definition, groups known to use it, mitigations and detection strategy
CISA TA15-314A
Landmark 2015 alert on compromised web servers and web shells: entry points, prevention and detection
Frequently Asked Questions
What is the difference between a web shell and a backdoor?
A web shell is a specific kind of backdoor: one that lives among a web server's files and is driven through ordinary web requests. France's CERT-FR described the P.A.S. web shell found on Centreon servers in exactly those terms, as a backdoor of the webshell type. A backdoor is the broader idea, any hidden way in that bypasses normal security controls. The web shell is its most common form on internet-facing servers, because all it takes is dropping a file.
How can we tell whether one of our servers hosts a web shell?
Look for signals that corroborate each other. First, file integrity: compare the server's content with a known-good copy and flag files newer than the last application update. Second, behavior: a web server process that launches a command shell or reconnaissance tools is not normal. Third, access logs: a web shell is often visited only by the person who planted it, so very few user agents show up. No single method is enough, and CISA warns that antivirus tools often miss web shells.
Is patching the original flaw enough to get rid of a web shell?
No. The patch closes the door the attacker came through, but a web shell that is already in place keeps answering. That is exactly why attackers use them: access survives the update. After an intrusion on an exposed server, you have to actively hunt for what was left behind (files, scheduled tasks, added accounts) or, safer still, rebuild the server from a clean source. In 2026, Microsoft documented a scheduled task that recreated a web shell loader every time it was deleted.
Is a static website exposed to web shells?
Far less. A web shell needs a server that runs code on the server side, typically PHP, JSP or ASPX scripts. A static site that only serves pre-built HTML pages offers almost nothing to execute. It still receives the same automated probes as everyone else, blindly testing the paths of well-known web shells, which is a useful reminder that scanning is indiscriminate.
Resources and Documentation
- Mitigating Web Shells (NSA/ASD guidance, detection rules and comparison scripts) NSA (nsacyber) guide
- NSA-ASD Release Guidance on Mitigating Web Shell Malware CISA documentation
- Sandworm intrusion set campaign targeting Centreon systems (French version) CERT-FR (ANSSI) report
- Threat Overview of ARTEX Autonomous Penetration Testing Framework (FLASH) FBI report
- Securing WordPress without plugins: the Infrastructure as Code approach Romain Delfosse article