rule ntds_file : usernames hashed_passwords active_directory windows passwords
{
meta:
author = "DiabloHorn https://diablohorn.com"
description = "find the ntds.dit file"
strings:
$filemagic = {ef cd ab 89}
$content_string = "Admin-Display-Name" nocase wide
$content_string2 = "Address-Entry-Display-Table-MSDOS" nocase wide
$content_string3 = "nTDSDSA-Display" nocase wide
$content_string4 = "MSysObjects" nocase ascii
$content_string5 = "ObjidTable" nocase ascii
condition:
($filemagic at 4) and (int32(12) == 0 or int32(12) == 1) and all of ($content_*)
}
rule hive_file : usernames hashed_passwords registry windows passwords
{
meta:
author = "DiabloHorn https://diablohorn.com"
description = "find registry hive files like system/security/sam"
strings:
$filemagic = "regf"
$filemagicbin = "hbin"
$content_string = "ROOT"
condition:
$filemagic at 0 and $filemagicbin at 4096 and $content_string
}
rule shadow_file : usernames hashed_passwords linux passwords
{
meta:
author = "DiabloHorn https://diablohorn.com"
description = "find shadow files"
strings:
$rootline = /root:.:\d+?:\d+?:\d+?:\d+?:/ nocase
$hashline = /:\$\d\$/
$hashtype_md5 = ":$1$"
$hashtype_blowfish = ":$2a$"
$hashtype_blowfish2 = ":$2y$"
$hashtype_sha256 = ":$5$"
$hashtype_sha512 = ":$6$"
condition:
$rootline and $hashline and (1 of ($hashtype_*))
}
rule tomcat_file : usernames plain_passwords passwords
{
meta:
author = "DiabloHorn https://diablohorn.com"
description = "find tomcat config file with plaintext passwords"
strings:
$xml_ident = "" nocase
$xml_ident2 = "" nocase
$roles = "= filesize
}
rule crashdump64_file : memory windows
{
meta:
author = "DiabloHorn https://diablohorn.com"
description = "find memory dump files"
strings:
$header = "PAGE"
$header2 = "DU64"
condition: //might not work due to int32() on filesize, should be int64, but not available
$header at 0 and $header2 at 4 and (uint32(0xf98) == 1 or uint32(0xf98) == 2) and int32(0xfa0) >= filesize
}
rule vmdk_file : virtualdisk
{
meta:
author = "DiabloHorn https://diablohorn.com"
description = "find vmdk files"
strings:
$filemagic = {4b 44 4d} //KDM
$header = "# Disk DescriptorFile"
$header2 = "version="
$header3 = "CID="
$header4 = "parentCID="
$header5 = "createType="
$header6 = "# Extent description"
condition:
$filemagic at 0 and (all of ($header*))
}
rule gpp_file : passwords plain_password
{
meta:
author = "DiabloHorn https://diablohorn.com"
description = "find gpp files"
strings:
$content1 = "" nocase
condition:
all of them
}
rule sql_dump : passwords dbdump {
meta:
author = "ydklijnsma https://blog.0x3a.com"
description = "Looks at sql dump file pattern"
strings:
$dump_header_regex = /-- [a-zA-Z0-9]+\s?SQL\s?[Dd]ump\s?/i
$dump_string_createtableifexists = "CREATE TABLE IF NOT EXISTS"
$dump_string_droptableifexists = "DROP TABLE IF EXISTS "
$dump_string_createtable = "CREATE TABLE "
$insert_into = "INSERT INTO "
condition:
$dump_header_regex at 0 and
(2 of ($dump_string_*)) and
#insert_into >= 1
}
rule idapro_database {
meta:
author = "ydklijnsma https://blog.0x3a.com/"
description = "Finds IDA pro IDB databases"
strings:
$magic = { 49 44 41 ?? }
$btree_str = "B-tree"
condition:
$magic at 0 and $btree_str
}