Skip to content

YARA · elceef yara-rulz

ELCEEF_ZIP_High_Ratio_Single_Doc

Detects ZIP archives containing single MS Word document with unusually high compression ratio

Genericelceef yara-rulzMIT LicenseCompiles with YARA-X
Author
marcin@ulikowski.pl
Date
2023-03-08
Score / Quality
75 / 75

What this rule detects

Detects ZIP archives containing single MS Word document with unusually high compression ratio

It defines 2 patterns (1 text, 1 hex, 0 regex).

Summary generated from the rule's metadata and condition.

Rule source

zip-high-ratio-single-doc.yarMIT License
rule ELCEEF_ZIP_High_Ratio_Single_Doc : FILE
{
	meta:
		description = "Detects ZIP archives containing single MS Word document with unusually high compression ratio"
		author = "marcin@ulikowski.pl"
		id = "0fbe89d9-1bf5-50a9-b6c1-1d739162a2ba"
		date = "2023-03-08"
		modified = "2023-03-08"
		reference = "https://github.com/elceef/yara-rulz"
		source_url = "https://github.com/elceef/yara-rulz/blob/5683b294a12cf0c875b624933586029ae43a852f/rules/ZIP_High_Ratio_Single_Doc.yara#L8-L27"
		license_url = "https://github.com/elceef/yara-rulz/blob/5683b294a12cf0c875b624933586029ae43a852f/LICENSE"
		hash = "4d9a6dfca804989d40eeca9bb2d90ef33f3980eb07ca89bbba06d0ef4b37634b"
		hash = "4bc2d14585c197ad3aa5836b3f7d9d784d7afe79856e0ddf850fc3c676b6ecb1"
		logic_hash = "470300b8d6356cff43a1e2be3a23a97be5d1e2ce5a76f2fb2eccdbbb47a4d327"
		score = 75
		quality = 75
		tags = "FILE"

	strings:
		$magic = { 50 4b 03 04 }
		$ext = ".doc"

	condition:
		filesize < 1MB and $magic at 0 and #magic == 1 and uint32( 22 ) > 1024 * 1024 * 100 and $ext at ( uint16( 26 ) + 26 )
}

Strings (2 patterns)

IdentifierTypeValueModifiers
$magichex{ 50 4b 03 04 }
$exttext".doc"

Condition

filesize < 1MB and $magic at 0 and #magic == 1 and uint32( 22 ) > 1024 * 1024 * 100 and $ext at ( uint16( 26 ) + 26 )

In plain words (Heuristic)

  • The file must be smaller than 1MB (a cheap guard that skips large files).
  • Pattern $magic must occur == 1 times.
  • Pattern $magic must be found at offset 0.
  • Pattern $ext must be found at offset (.

Test this rule in your browser

Drop a file to scan it with this rule using YARA-X compiled to WebAssembly. Nothing is uploaded.

Drop a file here or click to chooseScanned locally with YARA-X. Files up to 200 MB.

Open in editor

References

Sample hashes

Hashes of samples the author lists in the rule's meta (look them up in your threat-intelligence platform).

  • 4d9a6dfca804989d40eeca9bb2d90ef33f3980eb07ca89bbba06d0ef4b37634b
  • 4bc2d14585c197ad3aa5836b3f7d9d784d7afe79856e0ddf850fc3c676b6ecb1

Licence & attribution

Author: marcin@ulikowski.pl

Source repository: elceef yara-rulz @ 5683b294a1

Licence: MIT License (repository licence)

Copyright notice: Copyright (c) 2022 Marcin Ulikowski

Original rule

Mirrored via YARA Forge 20260927, which prefixes rule names with the source and adds normalised meta fields.

Rule id: 0fbe89d9-1bf5-50a9-b6c1-1d739162a2ba

Tags:FILE