How to Find Hidden Malware in WordPress Files and Database

A WordPress malware scan can report that a website is clean while suspicious behavior continues.

This is one of the most frustrating situations after a website compromise.

The obvious malicious file has been removed. The security plugin reports no critical findings. The homepage looks normal.

Then the redirect returns, spam pages appear again, an unknown administrator is discovered or Google continues showing hacked content.

The reason is simple: malware does not have to exist in one obvious PHP file.

It can exist across files, plugins, themes, uploads, databases, administrator accounts, scheduled tasks and other parts of the hosting environment.

This guide explains how to investigate hidden malware in WordPress without relying on a single scan or blindly deleting suspicious files.

What Is Hidden WordPress Malware?

Hidden WordPress malware is malicious code, content, configuration or unauthorized access that is difficult to identify through normal website administration.

It may be deliberately disguised as legitimate code, stored outside the obvious plugin or theme files, inserted into database content or designed to activate only under particular conditions.

A backdoor is particularly important because it can provide an attacker with a way to regain access after the original malicious component has been removed.

Security research has documented WordPress backdoors that create or preserve administrator access, as well as malware hidden inside files that do not appear suspicious at first glance. ([malcare.com](https://www.malcare.com/blog/detect-php-backdoors-admin-account/?utm_source=chatgpt.com))

Why Finding WordPress Malware Is More Difficult Than Searching for Suspicious Code

Malware detection is not simply a search for words such as eval or base64_decode.

Those functions can appear in legitimate software, while malicious code can use other techniques or be deliberately obfuscated.

A reliable investigation therefore combines multiple forms of evidence.

  • File integrity
  • Known malware signatures
  • Code behavior
  • File location
  • Modification history
  • Database content
  • User accounts
  • Configuration
  • Scheduled tasks
  • Website behavior
  • Hosting and server evidence

Current WordPress security tools use different approaches, including signature detection, file integrity comparison and deeper file and database inspection. This is one reason different scanners can produce different results. ([wordpress.org](https://wordpress.org/support/topic/how-do-you-detect-malicious-files/?utm_source=chatgpt.com))

Where Can Hidden WordPress Malware Exist?

AreaPotential Evidence
WordPress coreUnexpected modifications to official files.
PluginsModified, abandoned or unauthorized code.
ThemesInjected PHP or JavaScript.
UploadsUnexpected executable or disguised files.
DatabaseInjected scripts, links, spam and malicious settings.
UsersUnauthorized administrator accounts.
MU pluginsAutomatically loaded malicious code.
Scheduled tasksProcesses that recreate malicious content.
ConfigurationUnexpected settings or access changes.
HostingEvidence outside the WordPress application.

1. Start With the Symptoms

Before searching thousands of files, document what caused the investigation.

  • Unexpected redirects
  • Unknown administrator accounts
  • Spam pages
  • Suspicious outbound links
  • Google security warnings
  • Unexpected advertisements
  • Modified website content
  • Unusual server activity
  • Repeated reinfection

The symptom provides context for the investigation.

For example, a recurring redirect may justify closer inspection of JavaScript, server configuration, database content and persistence mechanisms than a simple visual website inspection would provide.

2. Preserve the Website Before Making Major Changes

If a compromise is suspected, create a reliable recovery point before performing destructive cleanup where practical.

Preserve:

  • Website files
  • Database
  • Relevant logs
  • Security scan results
  • Suspicious URLs
  • Unknown user information
  • Relevant timestamps

This provides a reference point if further investigation becomes necessary.

3. Check WordPress Core File Integrity

Official WordPress core files provide an important baseline for detecting unauthorized modifications.

Security scanners can compare installed core files against known legitimate versions from the WordPress repository.

Wordfence, for example, documents a scanning process that compares WordPress core files with known clean versions and checks file contents for malware, backdoors, malicious redirects and code injections. ([wordpress.org](https://wordpress.org/support/topic/how-do-you-detect-malicious-files/?utm_source=chatgpt.com))

A modified core file does not automatically prove malicious activity because legitimate maintenance or deployment processes can also change files. The modification should therefore be evaluated against the installed WordPress version and change history.

4. Inspect Plugins

Plugins are an important part of the investigation because they introduce additional executable code into the WordPress environment.

Review:

  • Recently installed plugins
  • Inactive plugins
  • Outdated plugins
  • Abandoned plugins
  • Plugins from untrusted sources
  • Unexpected plugin files
  • Unexpected modifications

A plugin that has been compromised may look legitimate because the plugin itself is legitimate.

The important question is whether the installed files match the expected version and whether their behavior is consistent with the plugin’s intended function.

5. Compare Plugin Files With Known Good Versions

When a plugin is available from a trusted repository, comparing its installed files against the corresponding legitimate version can help identify unauthorized changes.

This is more reliable than deciding that a file is malicious simply because it contains a function that looks suspicious.

Current WordPress security tools use checksum and integrity comparison techniques for this purpose. ([wordpress.org](https://wordpress.org/plugins/broodweb-malware-scanner/?utm_source=chatgpt.com))

6. Inspect Theme Files

Theme files can contain executable PHP and client-side JavaScript.

Investigate unexpected changes in active and relevant inactive themes.

Pay attention to:

  • Unexpected PHP files
  • Unexpected JavaScript
  • Encoded or heavily obfuscated code
  • Unexpected external requests
  • Recently modified files without a known deployment reason

Again, unusual code is not automatically malicious. The context and intended function matter.

7. Inspect the Uploads Directory

The uploads directory deserves special attention because it is normally used for media and user uploaded content.

Unexpected executable files in this location can be an important finding.

  • Unexpected PHP files
  • Files with unusual extensions
  • Files disguised as images
  • Recently created executable files
  • Files with no legitimate owner or purpose

Security research has documented malware hidden inside image files and other files specifically to evade normal inspection. Sucuri’s threat research has described webshell-related malware lodged inside image files within compromised WordPress environments. ([sucuri.net](https://sucuri.net/wp-content/uploads/2023/04/Sucuri_2022-Website-Threat-Research-Report.pdf?utm_source=chatgpt.com))

8. Check Must-Use Plugins

Must-use plugins can be loaded automatically by WordPress and may not appear in the standard plugin list in the same way as ordinary plugins.

They should therefore be included in a deeper malware investigation when the website’s behavior cannot be explained by the normal plugin set.

Unexpected files in the must-use plugin directory deserve investigation against the site’s known deployment configuration.

9. Search the Database for Malicious Content

One of the most important reasons a file-only investigation can fail is that malicious content may exist inside the WordPress database.

This can include:

  • Injected links
  • Hidden text
  • JavaScript
  • External iframes
  • SEO spam
  • Redirect information
  • Unexpected configuration values

Sucuri’s website threat research found database malware commonly in wp_posts and wp_options. Its 2022 research reported that more than half of infected databases in its dataset contained SEO spam. ([sucuri.net](https://sucuri.net/wp-content/uploads/2023/04/Sucuri_2022-Website-Threat-Research-Report.pdf?utm_source=chatgpt.com))

That is a significant reason to investigate the database when the filesystem appears clean but suspicious search results or website behavior continues.

10. Inspect wp_posts

The wp_posts table stores more than traditional blog posts.

Depending on the website, it can contain pages, custom post types and other content.

Look for:

  • Unfamiliar URLs
  • Spam keywords
  • Unexpected scripts
  • Hidden links
  • Unexpected iframes
  • Unknown pages

Modern WordPress security scanners increasingly include database content because file-only scanning cannot see content-resident threats. ([wordpress.org](https://wordpress.org/plugins/content-guard-pro/?utm_source=chatgpt.com))

11. Inspect wp_options

The wp_options table contains important WordPress and plugin configuration.

Unexpected values can influence how the website behaves.

Look for suspicious:

  • URLs
  • Scripts
  • Encoded content
  • Unexpected configuration values
  • Plugin settings that do not match the expected environment

Database cleanup should be performed carefully because legitimate WordPress and plugin settings are also stored here.

12. Inspect Post Metadata and Other Database Tables

Some malicious content may not exist directly inside post content.

It may be stored in metadata, plugin settings or page-builder data.

Current WordPress security tools are expanding database inspection beyond wp_posts and wp_options to include areas such as wp_postmeta. ([wordpress.org](https://wordpress.org/plugins/content-guard-pro/?utm_source=chatgpt.com))

This is especially relevant when a visible page contains suspicious content that cannot be explained by the page’s main content field.

13. Check Administrator Accounts

Malware investigation should include the identity layer.

Review every administrator and other highly privileged account.

  • Username
  • Email address
  • Role
  • Creation date where available
  • Last activity where available
  • Whether the account is authorized

A hidden or unauthorized administrator can allow an attacker to regain access even after malicious files have been removed.

Recent malware research has specifically documented PHP backdoors whose purpose is to create administrator accounts and preserve attacker access. ([malcare.com](https://www.malcare.com/blog/detect-php-backdoors-admin-account/?utm_source=chatgpt.com))

14. Look for Scheduled Persistence

If malware keeps returning, investigate what may be recreating it.

Possible persistence mechanisms can include scheduled tasks, malicious plugins, modified configuration or other code that executes automatically.

A recurring infection should therefore be treated differently from a single suspicious file.

15. Investigate Obfuscated Code Carefully

Attackers may obfuscate malicious code to make manual inspection more difficult.

Common techniques can include encoding, compressed strings and dynamically constructed code.

But this requires an important warning:

Obfuscation alone does not prove that code is malicious.

Legitimate software can also use encoding or compressed resources.

The correct approach is to combine code characteristics with file location, package integrity, expected functionality and other evidence.

16. Do Not Treat eval() or base64_decode() as Automatic Proof of Malware

Searches for functions such as eval(), base64_decode(), gzinflate() or shell_exec() can produce useful leads.

They can also produce false positives.

A professional review should ask:

  • Where is the code?
  • What package does it belong to?
  • Is the file expected?
  • What does the surrounding code do?
  • Does it match a trusted version?
  • Does it interact with user input?
  • Does it communicate with an unexpected external destination?

Current malware scanners use combinations of signatures, integrity checks and behavioral or heuristic indicators because a single keyword is not enough to reliably classify every file. ([wordpress.org](https://wordpress.org/support/topic/how-do-you-detect-malicious-files/?utm_source=chatgpt.com))

17. Check File Modification Times Carefully

Recent modification dates can help narrow an investigation.

However, timestamps are evidence, not proof.

A legitimate plugin update can modify hundreds of files. A deployment can also change timestamps across an entire installation.

Use timestamps together with:

  • Known update dates
  • Deployment history
  • File integrity
  • Security alerts
  • Access logs
  • Website behavior

18. Compare Findings With Known Good Copies

One of the strongest techniques available to WordPress administrators is comparison against a trusted baseline.

For WordPress core, official files can provide that baseline.

For plugins and themes, use a trusted source and the correct version whenever possible.

This can reduce false positives because the question becomes:

“Does this file differ from the expected legitimate version?”

rather than:

“Does this file contain a function that looks suspicious?”

19. Check the Hosting Environment

A WordPress investigation should not stop at the WordPress dashboard.

Review the hosting environment where appropriate.

  • Hosting account access
  • FTP or SFTP accounts
  • SSH access
  • Database users
  • Server logs
  • Web access logs
  • Other websites on the same hosting account

If multiple websites share the same hosting environment, an infection in one site can be relevant to the investigation of another.

20. Use Multiple Sources of Evidence

The strongest WordPress malware investigations do not depend on one scanner.

Consider combining:

  • Malware scanner
  • File integrity comparison
  • Database inspection
  • Administrator review
  • External website scanning
  • Browser testing
  • Access logs
  • Hosting information

Each source answers a different question.

Evidence SourceWhat It Can Help Establish
File scanPotential malicious or modified files.
Checksum comparisonWhether trusted files differ from expected versions.
Database reviewContent or configuration stored outside the filesystem.
User auditUnauthorized privileged access.
Browser testingActual visitor-facing behavior.
LogsRequests, access patterns and timing.
Hosting reviewEvidence outside WordPress.

Why a File-Only Scan Can Miss Database Malware

A file scanner cannot see malicious content that exists only inside database records.

This matters because attackers can inject spam, links, scripts and other content directly into WordPress database tables.

Sucuri’s research found database malware in compromised websites and reported substantial quantities of SEO spam within infected databases. ([sucuri.net](https://sucuri.net/wp-content/uploads/2023/04/Sucuri_2022-Website-Threat-Research-Report.pdf?utm_source=chatgpt.com))

Modern database-focused WordPress scanners similarly emphasize that file scanning alone cannot inspect content stored in posts, metadata and options. ([wordpress.org](https://wordpress.org/plugins/content-guard-pro/?utm_source=chatgpt.com))

Why a Database Scan Alone Is Not Enough

The opposite is also true.

A clean database does not prove that the filesystem is clean.

Malware can exist in PHP files, JavaScript, plugins, themes, uploads, core modifications or other parts of the environment.

This is why a proper investigation needs coverage across both the application filesystem and database.

What If Everything Looks Clean but the Website Is Still Compromised?

When obvious files and database content look clean but suspicious behavior continues, expand the investigation.

  • Check administrator accounts.
  • Review hosting credentials.
  • Inspect scheduled tasks.
  • Review server configuration.
  • Check other websites on the same hosting account.
  • Review access logs.
  • Test the website under different visitor conditions.
  • Review external integrations.

The objective is to determine whether the problem is hidden, external to WordPress or incorrectly diagnosed in the first place.

Do Not Automatically Delete Every Suspicious File

A malware investigation should be review-first.

Deleting a file without understanding its purpose can:

  • Break the website.
  • Destroy useful evidence.
  • Remove legitimate functionality.
  • Leave the actual backdoor untouched.

Where appropriate, quarantine or preserve suspicious files before permanent deletion.

Several current WordPress security tools explicitly emphasize review, quarantine and controlled remediation rather than blindly deleting every finding. ([wordpress.org](https://wordpress.org/plugins/broodweb-malware-scanner/?utm_source=chatgpt.com))

How to Investigate a WordPress Backdoor

A backdoor investigation should look for unauthorized mechanisms that allow access or execution after the original vulnerability has been addressed.

Review:

  • Unexpected PHP files
  • Modified plugin files
  • Modified theme files
  • MU plugins
  • Unexpected administrator accounts
  • Suspicious scheduled tasks
  • Unexpected database configuration
  • Unusual external communication

Current security research has documented PHP backdoors that create administrator accounts, making account review an important part of post-compromise investigation. ([malcare.com](https://www.malcare.com/blog/detect-php-backdoors-admin-account/?utm_source=chatgpt.com))

When Should You Stop Investigating It Yourself?

Manual investigation can be useful, but it has limits.

Professional assistance becomes more appropriate when:

  • The malware keeps returning.
  • You cannot identify the source.
  • The database appears compromised.
  • Unknown administrator accounts exist.
  • Google has flagged the website.
  • The hosting provider has suspended the site.
  • Multiple websites are affected.
  • The website handles sensitive information.
  • You cannot distinguish legitimate modifications from malicious ones.

Hidden WordPress Malware Investigation Checklist

LayerInvestigation
CoreCompare core files with trusted versions.
PluginsReview versions, integrity and unexpected modifications.
ThemesInspect unexpected PHP and JavaScript changes.
UploadsInvestigate unexpected executable files.
DatabaseReview posts, options and relevant metadata.
UsersAudit privileged accounts.
MU pluginsCheck automatically loaded code.
Scheduled tasksInvestigate possible persistence.
ConfigurationReview unexpected settings and redirects.
HostingReview logs and account-level access.
BehaviorTest the website from different visitor conditions.

Final Perspective

Finding hidden malware in WordPress is not a matter of running one scanner and accepting the result as absolute proof.

A serious investigation should examine the website as a complete system.

Files matter. The database matters. Administrator accounts matter. Hosting access matters. Configuration matters. Persistence matters.

The strongest evidence comes from connecting these layers rather than examining each one in isolation.

If a website is redirecting visitors, generating spam, creating unknown accounts or becoming reinfected, do not stop when the first suspicious file disappears.

Find the code. Find the access. Find the persistence. Then verify that the environment is actually clean.

Need Help Investigating Hidden WordPress Malware?

Cautivra provides remote WordPress malware investigation and cleanup for websites affected by hidden malicious code, backdoors, redirects, injected database content, unauthorized administrator accounts and recurring infections.

The investigation can cover relevant WordPress files, plugins, themes, uploads, database content, privileged accounts and persistence mechanisms before remediation is performed.

Request a WordPress Malware Investigation

Frequently Asked Questions

Where can hidden WordPress malware hide?

It can exist in WordPress core files, plugins, themes, uploads, configuration files, must-use plugins, database records, administrator accounts or other parts of the hosting environment.

Can a WordPress malware scanner miss hidden malware?

Yes. Scanners have different detection methods and coverage. Conditional behavior, database-resident content, dynamically generated payloads and threats outside the scanner’s visibility can make detection more difficult. A broader investigation can combine multiple sources of evidence.

Can WordPress malware exist only in the database?

Yes. Malicious links, scripts, spam and other injected content can be stored in database tables such as wp_posts, wp_options and metadata tables. Sucuri has documented database-resident malware and SEO spam in compromised websites. ([sucuri.net](https://sucuri.net/wp-content/uploads/2023/04/Sucuri_2022-Website-Threat-Research-Report.pdf?utm_source=chatgpt.com))

Does base64_decode mean a WordPress file is malware?

No. The presence of an encoding or execution function is not sufficient by itself to classify code as malicious. The file’s location, expected functionality, surrounding code, integrity and behavior should also be considered.

Can malware hide inside an image file?

Malicious code can be disguised or embedded in files in ways intended to evade normal inspection. Security research has documented webshell-related malware hidden inside image files in compromised WordPress environments. ([sucuri.net](https://sucuri.net/wp-content/uploads/2023/04/Sucuri_2022-Website-Threat-Research-Report.pdf?utm_source=chatgpt.com))

Why does WordPress malware come back after cleanup?

Reinfection can occur when a backdoor, unauthorized account, scheduled task, compromised credential or vulnerable component remains. The original entry point may also remain unresolved.

Should I delete every suspicious WordPress file?

No. A suspicious file should be investigated before permanent deletion. Removing legitimate files can break the website, while deleting only one malicious component may leave the actual persistence mechanism behind.

Sources and Further Reading

  • WordPress.org security and malware documentation
  • WordPress.org plugin security scanning documentation
  • Sucuri Website Threat Research
  • WordPress malware and backdoor research
  • WordPress Developer Resources