Advent Calendar Day 3: Sending a Wazuh Alert to Veeam's Incident API
// Table of Contents
Advent Calendar Day 3: Sending a Wazuh Alert to Veeam’s Incident API
Disclaimer: I’m not a professional developer, and this content is intended to demonstrate the “art of the possible” rather than serve as production-ready guidance. Use these features with caution, and test thoroughly in your environment before relying on them for critical tasks.
Welcome back to Day 3 of our Veeam Blog Advent Calendar! Yesterday we got data out of the backup server and into Prometheus and Grafana. Today we’re flipping things around and sending a security signal back in.
If you’ve already got a security tool watching your workloads (which I’m hoping is everyone!), wouldn’t it be handy if it could tell your backup server the moment it spots something? That’s exactly what Veeam’s Incident API is for. A security tool posts a malware event, Veeam marks the machine as Infected, and the restore points created from that moment on carry the flag too, so nobody restores the bad one by accident later.
Credit where it’s due
Before we go any further, a big shout out to Ben Young. Back in October, Ben wrote a brilliant three-part series on exactly this: When the SOC sees ransomware, backup should hear about it, How a Wazuh alert becomes a Veeam malware event and Wiring your own security tool into Veeam. Lessons Learned. He walks through the whole build in detail: the Wazuh rules, the integration that posts the event, the de-duplication, backing up your critical assets straight after, and the reset. My lab follows his design for all of that, rebuilt from his write-up, so rather than repeat it all here, I’ll give you the short version and leave the deep dive to Ben. Go and give his posts a read, they’re well worth it!
Ben’s design was my starting point, and then I couldn’t help myself and kept going.
My version also cuts the infected VM off the network the moment Wazuh spots it, runs the whole response through a ServiceNow incident that works both ways, and opens a sealed clean room to investigate the infected copy. That’s what I really want to show you over these two days: the network cut today, and the rest tomorrow.
Grab your coffee, let’s get into it!
The Short Version
And no, we’re not infecting anything for real (sorry if you were hoping for some actual malware, I tried asking GPT to write me some but computer said no ๐). Here’s how the pieces fit together:
- The (totally fake) ransomware is a small script on a test VM,
lab-demo-01. It “encrypts” and renames the harmless test files in one sandbox folder, then drops a ransom note. - Wazuh watches that folder with file integrity monitoring. Only two loud rules ever reach Veeam: ten
.lockedfiles inside 30 seconds (rule 100204), and the ransom note (rule 100203). - A small Wazuh integration called
custom-veeamposts one malware event to the VBR REST API, then ignores more alerts for that machine for ten minutes, because ransomware doesn’t trip one alert, it trips dozens. - Veeam records the event and marks the machine Infected, and the integration kicks off fresh backups straight away.
Just to be clear about who’s doing what here: Wazuh does the detecting, and Veeam takes the event in through the Incident API, which is exactly what it’s built for. Veeam has plenty of its own built-in malware detection too, but today is all about your security tools and your backups working together.
Here’s the whole flow on one page, with the times from a run in my lab:
The event itself is pleasantly small, and if you’ve ever worked with a SIEM you’ll know every field in it. Here’s the request from that run, with this run’s values filled in (I’ve trimmed the domain, the token and the backup object ID):
POST /api/v1/malwareDetection/events HTTP/1.1
Host: 192.168.20.55:9419
x-api-version: 1.3-rev2
Authorization: Bearer <trimmed>
Content-Type: application/json
Accept: application/json
{
"detectionTimeUtc": "2026-11-18T00:38:03.442Z",
"machine": {
"fqdn": "lab-demo-01.<trimmed>",
"ipv4": "192.168.20.53",
"backupObjectId": "42b9533c-<trimmed>"
},
"details": "Wazuh rule 100204 (level 12): Incident API demo: mass file encryption pattern, possible ransomware in progress",
"engine": "Wazuh",
"severity": "Infected"
}detectionTimeUtc is Wazuh’s own alert time, not the time the request happens to arrive. That matters, because it’s the moment Veeam uses to decide which restore points get flagged. Veeam answered 201 Created, and that’s all the integration needs to hear. If you want to see how the script builds all that, the rules behind it and the de-duplication, Ben’s second part goes through it step by step.
Why stop at one machine?
The Incident API flagged my Proxmox VM without any fuss, and if your VMs are on vSphere, Veeam can even take the next step for you. Tick Perform a Quick Backup upon receiving an external event (Malware Detection > Incident API, from the console’s main menu), and Veeam grabs a fresh restore point of the flagged machine the moment the event lands.
But let’s be honest, ransomware rarely stops at one machine. So, just like Ben’s, my integration uses the same REST API to start backups of the things I really can’t lose. In my lab that’s five jobs: the demo VM’s own, my Priority Zero job with both domain controllers in it, the file share on my NAS, and Entra ID, both the tenant and its audit logs.
It signs in as svc-incident-demo, a service account with exactly two roles: Incident API Operator and Backup Operator. It can report an event and start a job, and that’s about it. Service accounts are exactly what Veeam’s MFA exclusion is there for, because an integration can’t type in a six-digit code. And I definitely didn’t want my own admin account’s password sitting on the SIEM!
And if you’re on 13.2, there’s an even neater option. The REST API now supports client credentials, so you can register an integration as an application with its own client ID, a role and a secret that expires, and no user account at all. If yours only reports events, Incident API Operator is one of the roles an application can have, straight out of the box!
Pulling the Trigger
Right, the fun bit! I ran the attack at 08:38 one morning, with one Ansible command from my lab’s control VM:
scripts/ansible/run-playbook.sh playbooks/incident-demo-trigger.yml -e incident_demo_trigger=attackIt checks the demo’s ready to go, runs the attack, waits until Veeam has the event and the backup is running, and then leaves everything exactly as it is, so I can go and have a proper look around.
That one run made 109 alerts in Wazuh in about seven seconds, nearly all of them the quiet ones. Filter it down to level 12 and only two are left, and those are the two that matter:
Wazuh fired rule 100204 at 08:38:03 and Veeam had the event at 08:38:05, so about five seconds from the first “encrypted” file to Veeam knowing about it!
Over in VBR, the first thing you notice is a new Malware Detection (1) under Action Required, with lab-demo-01 marked Infected:
Select it and hit Malware Events, and there’s our event, with a type of Incident API:
And the details are exactly what the integration sent. See the two times? The activity date, 08:38:03, is Wazuh’s detection time from detectionTimeUtc, and the event was created two seconds later, when the request landed. It was initiated by svc-incident-demo, and the details carry the Wazuh rule that fired:
Finally, under Backups, the Incident-Demo-VM backup now has a Malware Status of Infected. Expand it and there’s lab-demo-01, with its newest restore point from 08:43, about five minutes after the alert, flagged Infected too:
Going a Step Further: Cutting It Off the Network
Everything so far follows Ben’s design. But when ransomware’s busy on a box, the first thing any SOC wants is that box off the network, so that’s where I took my version next.
I run the demo from a live dashboard on my lab’s SOC VM, lab-soc-01. Ben’s demo has a dashboard too, and mine started from his idea before I rebuilt it to my own design. When I hit Run Attack on it, the moment Wazuh’s first “this is definitely ransomware” alert lands, the dashboard cuts lab-demo-01 off the network at the hypervisor. It’s the virtual version of walking up to the server and pulling the cable out.
Pulling the virtual cable
Proxmox has a setting for exactly this: link_down=1 on a VM’s network card. The network card stays attached to the VM, but its link goes down, exactly like a pulled cable, so nothing gets in or out. Flipping it on a running VM is four calls to the Proxmox API:
GET /api2/json/cluster/resources?type=vm
GET /api2/json/nodes/{node}/qemu/{vmid}/config?current=1
PUT /api2/json/nodes/{node}/qemu/{vmid}/config
GET /api2/json/nodes/{node}/qemu/{vmid}/config?current=1The first finds which node the VM’s on right now, as it’s HA-managed and can move around the cluster. The second reads its running config, including net0 and the config’s digest. The PUT writes net0 back with link_down=1 added and everything else left exactly as it was (model, MAC, bridge, the lot), and the last read checks it actually took. Here’s the heart of it, trimmed down a little:
def rewrite_net(value, down):
"""The NIC's config with link_down=1 added (down), or taken out."""
items = [item for item in value.split(",") if item.partition("=")[0] != "link_down"]
if down:
items.append("link_down=1")
return ",".join(items)
config = vm_get(node, "config", {"current": 1})
body = {"net0": rewrite_net(config["net0"], down=True), "digest": config["digest"]}
vm_request(node, "PUT", "config", body=body)So net0 goes from <model>=<MAC>,bridge=vmbr0 to <model>=<MAC>,bridge=vmbr0,link_down=1, and Reset does the same thing in reverse. A few little details in there are worth explaining:
- The
digestmatters. Proxmox refuses thePUTif the VM’s config changed since it was read, so the dashboard can never overwrite a change someone else just made. - No reboot, no replug. Proxmox applies a
link_downchange to the running VM straight away, so the cut lands in a fraction of a second. - The token gets just enough. Its Proxmox API token has
VM.Config.Networkon the demo VM, plusSDN.Useon/sdn/zones/localnetwork/vmbr0alone, with propagation off. Proxmox checks you’re allowed to use the bridge of any network card you change, and without propagation, the token can’t move the card onto another VLAN.
And here’s my favorite bit of the design. The dashboard doesn’t need the network to reach lab-demo-01 either. It runs the fake ransomware, reads the files and runs the reset through the Proxmox QEMU guest agent (agent/exec and agent/file-read), so it can keep watching the VM and clean it up, even with the cable pulled.
How it went
Here’s how the live run went, timed from the start of the attack:
| Time | What happened |
|---|---|
| +2.6 s | Wazuh fires rule 100204 |
| +2.8 s | The dashboard cuts lab-demo-01 off the network |
| +3.9 s | custom-veeam tells Veeam |
| +5.2 s | A ServiceNow incident opens (that’s tomorrow’s story!) |
Two tenths of a second from Wazuh spotting it to the cable being pulled!
Here’s the dashboard a minute into that run. lab-demo-01 has been isolated since 2.8 s, the attacker’s cut off, Wazuh caught 39 alerts before the cut, and all five backup jobs are already running:
Cutting the VM off didn’t slow Veeam down one bit. Veeam backs up Proxmox VMs through the hypervisor, not over the guest’s own network, so all five backup jobs still finished with Success, including a fresh restore point of lab-demo-01 taken after it had been cut off. Isolated and protected at the same time!
Cleaning Up
Once you’re sure the machine’s clean (in my case, once I’d finished taking screenshots ๐), it has to be marked clean again, or Veeam keeps treating it as Infected. That’s one more call, POST /api/v1/malwareDetection/backupObjects/markAsClean, and then the reset puts the sandbox files back and tells the integration to forget the last event, so the next run sends a fresh one. Ben’s reset works the same way.
In my lab, that’s the same playbook with -e incident_demo_trigger=reset, and it waits for the backup the attack started to finish first. That restore point was taken after the detection time, so Veeam rightly flags it Infected, and marking the machine clean before it lands would still leave the new point flagged.
A Few Things Worth Knowing
- Only the loud rules go to Veeam. Every quieter alert stays in Wazuh. If you forward everything, you’ll be marking machines Infected every time someone saves a spreadsheet.
- The detection time decides what gets flagged. Veeam marks the restore points created after the time your tool reports, so send the alert’s real time, not “now”.
- The Incident API keeps it simple. Report an event, and mark the machine clean when you’re done. If you want to check the restore points themselves, that’s what Scan Backup is for, with antivirus or YARA rules, and it needs the Backup Administrator role, which my service account deliberately doesn’t have.
- Cut it off at the hypervisor, back it up through the hypervisor. Veeam backs up Proxmox VMs through the hypervisor, so pulling the virtual cable didn’t get in its way at all, and the isolated VM still got its fresh restore point.
Wrapping Up
About five seconds after the first fake encrypted file, Veeam knew all about it. lab-demo-01 was marked Infected with Wazuh’s own detection time on it, and fresh backups of my domain controllers, my NAS and Entra ID were already on their way, because on a bad day it’s never just one machine. That’s the Incident API and the rest of the REST API working together, and I didn’t touch the backup console once!
Then the bit I added on top. Run it from the dashboard and lab-demo-01 is off the network a fifth of a second after Wazuh spots it, while Veeam carries on backing it up straight through the hypervisor.
Huge thanks again to Ben for the design. If you’ve got Wazuh, or any security tool that can run a script or call a webhook, read his series and give it a go in your lab. Start with one loud rule, a service account with the Incident API Operator role (plus Backup Operator if you want it starting jobs too), and a test folder you don’t mind “encrypting”. Then have a think about what you’d want to happen next on a bad day, because that’s where it gets really fun.
See you tomorrow for Day 4, where we take that same Veeam malware event, turn it into a ServiceNow ticket, and then let the ticket run the response! ๐
Stay curious, stay secure, and as always, happy backing up! ๐