Body: CSS zero-value calc() obfuscation
Detects inbound messages containing HTML where a CSS calc() expression subtracts an identical value and unit from itself (e.g., calc(100px - 100px)), always resolving to zero. This pattern is commonly used to hide or collapse content from view while keeping it present in the underlying HTML, a technique often leveraged to evade text-based detection or conceal malicious content from recipients.
Sublime rule (View on GitHub)
1name: "Body: CSS zero-value calc() obfuscation"
2description: "Detects inbound messages containing HTML where a CSS calc() expression subtracts an identical value and unit from itself (e.g., calc(100px - 100px)), always resolving to zero. This pattern is commonly used to hide or collapse content from view while keeping it present in the underlying HTML, a technique often leveraged to evade text-based detection or conceal malicious content from recipients."
3type: "rule"
4severity: "medium"
5source: |
6 type.inbound
7 and any(regex.iextract(body.html.raw,
8 'calc\(\s*(?P<n1>\d+(?:\.\d+)?)(?P<u1>px|vw|vh|em|rem|%)\s*-\s*(?P<n2>\d+(?:\.\d+)?)(?P<u2>px|vw|vh|em|rem|%)\s*\)'
9 ),
10 .named_groups["n1"] == .named_groups["n2"]
11 and .named_groups["u1"] == .named_groups["u2"]
12 )
13attack_types:
14 - "Credential Phishing"
15 - "Spam"
16tactics_and_techniques:
17 - "Evasion"
18detection_methods:
19 - "HTML analysis"
20id: "a9bd4f3f-3c8e-5807-9779-337498fc05e5"