Last active
December 24, 2022 04:57
-
-
Save usualsuspect/ce70e5db438178611a75b4f051f8d570 to your computer and use it in GitHub Desktop.
YARA rule to match zips containing specific file extensions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rule zip_with_ext | |
{ | |
meta: | |
author = "@jaydinbas" | |
description = "Only match zip files containing desired file extensions" | |
strings: | |
$file_sig = "PK\x03\x04" //zip header sig | |
$entry_sig = "PK\x01\x02" //ZIPDIRENTRY sig | |
//add in any file extensions/file name suffices you want | |
$ext1 = ".exe" nocase | |
$ext2 = ".dll" nocase | |
$ext3 = ".scr" nocase | |
condition: | |
$file_sig at 0 | |
and for any i in (1..#entry_sig) : | |
( | |
for any of ($ext*) : | |
( | |
$ at (@entry_sig[i] + 46 + uint16(@entry_sig[i]+28) - !) | |
) | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment