Attachment: File execution via Javascript

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

Sublime rule (View on GitHub)

 1name: "Attachment: File execution via Javascript"
 2description: |
 3    Javascript contains identifiers or strings that may attempt to execute files.
 4type: "rule"
 5severity: "medium"
 6source: |
 7  type.inbound
 8  and any(attachments,
 9          .file_type in $file_extensions_common_archives
10          and any(file.explode(.),
11                  any(.scan.javascript.identifiers,
12                      strings.ilike(.,
13                                    'activexobject',
14                                    'shellexecute',
15                                    'wscript',
16                                    'createobject'
17                      )
18                  )
19                  or (
20                    length(.scan.javascript.strings) > 0
21                    and all(.scan.javascript.strings,
22                            strings.ilike(., 'shell.application', '*.exe')
23                    )
24                  )
25                  or any(.scan.javascript.strings,
26                         strings.ilike(.,
27                                       'wscript.shell',
28                                       'adodb.stream',
29                                       'winhttp.winhttprequest*',
30                                       'msxml2.xmlhttp*',
31                                       'system.net.webclient'
32                         )
33                  )
34                  or (
35                    .file_extension == "js"
36                    and regex.icontains(.scan.strings.raw,
37                                        '(?:wscript\.shell|adodb\.stream|winhttp\.winhttprequest|msxml2\.xmlhttp|system\.net\.webclient)'
38                    )
39                    and regex.icontains(.scan.strings.raw,
40                                        '(?:savetofile|shellexecute|downloadfile)'
41                    )
42                  )
43          )
44  )  
45tags:
46  - "Attack surface reduction"
47attack_types:
48  - "Malware/Ransomware"
49tactics_and_techniques:
50  - "Evasion"
51  - "Scripting"
52detection_methods:
53  - "Archive analysis"
54  - "File analysis"
55  - "Javascript analysis"
56  - "Sender analysis"
57id: "627ae0b1-fbe7-58cf-ba7d-0cf51b806c8a"

Related rules

to-top