Detection rules › Sublime MQL

DLP: Spain DNI/NIE

Severity
high
Type
dlp
Source
github.com/sublime-security/sublime-rules

Detects messages containing Spanish DNI (National Identity Document) or NIE (Foreigner Identity Number).

Event coverage

Rule body MQL

type.outbound
and any([body.current_thread.text, subject.subject],
        // DNI: 8 digits + 1 letter (e.g., 12345678A)
        // NIE: X/Y/Z + 7 digits + 1 letter (e.g., X1234567A)
        regex.contains(., '\b(?:[XYZ]\d{7}|[\d]{8})[A-Z]\b')
)
and any([body.current_thread.text, subject.subject],
        regex.icontains(., 'DNI|NIE|documento\s+nacional|identidad')
)

Detection logic

Scope: outbound message.

Detects messages containing Spanish DNI (National Identity Document) or NIE (Foreigner Identity Number).

  1. outbound message
  2. any of [body.current_thread.text, subject.subject] where:
    • . matches '\\b(?:[XYZ]\\d{7}|[\\d]{8})[A-Z]\\b'
  3. any of [body.current_thread.text, subject.subject] where:
    • . matches 'DNI|NIE|documento\\s+nacional|identidad'

Inspects: body.current_thread.text, subject.subject, type.outbound. Sensors: regex.contains, regex.icontains.

Indicators matched (2)

FieldMatchValue
regex.containsregex\b(?:[XYZ]\d{7}|[\d]{8})[A-Z]\b
regex.icontainsregexDNI|NIE|documento\s+nacional|identidad