WordPress service worker malware can make a cleaned website appear infected in one browser because a previously registered background script may still control requests within its scope. Do not assume every cache symptom proves this attack. First compare the browser registration, the network response, and the WordPress source that registered it.
I’m Ryohei Yokoyama, founder of SiteFixNow. With over 20 years of IT engineering experience and practical WordPress malware removal and hacked-site recovery work, I treat browser persistence and server cleanup as separate evidence layers so that a returning redirect is traced instead of merely hidden.
- How a service worker can control pages after a cache clear.
- How to record scope, source URL, state, and intercepted requests before removal.
- Where WordPress themes, plugins, and injected scripts can register the worker.
- How to unregister it, remove related storage, and prove that it does not return.
WordPress Service Worker Malware Is Browser Persistence, Not an Ordinary Page Cache
Confirm that a registered worker controls the affected origin and scope before calling the symptom service worker malware.
A service worker is JavaScript that a supporting browser runs separately from an open page. It can intercept requests, respond from Cache Storage, support offline behavior, and continue through a lifecycle that is not identical to a normal tab. A legitimate progressive web app, push-notification plugin, or performance feature may use exactly those capabilities.
const regs = await navigator.serviceWorker.getRegistrations();
console.table(regs.map(r => ({
scope: r.scope,
active: r.active?.scriptURL ?? null,
waiting: r.waiting?.scriptURL ?? null,
installing: r.installing?.scriptURL ?? null
})));
console.log('controller', navigator.serviceWorker.controller?.scriptURL ?? null);
console.log('cache names', await caches.keys());WordPress Service Worker Evidence Must Be Captured Before Unregistering
Record the registration and its network behavior first; unregistering too early can erase the easiest route to the malicious source.
Open developer tools for the affected origin and use the Application panel’s Service Workers and Cache Storage sections. Record the exact scope, source URL, status, update time if shown, cache names, and whether the page is controlled. Save representative request URLs and response headers while excluding cookies, authorization headers, personal data, and live tokens.
- Origin, scope, worker source URL, lifecycle state, and current controller
- Cache names and representative request URLs, not private cached content
- Network-versus-intercepted result with time, profile, and test path
- Worker-source hash and expected owner plugin, theme, or deployment
- Relevant WordPress, server, CDN, and administrative timeline entries
WordPress Service Worker Registration Sources Must Be Removed at the Server
Find and remove the code that calls serviceWorker.register(); otherwise the unwanted registration can return after browser cleanup.
Search trusted copies of the active theme, child theme, ordinary plugins, must-use plugins, custom snippets, tag-manager configuration, and generated front-end assets for service worker registration. WordPress itself does not require a front-end service worker for a normal installation. A legitimate plugin may add one, but its script path, scope, and owner should be documented and reproducible from a clean package.
# Run only on the confirmed site copy.
rg -n 'serviceWorker\.register|navigator\.serviceWorker|importScripts\(' \
wp-content/themes wp-content/plugins wp-content/mu-plugins
# Review generated HTML without changing the site.
curl -fsS https://example.com/ | rg -n 'serviceWorker|worker\.js|sw\.js'
WordPress Service Worker Removal Requires Registration and Storage Cleanup
Remove the server-side registrar first, then unregister the confirmed unwanted worker and delete only storage associated with the incident.
After the registration source has been disabled or replaced, unregister the unwanted worker from an owner-controlled browser profile. The standard unregister method returns a promise and a boolean, but a competing page can call register again for the same scope. That is why server-side removal and closed extra tabs matter before interpreting the result.
// Replace both values with the exact unwanted scope and script URL
// recorded during the evidence review. Do not select a legitimate worker.
const targetScope = 'PASTE_VERIFIED_UNWANTED_SCOPE_URL';
const targetScript = 'PASTE_VERIFIED_UNWANTED_SCRIPT_URL';
const regs = await navigator.serviceWorker.getRegistrations();
const matches = regs.filter(reg =>
reg.scope === targetScope &&
[reg.active, reg.waiting, reg.installing].some(worker =>
worker && worker.scriptURL === targetScript
)
);
if (matches.length !== 1) {
throw new Error('Expected exactly one verified unwanted registration; stopped.');
}
console.log(matches[0].scope, await matches[0].unregister());
console.log(await caches.keys()); // Review ownership; no automatic cache deletion.WordPress Service Worker Verification Must Prove It Does Not Return
Verify the cleaned browser, a clean profile, direct network responses, and the WordPress source across a realistic recurrence window.
Reload from a newly opened page and confirm that the unwanted scope and source URL are absent. Recheck the current controller, registration list, Cache Storage, and Network panel. Then close and reopen the browser, revisit affected paths, and repeat the test. One successful refresh is insufficient because update checks, delayed scripts, or another tab may register the worker again.
WordPress Service Worker Incidents Need Separate Browser and Server Conclusions
Close the incident only when browser persistence is gone and the server-side registration route has been explained and repaired.
Write two conclusions. The browser conclusion states which registration and storage were removed and how absence was verified. The server conclusion states which component registered the worker, how it was restored or disabled, what access route was fixed, and what evidence remains unavailable. Keeping them separate prevents a clean browser from being reported as a clean website.
WordPress Service Worker Malware FAQ
Identify the registration, preserve evidence, remove its registrar, clean related storage, and verify that it cannot return.
WordPress Service Worker Malware Recovery Depends on Removing the Registrar
Preserve the registration, separate intercepted and network responses, repair the WordPress source, remove browser persistence, and prove that it stays gone.
A browser can retain a worker after an ordinary server cleanup, but browser cleanup alone is not a full malware response. The decisive result is a documented chain from the original scope and script to the repaired registration source, followed by clean cross-profile tests and no recurrence during monitoring.
If You Can’t Secure or Recover Your WordPress Site Yourself

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.
- 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.
- Reduce visitor risk and SEO damage.
- Find hidden malware and backdoors, not only visible symptoms.
- Recover the site safely without unnecessary data loss.
