WordPress object-cache.php Malware: Verify the Drop-In Before Clearing Redis

WordPress object-cache.php security investigation with cache server and shield

WordPress can execute wp-content/object-cache.php before ordinary plugins load, but Redis and managed hosts also use it legitimately. Preserve the file, identify its owner, compare the exact release, and confirm backend scope before deleting it or clearing Redis.

RyoheiYokoyama

I’m Ryohei Yokoyama, founder of SiteFixNow. With over 20 years of IT engineering experience and practical WordPress recovery and malware cleanup work, I focus on proving what owns an early-loading file before changing it.

What you’ll learn
  • Why object-cache.php is different from an ordinary plugin file.
  • How to preserve and compare the drop-in safely.
  • Why a Redis flush is not malware removal.
  • How to restore the correct owner and verify recovery.
On This Page

WordPress object-cache.php Is Executable Drop-In Code

Key decision

Do not label object-cache.php as malware from its name alone; WordPress intentionally loads this drop-in when it exists.

WordPress checks WP_CONTENT_DIR . '/object-cache.php' while starting the object cache. If the expected cache functions appear, WordPress can treat an external object cache as active. Deactivating every ordinary plugin therefore does not necessarily stop this file from loading.

Obfuscated strings, remote requests, dynamic execution, unrelated redirects, or account-changing code are warning signs. Compare the whole file with the exact trusted package rather than judging one fragment. For suspicious cached pages and CDN output, also follow the broader WordPress cache malware investigation.

Preserve object-cache.php Evidence Before Deleting or Flushing Anything

Key decision

Record the file and active cache arrangement before cleanup changes the timeline.

Use a trusted hosting shell or a clean administrative device. Loading a compromised WordPress installation can execute the suspect drop-in, so begin with filesystem evidence when server integrity is uncertain. Coordinate with the host if the hosting account may also be compromised.

Record the installation path, owner, permissions, size, modification time, and SHA-256 hash. Copy the file with metadata into a protected incident directory outside the web root. A hash proves whether the file later changed; it does not prove that the original was safe.

Preserve the relevant plugin directory, redacted configuration, deployment history, and server logs. If core bootstrap files changed too, use the separate wp-load.php verification workflow. Do not make one drop-in explain unrelated modifications without evidence.

cd /srv/example/public
stat wp-content/object-cache.php
shasum -a 256 wp-content/object-cache.php
cp -p wp-content/object-cache.php /srv/incident-evidence/object-cache.php.suspect

Verify the Drop-In Owner Against the Exact Trusted Release

Key decision

Identify the plugin, host component, or deployment artifact that should own object-cache.php.

Obtain the same release from the vendor, WordPress.org, the host image, or your organization’s repository. Compare the suspect file with that release. A checksum mismatch requires explanation because hosts may patch a drop-in, but an unrelated payload or unknown recreation process is strong evidence.

Plugin checksum tools may not cover wp-content/object-cache.php because it is outside the plugin directory. If the owner package is modified, use the infected plugin folder cleanup process and replace the complete package instead of editing isolated lines.

Technician comparing a suspicious object-cache.php file with a trusted cache drop-in
shasum -a 256 object-cache.php.suspect object-cache.php.trusted
diff -u object-cache.php.trusted object-cache.php.suspect

Check Redis and Cache Configuration Without Exposing Secrets

Key decision

Confirm the intended backend, namespace, and shared consumers before any flush.

A wrong Redis database or prefix can cross site boundaries. A shared service also makes a broad flush dangerous because unrelated applications may use the same database. Ask the owner which site, namespace, or database the supported maintenance action will affect.

Review WP_CACHE separately: the constant alone does not create a modern persistent object cache. If configuration contains unknown includes or injected PHP, use the wp-config.php hack cleanup guide and restore it from an approved source.

grep -nE "WP_REDIS_(HOST|PORT|DATABASE|PREFIX|DISABLED)" wp-config.php

Clear Redis Only After the Malicious Writer Is Contained

Key decision

A cache flush removes cached values, not malicious PHP or the process rewriting the drop-in.

