What a webshell is
A webshell is a backdoor that looks like a web page. After an attacker breaks into a web server, they upload a small script, often just a few lines in a language such as PHP. From then on, they can visit a web address on that server and type commands into it, as if they were sitting at the machine.
Think of it as a spare key hidden under the mat. The break-in may have been hard. The spare key makes every return visit easy, even after the original door has been fixed.
How a webshell gets there
The attacker first needs a way in. Common routes are an unpatched flaw, such as one that allows remote code execution, a vulnerable plugin, a weak upload form or stolen credentials. Once they can write a file to the server, they drop the webshell in a folder the web server serves.
Webshells are popular because they need no special tools to use and they blend in. Requests to them look like normal web traffic, and attackers often give the file an innocent name or hide it among legitimate files.
What an attacker does with one
With a webshell, an attacker can browse files, read configuration files that hold passwords and keys, upload more tools, move to other systems on the network, or steal data, a pattern covered under data exfiltration. Some attackers even remove rival webshells from a compromised site so they keep it to themselves.
How to defend against them
The best defense is closing the way in: shrink your patch gap and keep plugins updated. After that, a few habits help:
- Limit which folders the web server can write to and run code from.
- Monitor for new or changed files in web directories.
- Watch for odd outbound connections from web servers.
- Apply least privilege so the web server account can reach little else.
Finding and removing a webshell is not enough on its own. You also need to find how it got there, or the attacker returns.
Why it matters when you use AI
Automated tools that find and exploit bugs can plant webshells at scale, so a site that sits unpatched for days becomes an easy target. Security researchers also use penetration testing to check whether your servers could be taken over this way.
A webshell is a post-exploitation tool. The flaw that lets it in may carry a CVE ID and a CVSS score.