Detection rules › Elastic

JAVA Application with Unusual File Extension

Time window
5s
Sequence by
process.entity_id
Source
github.com/elastic/protections-artifacts

Identifies the execution of a Java JAR application with an unusual file extension. Malicious files may masquerade as non executable file extensions to evade defenses.

MITRE ATT&CK coverage

Rule body

[rule]
description = """
Identifies the execution of a Java JAR application with an unusual file extension. Malicious files may masquerade as non
executable file extensions to evade defenses.
"""
id = "13615fd4-b220-4033-ab4f-8b16b9beae57"
license = "Elastic License v2"
name = "JAVA Application with Unusual File Extension"
os_list = ["windows"]
version = "1.0.7"

query = '''
sequence by process.entity_id with maxspan=5s
[process where event.action == "start" and
 (process.name : "javaw.exe" or process.pe.original_file_name == "javaw.exe") and not process.command_line : "*.jar*" and 
  (
   (process.args_count == 3 and process.args : "-jar") or 
   (process.args_count == 4 and process.args : ("-cp", "-classpath") and process.command_line : " *.* ")
   ) and
  not process.executable : ("?:\\Program Files\\7edit.com\\7Edit *\\bin\\javaw.exe",
                            "?:\\Program Files\\Angry IP Scanner\\jre\\bin\\javaw.exe",
                            "?:\\Program Files\\Eclipse Adoptium\\jdk-*-hotspot\\bin\\javaw.exe",
                            "C:\\Program Files\\Java\\jdk-11\\bin\\javaw.exe",
                            "C:\\Program Files\\Zulu\\zulu-8\\bin\\javaw.exe",
                            "C:\\Program Files\\AdoptOpenJDK\\jre*-hotspot\\bin\\javaw.exe") and
  not process.parent.executable :
                     ("?:\\Program Files (x86)\\AssoSoftware\\AssoInvoice\\AssoInvoice.exe",
                      "C:\\Program Files (x86)\\ImprimeTickets\\ImprimeTickets.exe") and
  not (process.code_signature.subject_name : ("BELLSOFT", "Eclipse.org Foundation, Inc.", "Insurity LLC") and process.code_signature.trusted == true) and
  not process.command_line : "\"C:\\Program Files\\Java\\jre1.8.0_51\\bin\\javaw.exe\" -jar \"C:\\Users\\*\\AppData\\Roaming\\.minecraft\\TLauncher.exe\""
  ]
[network where event.action in ("connection_accepted", "connection_attempted") and
 not cidrmatch(destination.ip, "10.0.0.0/8", "127.0.0.0/8", "169.254.0.0/16", "172.16.0.0/12", "192.0.0.0/24",
       "192.0.0.0/29", "192.0.0.8/32", "192.0.0.9/32", "192.0.0.10/32", "192.0.0.170/32", "192.0.0.171/32",
       "192.0.2.0/24", "192.31.196.0/24", "192.52.193.0/24", "192.88.99.0/24", "224.0.0.0/4",
       "100.64.0.0/10", "192.175.48.0/24","198.18.0.0/15", "198.51.100.0/24", "203.0.113.0/24", "240.0.0.0/4", "::1",
       "FE80::/10", "FF00::/8")]
'''

min_endpoint_version = "7.16.0"
[[actions]]
action = "kill_process"
field = "process.entity_id"
state = 0

[[optional_actions]]
action = "rollback"
field = "process.entity_id"
state = 0

[[threat]]
framework = "MITRE ATT&CK"
[[threat.technique]]
id = "T1059"
name = "Command and Scripting Interpreter"
reference = "https://attack.mitre.org/techniques/T1059/"


[threat.tactic]
id = "TA0002"
name = "Execution"
reference = "https://attack.mitre.org/tactics/TA0002/"

[internal]
min_endpoint_version = "7.16.0"

Stages and Predicates

Ordered sequence: each step below must occur in order within 5s, correlated by process.entity_id.

Stage 1: process

[process where event.action == "start" and
 (process.name : "javaw.exe" or process.pe.original_file_name == "javaw.exe") and not process.command_line : "*.jar*" and 
  (
   (process.args_count == 3 and process.args : "-jar") or 
   (process.args_count == 4 and process.args : ("-cp", "-classpath") and process.command_line : " *.* ")
   ) and
  not process.executable : ("?:\\Program Files\\7edit.com\\7Edit *\\bin\\javaw.exe",
                            "?:\\Program Files\\Angry IP Scanner\\jre\\bin\\javaw.exe",
                            "?:\\Program Files\\Eclipse Adoptium\\jdk-*-hotspot\\bin\\javaw.exe",
                            "C:\\Program Files\\Java\\jdk-11\\bin\\javaw.exe",
                            "C:\\Program Files\\Zulu\\zulu-8\\bin\\javaw.exe",
                            "C:\\Program Files\\AdoptOpenJDK\\jre*-hotspot\\bin\\javaw.exe") and
  not process.parent.executable :
                     ("?:\\Program Files (x86)\\AssoSoftware\\AssoInvoice\\AssoInvoice.exe",
                      "C:\\Program Files (x86)\\ImprimeTickets\\ImprimeTickets.exe") and
  not (process.code_signature.subject_name : ("BELLSOFT", "Eclipse.org Foundation, Inc.", "Insurity LLC") and process.code_signature.trusted == true) and
  not process.command_line : "\"C:\\Program Files\\Java\\jre1.8.0_51\\bin\\javaw.exe\" -jar \"C:\\Users\\*\\AppData\\Roaming\\.minecraft\\TLauncher.exe\""
  ]

