-
-
Save morimolymoly/d33e1c24aba2c33f98c159269328ed45 to your computer and use it in GitHub Desktop.
YARA rule to match zips containing specific file extensions
This file contains 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 | |
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