Use the cache product’s documented command or hosting control. Confirm whether it clears one prefix, one Redis database, or the entire service, and coordinate the impact. Even wp cache flush delegates to the active implementation, so its practical scope depends on that backend.

Afterward, request known pages and administrative screens and confirm clean regeneration. If the file or symptom returns, stop repeating the flush and follow the WordPress reinfection root-cause workflow to identify the task, account, extension, or server process responsible.

Do not flush until these are known
  • The product that owns object-cache.php.
  • The affected site, Redis database, prefix, and shared consumers.
  • The trusted replacement and rollback path.
  • The malicious writer or entry point is contained.

Restore object-cache.php and Prove the Site Uses the Trusted Copy

Key decision

Restore through the legitimate owner, then verify integrity, behavior, and recurrence.

Prefer the owner plugin’s enable or update action, the host’s repair control, or your deployment pipeline. This preserves the expected version and permissions. If temporary removal is necessary, use a reversible rename and confirm fallback behavior before normal traffic resumes.

Hash the deployed file and compare it with the approved artifact. Test public pages, login, editing, and critical transactions; review fresh PHP and Redis errors; then monitor owner, timestamp, and hash through normal cache cycles. An unexplained replacement means recovery is incomplete.

WordPress object-cache.php Malware: Frequently Asked Questions

Quick answers

The drop-in, persistent cache, and malware entry point are related but separate investigation targets.

Is every object-cache.php file malware?

No. WordPress supports it as a persistent-cache drop-in. Verify the owner, exact version, and trusted artifact before reaching a verdict.

Can deactivating the cache plugin disable it?

Not reliably. The copied drop-in may remain in wp-content. Use the owner product’s documented disable process and verify the file afterward.

Does clearing Redis remove WordPress malware?

No. It removes cached objects, not malicious PHP, compromised accounts, unsafe configuration, or the writer that recreates the file.

Should I publish Redis diagnostics for help?

Only after redaction. Diagnostics may expose hostnames, paths, usernames, prefixes, or secrets. Share the minimum through a trusted channel.

WordPress object-cache.php Malware Requires Verification Before Cleanup

Recovery summary

Preserve the file, identify its owner, compare the exact release, verify scope, contain the writer, restore, and monitor.

Deleting object-cache.php or emptying Redis may change a symptom, but neither proves the site is clean. Recovery must connect evidence, an approved artifact, cache configuration, root-cause repair, and monitoring. If that chain cannot be established safely, pause destructive changes and ask a WordPress security specialist to assess the environment.

If You Can’t Secure or Recover Your WordPress Site Yourself

When professional recovery is safer

Ask for help when ownership, cache scope, or the process recreating the drop-in cannot be verified safely.

Ryohei Yokoyama, founder of Site Fix Now — WordPress site recovery, repair, defacement, malware removal and site hijacking specialist. Recovery in as little as 30 minutes.

If your website shows malware warnings, redirects to strange pages, or you are not sure whether it is secure,
SiteFixNow can help clean, repair, and recover your WordPress site.

Common problems we can help with
  • Your WordPress site may be infected with malware.
  • Security warnings appear in Google or browser results.
  • You found unknown admin users or suspicious files.
  • The site redirects to spam or unknown websites.
  • You need urgent WordPress hacked site repair.

We help with WordPress malware removal, hacked site repair, security cleanup, and recovery support.

Why ask for help early?
  • Reduce visitor risk and SEO damage.
  • Find hidden malware and backdoors, not only visible symptoms.
  • Recover the site safely without unnecessary data loss.

About the Author

Hello, I’m Ryohei Yokoyama, an IT engineer with over 20 years of experience.

I have received more than 776 reviews for WordPress recovery,
website repair, and online courses.

Many clients have shared comments such as:

“They restored my site so quickly!”
“They handled it the same day, which was a huge help!”

I am proud to have received a very high rating of 4.9 out of 5.0.

I have also published more than 30 books on WordPress, SEO, Microsoft Office, and related topics,
with multiple titles reaching No. 1 in sales rankings.

In addition, I have created more than 3,000 services, systems, and websites.

Through this experience, I have helped many people overcome technical problems, frustrations, and challenges.
Based on that practical perspective,
I explain complex topics in a clear and easy-to-understand way.

On This Page