01

An unknown PHP file is an incident indicator, not a cleanup task

Finding an unfamiliar PHP file inside a WordPress installation is serious because PHP executes on the server. A malicious file may read configuration, upload additional payloads, create administrator accounts, modify content, redirect visitors, or run operating-system commands with the privileges of the web service. The visible file may be the attacker’s first foothold, a later persistence mechanism, or simply the artifact that happened to trigger an alert.

Do not assume the incident is limited to the directory where the file appeared. If the file accepts commands, manages files, or launches processes, the investigation must expand beyond a normal malware cleanup. Ask whether it executed, which account owned the process, what changed during the same period, whether outbound connections were made, and whether the attacker reached the hosting control plane or operating system.

A scanner is valuable because it creates the first observable signal. Its result is the beginning of a scope decision. Treat a known web shell, arbitrary uploader, command runner, or heavily obfuscated executable PHP file as evidence that the environment is compromised until investigation demonstrates otherwise. Avoid opening the file through a public URL, and do not run it to “see what it does.” Review it as text in a controlled environment.

02

Preserve evidence before you delete or modify the file

Deleting the file immediately can remove the most obvious threat, but it can also erase information needed to determine how the attacker entered, what they executed, and how long the compromise persisted. Preserve the evidence before changing active paths whenever operations and safety allow.

Record the complete path, ownership, permissions, size, creation and modification times, and a cryptographic hash. Capture relevant web-server requests, application logs, authentication activity, running processes, network connections, startup services, scheduled tasks, and files modified during the same window. Store copies outside the public web root with restrictive permissions. Never publish real hashes, paths, IP addresses, account names, or log excerpts when they could identify a client or help an attacker.

Evidence is useful for more than attribution. It helps distinguish a one-file application intrusion from a longer server compromise. It can reveal that a process is still running after the original script is removed, that a service will restart malware after reboot, or that a second payload exists in temporary storage. It also supports a clear recovery record: what was observed, what was changed, what was verified afterward, and which uncertainties remain.

03

Check WordPress—but do not stop at WordPress

WordPress integrity checks should cover core checksums, plugins, themes, must-use plugins, uploads, administrator accounts, scheduled events, database options, configuration files, and neighboring sites on the same hosting account. Compare application code with clean vendor sources rather than trusting filenames alone. Review recent administrator creation, password resets, plugin activation, file-editor use, and unexpected changes to rewrite rules or bootstrap files.

A clean WordPress core is encouraging, but it cannot prove the server is clean. WordPress relies on the web server, PHP runtime, database, operating system, service manager, hosting panel, and administrative accounts beneath it. Malware can live outside the document root while continuing to consume resources or provide access. A compromised service account can launch an executable from temporary storage without altering WordPress core at all.

This distinction changes the response. Application-only remediation is appropriate only when evidence supports an application-only scope. If command execution, unusual system processes, privileged service changes, or management-panel exposure are present, bring the underlying infrastructure into the investigation. The security boundary is the complete system that can affect the website—not merely the WordPress directory.

04

Look for active processes, persistence, and outbound connections

Active server compromise often becomes visible through performance symptoms: unexplained processor usage, memory pressure, slow administration, or load that does not match traffic. Inspect running processes by resource use, parent process, executable path, account, command line, open files, and working directory. A service account running an unfamiliar binary from a temporary or hidden location deserves immediate attention.

Review outbound connections as well. Unknown long-lived connections, unusual destination ports, or traffic associated with an unexpected process can confirm that a payload is active. Cryptocurrency miners are common because they convert server resources into direct value, but attackers may also use compromised infrastructure for spam, proxying, scanning, credential theft, or further intrusion.

Persistence determines whether malware will return. Examine operating-system services, automatic-start links, scheduled jobs, user profiles, temporary directories, hosting-panel startup hooks, and WordPress scheduling. More than one installation path may exist. A running payload and a separate service definition can indicate repeated deployment or layered persistence. Verification must include confirming that the process is gone, its known connection is closed, and its restart mechanism is disabled—not merely that one directory was deleted.

05

Contain the threat across the application and server

Containment should stop current harm while preserving business continuity and the incident record. Quarantine known malicious PHP files and executable trees outside public paths. Stop active payloads, disable their startup mechanisms, reload the relevant service manager, and verify that they do not return. Search related locations and indicators before concluding that the known artifacts were the only ones.

