Independent spirit. Appoly Group expertise. Since 2014.

Found a PHP file you don’t recognise? What web shells are and what to do

What a web shell is

A web shell is a script an attacker uploads to a website so they can control it from a browser. On WordPress sites it’s usually a PHP file. Once it’s in place, it can let someone browse and change files, upload more code, read the database or send spam from your server.

A backdoor is the wider term for anything left behind to get back in later. That might be a web shell, a hidden admin user, or a few lines of code added to a file that is otherwise genuine.

How they get there

Usually through a weakness that is already public: an out-of-date plugin or theme, a file upload feature that doesn’t check what’s being uploaded, or stolen login details. The most common ways WordPress sites are attacked are covered on our WordPress security page.

Where they tend to hide

Web shells are often given names that look as if they belong, or put in folders few people check. Common places include:

  • the uploads folder (wp-content/uploads), which normally holds images and documents rather than PHP files
  • plugin and theme folders, sometimes inside plugins that are no longer used
  • the site’s main folder, next to WordPress’s own files

The code can also be added to a genuine file, such as a theme’s functions.php, instead of sitting in a file of its own.

If you find a file you don’t recognise

  • Don’t open it in a browser. If it is a web shell, loading it runs it.
  • Don’t delete it straight away. It’s useful evidence of how and when the site was attacked, and deleting it alone is unlikely to fix the problem.
  • Note where it is, its name and the date it was last changed, and keep a copy of the site if your host can take one.
  • Tell your host, or ask someone who handles WordPress clean-ups to look at it.

Not every unfamiliar file is malicious. Some plugins and hosts add files of their own, which is why it’s worth having the file checked rather than guessing.

Why one file is rarely the whole problem

Attackers often leave more than one way back in. If you find one web shell, assume there may be others, along with changes elsewhere on the site. A proper clean-up finds how the attacker got in, removes what they left, closes the gap and then tests the site. Changing passwords matters, but on its own it won’t remove a backdoor.

How we can help

Our rescue assessment covers WordPress sites we didn’t build. We look for malicious or injected code, unauthorised changes, out-of-date plugins and themes, and files left behind to give an attacker a way back in. It costs £250 for the first two hours, then £125 an hour, excluding VAT, and we confirm the scope and price before repair work begins.

See how a website rescue works, or read what to do first if your site has been hacked.