What Are Backup Pre and Post Commands? Persistence Risk
Backup pre and post commands are scripts a backup agent runs around each job, as root, on a schedule. Here is why attackers abuse them and how to review them.
Backup pre and post commands are scripts that a backup agent runs on the protected machine immediately before a backup job starts and immediately after it finishes. Administrators use them to quiesce a database, flush caches, mount a volume or notify a ticketing system. Because the agent runs them with its own privileges, usually root or SYSTEM, and on a schedule nobody watches, they are also a quiet way for an attacker who can edit a backup plan to execute code. Acronis's advisory for CVE-2026-87887 tells hosts to check for unknown pre/post commands for exactly that reason.
What are backup pre and post commands?
Backup pre and post commands are optional hooks in a backup plan that tell the agent to run a command or script before the job begins and after it completes. They exist so the backup captures a consistent state, for example by stopping a service first and starting it again afterwards.
Nearly every enterprise backup product has them under some name. Acronis exposes them inside the Backup Options of a protection plan, which is the term its CVE-2026-87887 advisory uses. Veeam calls them pre-job and post-job scripts. Bacula and Bareos use ClientRunBeforeJob and ClientRunAfterJob. The idea is the same in each case: a path to an executable, optional arguments, and a setting for whether a failed pre-command should abort the backup.
Why they run with so much privilege
A backup agent has to read every file on the system, including files that belong to other users, databases that are locked by their services and system directories. The simplest way to get that access is to run as root on Linux or as Local System on Windows, and that is how most agents are installed. The pre and post commands inherit that context. A command that was meant to run a harmless flush script can run anything else with the same authority.
The agent also runs on a timer. A daily backup means a daily execution of whatever the plan says, with no login event, no interactive session and no new process that looks out of place to an administrator skimming the process list. Backup activity at 02:00 is expected. A child process of the backup agent at 02:00 is expected too.
How do attackers abuse pre and post commands?
An attacker who gains write access to backup plan configuration can add or change a pre or post command so the agent runs their script on every job. The result is scheduled code execution as root that survives reboots, looks like legitimate backup behaviour and is stored in the backup platform rather than on the compromised host.
That last point matters for cleanup. Most incident response checklists look for persistence on the host: cron entries, systemd units, startup scripts, modified binaries. A command stored in a cloud-managed protection plan is not on the host at all. Reimaging the server and reinstalling the agent re-attaches it to the same plan, and the command runs again on the first backup. The persistence lives in the management plane.
The same technique works through any management plane that pushes commands to agents: configuration management, RMM tools, endpoint protection consoles and monitoring agents with remote execution. Backup is just the one most often forgotten, because backup teams and security teams are rarely the same people. Our earlier piece on why backup agents deserve the same scrutiny as domain controllers makes the broader argument.
What the Acronis advisory implies
CVE-2026-87887 is an information disclosure flaw. Its CVSS vector records no integrity impact, so the bug itself does not change a plan. Yet Acronis's remediation guidance, reported by Help Net Security and The Hacker News, asks administrators to check for "unexpected changes to protection plans" and "unknown pre/post commands configured in Backup Options". The reasonable reading is that whatever leaks can be used to make those changes afterwards, through a legitimate authenticated path. The news coverage in Acronis Backup CVE-2026-87887 exploited: second cPanel plugin flaw hits KEV has the version details and the fix.
That two-stage pattern, leak first and configure later, is why patching the plugin does not finish the job. The patch closes the leak. It does not remove a command that was added while the leak was open.
How do you review pre and post commands safely?
Open every backup or protection plan that applies to the servers in question and inspect the pre and post command fields directly in the management console, then compare each entry against your change records and the scripts your team actually owns. Anything you cannot attribute to a documented change should be treated as an incident finding, not cleaned up quietly.
A practical review has five parts:
- Enumerate plans, not servers. Plans are the unit that holds the command. In a hosting environment one plan may cover dozens of nodes, so a single altered plan is a fleet-wide problem.
- Read the command text. A legitimate pre-command points at a script in a known location with a known checksum. Be suspicious of inline shell, anything that fetches from a URL, base64 blobs, commands that write outside the backup workflow and scripts living in temporary or world-writable directories.
- Check the script on disk. If the command calls a file, confirm the file exists, who owns it, when it was last modified and that its contents match your repository copy. An attacker who cannot edit the plan can still edit a script the plan already trusts.
- Check the plan's history. Most platforms log who changed a plan and when. Changes from unfamiliar accounts, service accounts that should not edit plans, or odd hours are the signal.
- Record the baseline. Export the plan configuration after review and store it with your change records so the next review is a diff, not a fresh read.
For the Acronis case specifically, the checklist in how to audit Acronis protection plans after CVE-2026-87887 walks through the review in order.
Reducing the risk going forward
- Prefer agent-side snapshot integration over scripts. Application-aware backup for MySQL, PostgreSQL or Exchange removes the need for most pre-commands in the first place. Fewer hooks, less to audit.
- Restrict who can edit plans. Plan editing is a privileged operation and should be limited to a small named group with multi-factor authentication, separate from the accounts that merely run restores.
- Alert on plan changes. Forward backup console audit logs to your SIEM and alert on any plan modification. These are rare events in a stable environment, so the alert volume is low and the value is high.
- Pin scripts to a managed location. Keep every pre and post script in a directory owned by root, writable only by root, and under file integrity monitoring. Reject plans that reference anything else.
- Include plans in post-incident review. After any compromise of a server or of a backup console account, review the plans that touch it before declaring the incident closed.
Backup hooks are a legitimate feature and most environments need at least a few. The goal is not to remove them. It is to know exactly which ones exist, who put them there and when they last changed.