Stage 2: network

[network where event.action in ("connection_accepted", "connection_attempted") and
 not cidrmatch(destination.ip, "10.0.0.0/8", "127.0.0.0/8", "169.254.0.0/16", "172.16.0.0/12", "192.0.0.0/24",
       "192.0.0.0/29", "192.0.0.8/32", "192.0.0.9/32", "192.0.0.10/32", "192.0.0.170/32", "192.0.0.171/32",
       "192.0.2.0/24", "192.31.196.0/24", "192.52.193.0/24", "192.88.99.0/24", "224.0.0.0/4",
       "100.64.0.0/10", "192.175.48.0/24","198.18.0.0/15", "198.51.100.0/24", "203.0.113.0/24", "240.0.0.0/4", "::1",
       "FE80::/10", "FF00::/8")]

Exclusions

The rule actively suppresses these predicates.

FieldKindExcluded valuesSearch
process.code_signature.subject_nameeqBELLSOFT, Eclipse.org Foundation, Inc., Insurity LLCexcludes:process.code_signature.subject_name field:"process.code_signature.subject_name" value:"BELLSOFT" field:"process.code_signature.subject_name" value:"Eclipse.org Foundation, Inc." field:"process.code_signature.subject_name" value:"Insurity LLC"
process.code_signature.trustedeqtrueexcludes:process.code_signature.trusted field:"process.code_signature.trusted" value:"true"
process.command_linematch.jarexcludes:process.command_line field:"process.command_line" value:".jar"
process.command_linewildcard"C:\Program Files\Java\jre1.8.0_51\bin\javaw.exe" -jar "C:\Users\*\AppData\Roaming\.minecraft\TLauncher.exe"excludes:process.command_line
process.executablewildcard?:\Program Files\7edit.com\7Edit *\bin\javaw.exe, ?:\Program Files\Angry IP Scanner\jre\bin\javaw.exe, ?:\Program Files\Eclipse Adoptium\jdk-*-hotspot\bin\javaw.exe, C:\Program Files\Java\jdk-11\bin\javaw.exe, C:\Program Files\Zulu\zulu-8\bin\javaw.exe, C:\Program Files\AdoptOpenJDK\jre*-hotspot\bin\javaw.exeexcludes:process.executable
process.parent.executableeq?:\Program Files (x86)\AssoSoftware\AssoInvoice\AssoInvoice.exe, C:\Program Files (x86)\ImprimeTickets\ImprimeTickets.exeexcludes:process.parent.executable field:"process.parent.executable" value:"?:\Program Files (x86)\AssoSoftware\AssoInvoice\AssoInvoice.exe" field:"process.parent.executable" value:"C:\Program Files (x86)\ImprimeTickets\ImprimeTickets.exe"
destination.ipcidr_match10.0.0.0/8, 127.0.0.0/8, 169.254.0.0/16, 172.16.0.0/12, 192.0.0.0/24, 192.0.0.0/29, 192.0.0.8/32, 192.0.0.9/32, 192.0.0.10/32, 192.0.0.170/32, 192.0.0.171/32, 192.0.2.0/24, 192.31.196.0/24, 192.52.193.0/24, 192.88.99.0/24, 224.0.0.0/4, 100.64.0.0/10, 192.175.48.0/24, 198.18.0.0/15, 198.51.100.0/24, 203.0.113.0/24, 240.0.0.0/4, ::1, FE80::/10, FF00::/8excludes:destination.ip

Indicators

These rows show field, operator, and value matches.

FieldKindValuesSearch
event.actioneq
  • start corpus 391 (elastic 391)
field:"EventType" kind:eq value:"start"
event.actionin
  • connection_accepted corpus 6 (elastic 6)
  • connection_attempted corpus 73 (elastic 73)
field:"EventType" kind:in
process.argswildcard
  • -classpath corpus 3 (elastic 3)
  • -cp corpus 3 (elastic 3)
  • -jar corpus 8 (elastic 8)
field:"process.args" kind:wildcard
process.args_counteq
  • 3 transforms: number corpus 22 (elastic 22)
  • 4 transforms: number corpus 6 (elastic 6)
field:"process.args_count" kind:eq
process.command_linewildcard
  • *.* corpus 3 (elastic 3)
field:"CommandLine" kind:wildcard value:" *.* "
process.namewildcard
  • javaw.exe corpus 9 (elastic 9)
field:"process_name" kind:wildcard value:"javaw.exe"
process.pe.original_file_nameeq
  • javaw.exe corpus 7 (elastic 5, sigma 2)
field:"OriginalFileName" kind:eq value:"javaw.exe"