EXPLORE
← Back to Explore
sublimemediumRule

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.

MITRE ATT&CK

defense-evasion

Detection Query

type.inbound
and any(regex.iextract(body.html.raw,
                       '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*\)'
        ),
        .named_groups["n1"] == .named_groups["n2"]
        and .named_groups["u1"] == .named_groups["u2"]
)

Data Sources

Email MessagesEmail HeadersEmail Attachments

Platforms

email
Raw Content
name: "Body: CSS zero-value calc() obfuscation"
description: "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."
type: "rule"
severity: "medium"
source: |
  type.inbound
  and any(regex.iextract(body.html.raw,
                         '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*\)'
          ),
          .named_groups["n1"] == .named_groups["n2"]
          and .named_groups["u1"] == .named_groups["u2"]
  )
attack_types:
  - "Credential Phishing"
  - "Spam"
tactics_and_techniques:
  - "Evasion"
detection_methods:
  - "HTML analysis"
id: "a9bd4f3f-3c8e-5807-9779-337498fc05e5"