Powershell - VBR Backup Scan - YARA ready


Userlevel 7
Badge +8

Hi Community,

after Rick's announcement (thanks for the initiative), I couldn't resist creating another script for the community.

As documented, you can add one YARA rule file to the scan process. But what if you want to use multiple YARA rules? Of course you could work with a so-called index file, which refers to the individual YARA rules, but this brings a problem with it, because the YARA rules are stored on the VBR server, but the scan process provides the backups on the mount server and only one YARA rule can be used (This is a topic for another blog post - stay tuned). 

 

What if we would like to use all YARA rules from Rick's Top 10 Ransomware Threats  blog post for a scan? And we don’t want to click so many times in the UI? This Powershell script can help.

 

You can select all YARA rules, only selected YARA rules or all YARA rules if no selection has been made after 30 seconds. The script needs the backup job name and the hostname which has to be scanned. 

.\vbr-scan-backups.ps1 -Jobname <backup job name> -HostToScan <hostname>
YARA rules selection

Currently all restore points are scanned, but more "features" will be added to the script soon. And as always: Feedback welcome.

Happy scripting!

Steve💖


14 comments

Userlevel 7
Badge +20

I was wondering if there was a way to use all rules versus just one.  It is too bad it was not built in to the UI to allow this. Maybe a future enhancement but adding this to my script library.  Thanks for sharing Steve.

Userlevel 7
Badge +22

Very nice. Thanks Steve.

Userlevel 7
Badge +17

Very interesting, Steve. 👍🏼

I hope this will be integrated in VBR in one of the next versions.

Userlevel 7
Badge +17

This would be a great feature enhancement request I think. 

Userlevel 7
Badge +8

Guys, there is a possibility in the UI, if….

 

Of course you could work with a so-called index file, which refers to the individual YARA rules, but this brings a problem with it, because the YARA rules are stored on the VBR server, but the scan process provides the backups on the mount server and only one YARA rule can be used (This is a topic for another blog post - stay tuned). 

 

And if it‘s not in the UI, there is (probably) a „Yet Antoher Might Tool“ script ;)

 

 

Userlevel 7
Badge +20

Guys, there is a possibility in the UI, if….

 

Of course you could work with a so-called index file, which refers to the individual YARA rules, but this brings a problem with it, because the YARA rules are stored on the VBR server, but the scan process provides the backups on the mount server and only one YARA rule can be used (This is a topic for another blog post - stay tuned). 

 

And if it‘s not in the UI, there is (probably) a „Yet Antoher Might Tool“ script ;)

 

 

But if the VBR is the mount server would it not use all rules?  I know you can specify the mount server. Have to test this in the lab. 

Userlevel 7
Badge +8

Guys, there is a possibility in the UI, if….

 

Of course you could work with a so-called index file, which refers to the individual YARA rules, but this brings a problem with it, because the YARA rules are stored on the VBR server, but the scan process provides the backups on the mount server and only one YARA rule can be used (This is a topic for another blog post - stay tuned). 

 

And if it‘s not in the UI, there is (probably) a „Yet Antoher Might Tool“ script ;)

 

 

But if the VBR is the mount server would it not use all rules?  I know you can specify the mount server. Have to test this in the lab. 

Yes, using an index file having the content down below works, if the VBR server is as well the mount server:
 

include "C:\Program Files\Veeam\Backup and Replication\Backup\YaraRules\file1.yara"
include "C:\Program Files\Veeam\Backup and Replication\Backup\YaraRules\file2.yara"

 

Userlevel 7
Badge +9

Thanks @SteveHeart! Looking forward to the next blogpost as well. 

Userlevel 7
Badge +20

Guys, there is a possibility in the UI, if….

 

Of course you could work with a so-called index file, which refers to the individual YARA rules, but this brings a problem with it, because the YARA rules are stored on the VBR server, but the scan process provides the backups on the mount server and only one YARA rule can be used (This is a topic for another blog post - stay tuned). 

 

And if it‘s not in the UI, there is (probably) a „Yet Antoher Might Tool“ script ;)

 

 

But if the VBR is the mount server would it not use all rules?  I know you can specify the mount server. Have to test this in the lab. 

Yes, using an index file having the content down below works, if the VBR server is as well the mount server:
 

include "C:\Program Files\Veeam\Backup and Replication\Backup\YaraRules\file1.yara"
include "C:\Program Files\Veeam\Backup and Replication\Backup\YaraRules\file2.yara"

 

Yeah, that is what I thought.  Going to give this a try and see since home lab is all in one install.

Userlevel 7
Badge +8

Thanks for this.

 

I’m looking forward to all the scripts people come up with and hope to do a few my own!

Userlevel 7
Badge +6

Congrats to develop and shate the script, I was looking for and I just forked it. 👍🏻 @SteveHeart 

Hi Community,

after Rick's announcement (thanks for the initiative), I couldn't resist creating another script for the community.

As documented, you can add one YARA rule file to the scan process. But what if you want to use multiple YARA rules? Of course you could work with a so-called index file, which refers to the individual YARA rules, but this brings a problem with it, because the YARA rules are stored on the VBR server, but the scan process provides the backups on the mount server and only one YARA rule can be used (This is a topic for another blog post - stay tuned). 

 

What if we would like to use all YARA rules from Rick's Top 10 Ransomware Threats  blog post for a scan? And we don’t want to click so many times in the UI? This Powershell script can help.

 

You can select all YARA rules, only selected YARA rules or all YARA rules if no selection has been made after 30 seconds. The script needs the backup job name and the hostname which has to be scanned. 

.\vbr-scan-backups.ps1 -Jobname <backup job name> -HostToScan <hostname>
YARA rules selection

Currently all restore points are scanned, but more "features" will be added to the script soon. And as always: Feedback welcome.

Happy scripting!

Steve💖

How do you address false positives on a particular rule? Is there a global way to define a condition that excludes a path to a particular file, maybe something more specific about that file, to mark it as benign?

Userlevel 7
Badge +20

Hi Community,

after Rick's announcement (thanks for the initiative), I couldn't resist creating another script for the community.

As documented, you can add one YARA rule file to the scan process. But what if you want to use multiple YARA rules? Of course you could work with a so-called index file, which refers to the individual YARA rules, but this brings a problem with it, because the YARA rules are stored on the VBR server, but the scan process provides the backups on the mount server and only one YARA rule can be used (This is a topic for another blog post - stay tuned). 

 

What if we would like to use all YARA rules from Rick's Top 10 Ransomware Threats  blog post for a scan? And we don’t want to click so many times in the UI? This Powershell script can help.

 

You can select all YARA rules, only selected YARA rules or all YARA rules if no selection has been made after 30 seconds. The script needs the backup job name and the hostname which has to be scanned. 

.\vbr-scan-backups.ps1 -Jobname <backup job name> -HostToScan <hostname>
YARA rules selection

Currently all restore points are scanned, but more "features" will be added to the script soon. And as always: Feedback welcome.

Happy scripting!

Steve💖

How do you address false positives on a particular rule? Is there a global way to define a condition that excludes a path to a particular file, maybe something more specific about that file, to mark it as benign?

There are exclusions for the scans. Need to look in to it more.

Userlevel 7
Badge +8

 

How do you address false positives on a particular rule? Is there a global way to define a condition that excludes a path to a particular file, maybe something more specific about that file, to mark it as benign?

Hi @Tim Dressel,

the built-in YARA scan process mounts the backup on the mount host and recursively scans all visible directories. there is no option to explicitly exclude directories. Depending on the use case, it is maybe possible to “exclude” the file due to certain string definitions, so the rule won’t match for this particular file. See official YARA documentation.

Comment