Initial assessment without passwords Quote before intervention One accountable specialist from start to finish

Malware & Security

Malicious WordPress Cron Jobs: Finding Tasks That Reinfect the Site

Attackers use WP-Cron to restore files, users or remote payloads. Record hooks and callbacks before deleting them.

What matters first: A suspicious cron entry may call an unknown hook, run unusually often or be registered by code that is no longer visible in the plugin list. The schedule itself is persistence evidence.

What this symptom actually tells you

Deleting the event can stop one cycle, but the loader that re-registers it may recreate the task on the next request.

Capture evidence before changing anything

  • Export all events with hooks, recurrence, next run and arguments.
  • Map each unknown hook to the PHP callback that registers or handles it.
  • Compare event creation and execution times with file changes or reinfection.
  • Inspect mu-plugins, active plugins, themes and database options for registration code.

Most common causes

  • Backdoor persistence: A hidden loader schedules remote downloads or file writes.
  • Compromised plugin: Legitimate code was modified to register the task.
  • Database-only residue: The event remains after the original code was removed.
  • High-frequency abuse: A task runs every minute to preserve access or send spam.

Safe diagnostic and repair sequence

  1. Preserve the event list and relevant code before modification.
  2. Remove the registering code and payload, then delete the orphaned event.
  3. Run due events in a controlled environment to identify side effects when safe.
  4. Monitor the cron array through several normal cycles for recreation.

How to choose between the likely causes

Do not treat Backdoor persistence and Compromised plugin as interchangeable. A hidden loader schedules remote downloads or file writes. By contrast, legitimate code was modified to register the task. Use two checks to separate them: Export all events with hooks, recurrence, next run and arguments; and map each unknown hook to the PHP callback that registers or handles it. Those observations usually show whether the next safe move is to preserve the event list and relevant code before modification or to preserve the current state and widen the investigation.

On a compromised site, containment and cleanup are separate decisions. Preserve the suspicious artefact and access logs before removing persistence, then rotate credentials only after the active path has been closed. Record the exact timestamp, affected URL or transaction, last known good state and every change made during diagnosis. That handover is often what separates a repeatable repair from a temporary disappearance of the symptom.

What not to do

Do not run unknown cron hooks on production simply to see what happens. They may send mail, rewrite files or contact attacker infrastructure.

How to verify the repair

  • Suspicious hooks and registration code are removed.
  • No file, user or option is recreated after cron cycles.
  • Legitimate scheduled jobs continue to run once.

A visible symptom disappearing is not enough. Close the incident only when the original failing action, the surrounding business journey and the relevant logs all agree that the fault is gone.

WP REPAIR INCIDENT STANDARD

Safe intervention sequence

Deleting the event can stop one cycle, but the loader that re-registers it may recreate the task on the next request.

WP RepairDiagnostic model
1Trigger2Payload3Persistence4Entry point
Follow the chain until you find the first point that stops behaving as expected.
  1. Export all events with hooks, recurrence, next run and arguments.
  2. Map each unknown hook to the PHP callback that registers or handles it.
  3. Compare event creation and execution times with file changes or reinfection.
  4. Inspect mu-plugins, active plugins, themes and database options for registration code.

What must be verified

  • Suspicious hooks and registration code are removed.
  • No file, user or option is recreated after cron cycles.
  • Legitimate scheduled jobs continue to run once.

ABOUT THIS SYMPTOM

Frequently asked questions about this guide.

If I delete the suspicious scheduled task, is that enough to stop it?+

Not necessarily. Deleting the event can stop one execution cycle, but if a hidden loader is still present and re-registering the task, it can simply recreate the same or a similar cron entry on the next request.

Is it safe to manually trigger an unknown cron hook to see what it does?+

No. Unknown hooks should not be run on production just to observe behavior, since they may send mail, rewrite files, or contact attacker-controlled infrastructure the moment they execute.

Can a malicious cron entry remain even after the plugin that created it has been removed?+

Yes. This is called database-only residue: the scheduled event can persist in the cron array even after the original registering code has been deleted, which is why the cron array itself needs to be checked, not just the list of active plugins.

What does it mean if a cron task is set to run every minute or unusually often?+

A very high execution frequency is a common pattern for tasks used to preserve unauthorized access or send spam continuously, since frequent execution keeps the attacker's foothold refreshed. Comparing the recurrence and next-run values across all events helps surface this kind of abuse quickly.

BEFORE YOU SEND THE REQUEST

Frequently asked questions.

Do you ask for passwords in the form?+

No. The public form never requests access. Secure credentials are requested only after the scope and quote are approved.

Who reviews the incident?+

The request goes to Jordi Ensenyat, founder of Code Barcelona and a WordPress specialist with more than 15 years of experience.

Is anything changed before the quote?+

No. Visible symptoms and scope are reviewed first. Intervention begins after approval and with a rollback path prepared.

Do you work internationally?+

Yes. WP Repair handles WordPress and WooCommerce incidents in English and Spanish through a remote service.

Assess my incident