EXPLORE
← Back to Explore
sublimemediumRule

Attachment: File execution via Javascript

Javascript contains identifiers or strings that may attempt to execute files.

MITRE ATT&CK

defense-evasionexecution

Detection Query

type.inbound
and any(attachments,
        .file_type in $file_extensions_common_archives
        and any(file.explode(.),
                any(.scan.javascript.identifiers,
                    strings.ilike(.,
                                  'activexobject',
                                  'shellexecute',
                                  'wscript',
                                  'createobject'
                    )
                )
                or (
                  length(.scan.javascript.strings) > 0
                  and all(.scan.javascript.strings,
                          strings.ilike(., 'shell.application', '*.exe')
                  )
                )
                or any(.scan.javascript.strings,
                       strings.ilike(.,
                                     'wscript.shell',
                                     'adodb.stream',
                                     'winhttp.winhttprequest*',
                                     'msxml2.xmlhttp*',
                                     'system.net.webclient'
                       )
                )
                or (
                  .file_extension == "js"
                  and regex.icontains(.scan.strings.raw,
                                      '(?:wscript\.shell|adodb\.stream|winhttp\.winhttprequest|msxml2\.xmlhttp|system\.net\.webclient)'
                  )
                  and regex.icontains(.scan.strings.raw,
                                      '(?:savetofile|shellexecute|downloadfile)'
                  )
                )
        )
)

Data Sources

Email MessagesEmail HeadersEmail Attachments

Platforms

email

Tags

Attack surface reduction
Raw Content
name: "Attachment: File execution via Javascript"
description: |
  Javascript contains identifiers or strings that may attempt to execute files.
type: "rule"
severity: "medium"
source: |
  type.inbound
  and any(attachments,
          .file_type in $file_extensions_common_archives
          and any(file.explode(.),
                  any(.scan.javascript.identifiers,
                      strings.ilike(.,
                                    'activexobject',
                                    'shellexecute',
                                    'wscript',
                                    'createobject'
                      )
                  )
                  or (
                    length(.scan.javascript.strings) > 0
                    and all(.scan.javascript.strings,
                            strings.ilike(., 'shell.application', '*.exe')
                    )
                  )
                  or any(.scan.javascript.strings,
                         strings.ilike(.,
                                       'wscript.shell',
                                       'adodb.stream',
                                       'winhttp.winhttprequest*',
                                       'msxml2.xmlhttp*',
                                       'system.net.webclient'
                         )
                  )
                  or (
                    .file_extension == "js"
                    and regex.icontains(.scan.strings.raw,
                                        '(?:wscript\.shell|adodb\.stream|winhttp\.winhttprequest|msxml2\.xmlhttp|system\.net\.webclient)'
                    )
                    and regex.icontains(.scan.strings.raw,
                                        '(?:savetofile|shellexecute|downloadfile)'
                    )
                  )
          )
  )
tags:
  - "Attack surface reduction"
attack_types:
  - "Malware/Ransomware"
tactics_and_techniques:
  - "Evasion"
  - "Scripting"
detection_methods:
  - "Archive analysis"
  - "File analysis"
  - "Javascript analysis"
  - "Sender analysis"
id: "627ae0b1-fbe7-58cf-ba7d-0cf51b806c8a"