Reduce administrative exposure during the response. Stop browser-accessible terminals that are not essential. Restrict hosting panels, database tools, and management ports to trusted access paths. A firewall rule is useful, but also verify whether the service itself is still listening and whether internal exposure remains necessary. Rotate potentially compromised credentials from a trusted device, including hosting, WordPress, database, SSH, API, and deployment secrets.

Containment checks should be explicit: no matching process, no known malicious network connection, no registered persistence service, no exposed listener, expected resource use, and tested administrative access. Document the result and the limits of the conclusion. “Known malicious activity has stopped” is defensible when verified. “The server is clean” requires substantially stronger evidence.

06

Validate hardening against effective configuration

Secure configuration is defined by effective behaviour, not by the contents of the last file you edited. Services often combine a primary configuration, included fragments, cloud-provisioning defaults, environment variables, and runtime options. Precedence rules can allow an earlier value to override a later hardening file.

For SSH administration, a defensible baseline commonly includes verified public-key access, disabled direct root login, disabled password and keyboard-interactive authentication, restricted administrative users, and controlled authentication attempts. Before applying changes, confirm that the authorized key works and preserve a recovery path. Validate the configuration syntax before reloading the service. Then query the effective configuration and test a new session without closing the current one.

The same principle applies to firewalls, PHP settings, web-server rules, and content security controls. Do not mark a control complete because an edit saved successfully. Confirm the listener, response header, authentication method, process state, or network path that the control was meant to change. Verification is part of implementation, not a separate optional phase.

07

Know when containment is not enough

Containment restores control; it does not necessarily restore trust. If an attacker obtained privileged operating-system execution, logs may be incomplete, credentials may have been copied, system binaries may have been replaced, and additional access mechanisms may remain hidden. It can be impossible to prove that every privileged modification has been identified.

In that situation, plan a clean rebuild from trusted sources. Provision a new server with a minimal, patched configuration. Recreate accounts and access rules deliberately. Rotate secrets. Install WordPress core, themes, and plugins from verified packages. Migrate reviewed database content and uploads rather than copying an unexamined system wholesale. Test application behaviour, security controls, backups, monitoring, and rollback before changing production traffic.

The compromised server may need to remain online briefly for operational reasons, but treat it as a contained transition system, not a permanent trusted platform. This distinction prevents a successful malware removal from becoming false assurance. The recovery objective is not simply to make alerts disappear. It is to establish a system whose provenance, configuration, access, and ongoing monitoring can be defended.

08

A practical response checklist for website owners

If you discover an unknown PHP file, do not execute it or open its public URL. Protect a current backup and preserve file metadata and a hash. Review the code as text. Check neighboring files, configuration changes, WordPress administrators, plugins, themes, uploads, scheduled tasks, and the database. Then examine the server for unexpected processes, connections, services, scheduled jobs, temporary executables, and exposed management tools.

Quarantine confirmed malware, terminate active payloads, remove known persistence, restrict unnecessary access, and rotate credentials from a trusted system. Verify every change through the service’s actual state. If privileged execution is confirmed, plan a clean rebuild and verified migration. Continue monitoring the replacement environment for renewed indicators and unusual resource use.

The central lesson is simple: one suspicious file can be the smallest visible part of a much larger incident. An evidence-led response protects both availability and the quality of the recovery decision. If your organization finds an unfamiliar PHP file, unexplained server load, suspicious administrator activity, or an exposed hosting interface, Osiris Dev Group can investigate confidentially, contain active threats, harden access, and build a defensible path back to trusted operation.

09

Questions that determine the true scope of the incident

A useful investigation keeps returning to scope. Was the suspicious file merely present, or did logs and process state indicate execution? Which operating-system account would have executed it? Could that account write to other websites, application configuration, temporary storage, or startup locations? Did the process establish outbound connections or create additional users, services, jobs, or files?

Ask how long the earliest related evidence predates the alert. Review whether other websites share the same user, PHP pool, control panel, database server, or filesystem permissions. Confirm whether backups were created before or after the suspected entry window and whether those backups are isolated from the compromised host. Identify every credential stored on the server and every secret the attacker’s execution context could read.

Recovery decisions should also reflect business consequence. A brochure site, an ecommerce platform, and a multisite environment may require different containment sequences, but none should trade away evidence or leave active persistence in place. Record which services must remain available, which can be stopped, who owns each decision, and what verification proves the next stage is safe.

These questions prevent the response from collapsing into a checklist disconnected from the actual environment. They turn one malware alert into an evidence-led assessment of access, duration, reach, consequence, and recoverability—the factors that determine whether targeted remediation is defensible or a clean rebuild is required.