Fix it now
These two events are commonly swapped. Microsoft publishes 5007 as MALWAREPROTECTION_CONFIG_CHANGED – the antimalware platform configuration changed, with old and new values – which is an audit record of a change that succeeded. 5013 is the one that says tamper protection blocked a change to Microsoft Defender Antivirus.
Get-MpComputerStatus | Select-Object IsTamperProtected,AMRunningMode,RealTimeProtectionEnabled
Get-WinEvent -LogName "Microsoft-Windows-Windows Defender/Operational" -MaxEvents 50 | Where-Object Id -in 5007,5013 | Format-List TimeCreated,Id,Message
- Open a 5007 entry and read the setting it names along with its old and new values. That line usually identifies what changed and when.
- Look for 5013 entries. Those are the changes tamper protection refused, and they name the setting change that was blocked.
- Check whether tamper protection is on.
Get-MpComputerStatusreports it, and Windows Security shows it under Virus & threat protection, then Virus & threat protection settings. - If you need to change a tamper-protected setting yourself on a personal machine, do it there rather than by script or registry edit.
- If the machine is managed, check
dsregcmd /statusand a policy report fromgpresult /h %userprofile%\Desktop\gp.html. On a managed device you cannot change tamper protection locally at all.
Group Policy changes to tamper-protected settings are ignored. A policy that looks like it should be winning will not be, and the 5013 entries are where that shows up.
If you can account for every 5007 and every 5013 you are seeing, you are done. If not, the next section covers who is allowed to change what.
Why it happens
The distinction between these two events is the whole article. Microsoft publishes 5007 as MALWAREPROTECTION_CONFIG_CHANGED, with the message “The antimalware platform configuration changed”, carrying an old value and a new value. It is written when a change succeeds, from whatever source, and Microsoft’s own note on it is that if the event is unexpected you should review the settings, because it might be the result of malware. It is an audit record, not an error.
5013 is the block. Microsoft’s published description is direct: if tamper protection is enabled then any attempt to change any of Defender’s settings is blocked, event 5013 is generated, and it states which setting change was blocked. So a run of 5013 entries is tamper protection working, and a run of 5007 entries is something successfully changing your antivirus configuration – which is the more interesting of the two if you did not do it.
Tamper protection covers a specific published list rather than everything: virus and threat protection, real-time protection, behaviour monitoring, antivirus protection including IOAV, cloud protection, security intelligence updates, automatic threat actions, Windows Security app notifications, archived file scanning, and antivirus exclusions, which cannot be modified or added while it is on. Microsoft also states that where Group Policy is used to manage Defender settings, changes made to tamper-protected settings are ignored.
The other two events in this family describe outcomes rather than configuration. 1119 is MALWAREPROTECTION_STATE_MALWARE_ACTION_CRITICALLY_FAILED – the platform hit a critical error while trying to take action on malware or other unwanted software, and the event carries the threat name, path, action, error code and description. 1121 records an attack surface reduction rule firing in block mode, which is policy doing exactly what it was configured to do and is regularly mistaken for a fault by whoever wrote the rule.
Tamper protection is refusing your change
You have this one if 5013 appears each time you try to alter a setting through a script, a registry edit or a third-party tool, while the same change works in Windows Security.
- Make the change in Windows Security, under Virus & threat protection, then Virus & threat protection settings.
- If you genuinely need to change it by script, turn tamper protection off there first, make the change, then turn it straight back on.
- On a managed machine, change it in the management console. Individual users cannot change tamper protection on a managed device.
- Confirm the new state with
Get-MpComputerStatusrather than trusting the interface alone.
Leaving tamper protection off so a maintenance script runs cleanly is a poor trade. Turn it back on the moment the change is applied.
Something you did not authorise is changing settings
You have this one if 5007 entries naming settings and values nobody set, at times nobody was using the machine.
- Read the old and new values in the event; they name the setting precisely.
- Check what was installed or run around that timestamp.
- Turn tamper protection on if it is off, which converts future attempts from 5007 into 5013.
- Run a full scan, and an offline scan if anything looks wrong. Microsoft’s own note on 5007 is that an unexpected one might be the result of malware.
A policy is reapplying its configuration
You have this one if 5007 entries at every startup or logon, and Windows Security showing settings as managed.
- Produce a policy report with
gpresult /h %userprofile%\Desktop\gp.htmland look at the Defender antivirus policies. - Remember that changes to tamper-protected settings made through Group Policy are ignored, so some of what the report shows will not be taking effect.
- Change the setting where it is actually being set rather than locally.
- Restart and confirm the 5007 entries stop.
A management enrolment is still in place
You have this one if Settings are shown as managed on a machine you believe is no longer enrolled anywhere.
- Run
dsregcmd /statusand read whether the device still reports an enrolment. - Remove the enrolment properly through Settings, Accounts, Access work or school rather than deleting keys.
- Restart and confirm the managed markers disappear from Windows Security.
- Only then look at leftover policy values, and remove individual values rather than whole keys.
An attack surface reduction rule is blocking legitimate work
You have this one if Event 1121 names an application or script your organisation genuinely uses.
- Read the rule identifier in the event so you know which rule fired.
- Move that rule to audit mode temporarily and confirm the block disappears while logging continues.
- Add a narrow exclusion for the specific file or folder rather than disabling the rule.
- Return the rule to block mode and confirm the legitimate application now runs.
Full reference
The four events, precisely
| Event | Symbolic name | What Microsoft publishes |
|---|---|---|
5007 |
MALWAREPROTECTION_CONFIG_CHANGED | The antimalware platform configuration changed, with old and new values. Review the settings if the event is unexpected, as it might be the result of malware |
5013 |
– | Tamper protection blocked a change to Microsoft Defender Antivirus, stating which setting change was blocked |
1119 |
MALWAREPROTECTION_STATE_MALWARE_ACTION_CRITICALLY_FAILED | A critical error while taking action on malware or other potentially unwanted software, with the threat name, path, action, error code and description |
1121 |
– | An attack surface reduction rule fired in block mode, with the platform version, resource path and hashes |
What tamper protection actually covers
- Virus and threat protection
- Real-time protection
- Behaviour monitoring
- Antivirus protection, including IOAV
- Cloud protection
- Security intelligence updates
- Automatic threat actions
- Windows Security app notifications
- Archived file scanning
- Antivirus exclusions, which cannot be modified or added while it is on
That last one catches people out regularly. A script that adds an exclusion will fail silently against a tamper-protected machine and log a 5013, and the exclusion will simply not be there afterwards.
Turning it on or off on a personal machine
- Select Start and begin typing Security. In the results, select Windows Security.
- Select Virus & threat protection, then Virus & threat protection settings.
- Set Tamper Protection to On or Off.
- You need administrator permissions on the device to change it.
- On a device managed by a security team, this control is not yours; tamper protection is managed centrally.
Reading 1119 rather than guessing at it
1119 is the event to read carefully when remediation keeps failing, because it carries the whole picture in one entry: the threat name and ID, its severity and category, the file path, the detection origin, type and source, the user and process involved, the action attempted, the action status, and a standard HRESULT with its description. That HRESULT is the thing to work on. An engine code such as 0x80508026, removal not supported inside a container, tells you far more than the word “failed”.
Commands for establishing who is in charge
| Command | What it answers |
|---|---|
Get-MpComputerStatus |
Whether tamper protection is on, and which mode Defender is running in |
Get-MpPreference |
The current Defender preferences, including exclusions and ASR settings |
dsregcmd /status |
Whether the device is still joined or enrolled anywhere |
gpresult /h <file> |
Which Group Policy settings are being applied, and from where |
A sensible standing position
- Leave tamper protection on. It is the setting that stops an attacker disabling your antivirus before doing anything else.
- Accept that scripted changes to the covered settings will fail while it is on, and plan around that rather than switching it off permanently.
- Treat unexplained 5007 entries as worth investigating, because Microsoft says so on its own documentation page for the event.
- Treat 5013 entries as reassurance unless they are yours, in which case they are a routing problem: you used the wrong path to make the change.
- On managed devices, stop trying to change Defender locally. It will not stick and it generates noise that hides the entries that matter.
When a licence is the actual fix
On a single home PC none of this needs a purchase. Tamper protection is a toggle in Windows Security, every setting discussed here can be changed there for nothing, and the events are already being written. The picture changes when you have to hold a configuration across a fleet: setting Defender policy centrally, keeping tamper protection on everywhere and seeing which machines are logging 5013 all need a management platform rather than a walk round the office. Microsoft 365 Business Premium bundles device management with Defender for Business for exactly that job, and Arco can check whether your user count makes that the sensible route or whether standalone management licensing fits better.
Every code this article covers
| Code | What it points at | Source |
|---|---|---|
5007 |
MALWAREPROTECTION_CONFIG_CHANGED: the antimalware platform configuration changed, carrying the old and new values. It records a change that succeeded, and Microsoft advises reviewing the settings if the event is unexpected | Microsoft Learn |
5013 |
Tamper protection blocked a change to Microsoft Defender Antivirus. The event states which setting change was blocked | Microsoft Learn |
1119 |
MALWAREPROTECTION_STATE_MALWARE_ACTION_CRITICALLY_FAILED: a critical error while trying to take action on malware or other potentially unwanted software, with the threat, path, action and an HRESULT | Microsoft Learn |
1121 |
An attack surface reduction rule fired in block mode, carrying the platform version, the resource path and hashes | Microsoft Learn |
Confirm the fix worked
Get-MpComputerStatusreports tamper protection in the state you intended.- Windows Security no longer describes settings as managed, if you have removed a stale enrolment.
- No new 5007 entries appear at startup for settings nobody is changing.
- Any 5013 entries you are still seeing are ones you can account for.
- A restart leaves the configuration as you set it rather than reverting.
Questions people ask about this
Is event 5007 the tamper protection block?
No. Microsoft publishes 5007 as MALWAREPROTECTION_CONFIG_CHANGED, an audit record that a setting changed, with old and new values. The event tamper protection writes when it refuses a change is 5013, and it names the setting change that was blocked.
Is event 5007 something to worry about?
By itself, no – normal use generates it. Microsoft’s own note is that if the event is unexpected you should review the settings, because it might be the result of malware. Worry when it names a setting you did not change at a time you were not using the machine.
Why can I not change a Defender setting on my own computer?
Either tamper protection is refusing the route you used, or the machine carries a policy from a management platform, current or former. The 5007 and 5013 entries distinguish the two in seconds.
My Group Policy setting is not taking effect. Why?
Microsoft states that where Group Policy is used to manage Defender settings, changes made to tamper-protected settings are ignored. If the setting is on the tamper-protected list, the policy will not win while tamper protection is on.
Do I need a paid licence to use tamper protection?
No. It is part of Windows on a personal machine and costs nothing. Licensing comes into it only when you want to enforce and monitor the setting across many machines from one console.
