Attachment: Outlook item with external file reference

Detects an attached Outlook item (MSG or OFT) with atypical message properties whose body references a file on an external host outside of a standard hyperlink. This combination is rarely seen in legitimate mail.

Sublime rule (View on GitHub)

 1name: "Attachment: Outlook item with external file reference"
 2description: "Detects an attached Outlook item (MSG or OFT) with atypical message properties whose body references a file on an external host outside of a standard hyperlink. This combination is rarely seen in legitimate mail."
 3type: "rule"
 4severity: "high"
 5source: |
 6  type.inbound
 7  and any(filter(attachments,
 8                 .file_extension in~ ("msg", "oft")
 9                 or .content_type == "application/vnd.ms-outlook"
10          ),
11          any(file.explode(.),
12              strings.ends_with(.file_name, "__properties_version1.0")
13              and any(.scan.yara.matches, .name == "MSG_Props_Unsent_Flag")
14          )
15          and any(file.explode(.),
16                  (
17                    .flavors.mime == "text/html"
18                    and any(html.xpath(strings.parse_html(.scan.strings.raw),
19                                       '//*[not(self::a or self::area)]/@* | //comment() | //style/text()'
20                            ).nodes,
21                            regex.icontains(.raw,
22                                            '(?:^|[\s"\x27=(;,])(?:file:(?:[/\\]|%5c|%2f)+|\\[\\/]+|/\\[\\/]*|(?:%5c){2,})(?:[?.][\\/]+UNC[\\/]+)?[^\\/\s"\x27<>()%.@]+[.@][^\\/\s"\x27<>()]*(?:[\\/]|%5c|%2f)'
23                            )
24                    )
25                  )
26                  or (
27                    .flavors.mime == "text/rtf"
28                    // html will be handled by the above section
29                    and not regex.imatch(.scan.strings.raw,
30                                         '^\s*\{\\rtf1?[^{}]{0,200}\\fromhtml1.*'
31                    )
32                    and regex.icontains(.scan.strings.raw,
33                                        '(?:^|[\s"\x27=(>;,])(?:(?:\\(?:\\|\x275c|u92\??)){2,}|file:(?:/+|(?:\\(?:\\|\x275c|u92\??)){2,}))(?:[?.](?:\\(?:\\|\x275c|u92\??))+UNC(?:\\(?:\\|\x275c|u92\??))+)?[^\\/\s"\x27{}<>()%.@]+[.@][^\\/\s"\x27{}<>()]*(?:\\(?:\\|\x275c|u92\??)|/)'
34                    )
35                  )
36          )
37  )  
38attack_types:
39  - "Malware/Ransomware"
40tactics_and_techniques:
41  - "Evasion"
42detection_methods:
43  - "File analysis"
44  - "YARA"
45  - "HTML analysis"
46  - "Content analysis"
47id: "724376a8-d396-5492-a768-caf31d8916e4"
to-top