Suspicious JAVA Child Process

Identifies suspicious child processes of the Java interpreter process. This may indicate an attempt to execute a malicious JAR file or an exploitation attempt via a JAVA specific vulnerability.

Elastic rule (View on GitHub)

  1[metadata]
  2creation_date = "2021/01/19"
  3integration = ["endpoint"]
  4maturity = "production"
  5min_stack_comments = "Multiple field support in the New Terms rule type was added in Elastic 8.6"
  6min_stack_version = "8.6.0"
  7updated_date = "2024/02/22"
  8
  9[rule]
 10author = ["Elastic"]
 11description = """
 12Identifies suspicious child processes of the Java interpreter process. This may indicate an attempt to execute a
 13malicious JAR file or an exploitation attempt via a JAVA specific vulnerability.
 14"""
 15from = "now-9m"
 16index = ["auditbeat-*", "logs-endpoint.events.*"]
 17language = "kuery"
 18license = "Elastic License v2"
 19name = "Suspicious JAVA Child Process"
 20note = """## Triage and analysis
 21
 22### Investigating Suspicious Java Child Process
 23
 24This rule identifies a suspicious child process of the Java interpreter process. It may indicate an attempt to execute a malicious JAR file or an exploitation attempt via a Java specific vulnerability.
 25
 26#### Possible investigation steps
 27
 28- Investigate the process execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence and whether they are located in expected locations.
 29- Investigate other alerts associated with the user/host during the past 48 hours.
 30- Investigate any abnormal account behavior, such as command executions, file creations or modifications, and network connections.
 31- Investigate any abnormal behavior by the subject process such as network connections, file modifications, and any spawned child processes.
 32- Examine the command line to determine if the command executed is potentially harmful or malicious.
 33- Inspect the host for suspicious or abnormal behavior in the alert timeframe.
 34
 35### False positive analysis
 36
 37- If this activity is expected and noisy in your environment, consider adding exceptions — preferably with a combination of process and command line conditions.
 38
 39### Response and remediation
 40
 41- Initiate the incident response process based on the outcome of the triage.
 42- Isolate the involved hosts to prevent further post-compromise behavior.
 43- Remove and block malicious artifacts identified during triage.
 44- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
 45- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
 46- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
 47- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
 48"""
 49references = [
 50    "https://www.lunasec.io/docs/blog/log4j-zero-day/",
 51    "https://github.com/christophetd/log4shell-vulnerable-app",
 52    "https://www.blackhat.com/docs/us-16/materials/us-16-Munoz-A-Journey-From-JNDI-LDAP-Manipulation-To-RCE.pdf",
 53    "https://www.elastic.co/security-labs/detecting-log4j2-with-elastic-security",
 54    "https://www.elastic.co/security-labs/analysis-of-log4shell-cve-2021-45046",
 55]
 56risk_score = 47
 57rule_id = "8acb7614-1d92-4359-bfcf-478b6d9de150"
 58setup = """## Setup
 59
 60If enabling an EQL rule on a non-elastic-agent index (such as beats) for versions <8.2,
 61events will not define `event.ingested` and default fallback for EQL rules was not added until version 8.2.
 62Hence for this rule to work effectively, users will need to add a custom ingest pipeline to populate
 63`event.ingested` to @timestamp.
 64For more details on adding a custom ingest pipeline refer - https://www.elastic.co/guide/en/fleet/current/data-streams-pipeline-tutorial.html
 65"""
 66severity = "medium"
 67tags = ["Domain: Endpoint",
 68        "OS: Linux",
 69        "OS: macOS",
 70        "Use Case: Threat Detection",
 71        "Tactic: Execution",
 72        "Resources: Investigation Guide",
 73        "Use Case: Vulnerability",
 74        "Data Source: Elastic Defend"
 75        ]
 76timestamp_override = "event.ingested"
 77type = "new_terms"
 78
 79query = '''
 80event.category:process and event.type:("start" or "process_started") and process.parent.name:"java" and process.name:(
 81  bash or dash or sh or tcsh or csh or zsh or ksh or fish or python* or php* or perl or ruby or lua* or openssl or
 82  nc or netcat or ncat or telnet or awk or socat or wget or curl
 83) and process.args :(
 84  whoami or id or uname or cat or hostname or ip or curl or wget or pwd or ls or cd or python* or php* or perl or
 85  ruby or lua* or openssl or nc or netcat or ncat or telnet or awk or socat
 86)
 87'''
 88
 89[[rule.threat]]
 90framework = "MITRE ATT&CK"
 91
 92[[rule.threat.technique]]
 93id = "T1059"
 94name = "Command and Scripting Interpreter"
 95reference = "https://attack.mitre.org/techniques/T1059/"
 96
 97[[rule.threat.technique.subtechnique]]
 98id = "T1059.007"
 99name = "JavaScript"
100reference = "https://attack.mitre.org/techniques/T1059/007/"
101
102[rule.threat.tactic]
103id = "TA0002"
104name = "Execution"
105reference = "https://attack.mitre.org/tactics/TA0002/"
106
107[rule.new_terms]
108field = "new_terms_fields"
109value = ["host.id", "process.command_line"]
110
111[[rule.new_terms.history_window_start]]
112field = "history_window_start"
113value = "now-14d"

Triage and analysis

Investigating Suspicious Java Child Process

This rule identifies a suspicious child process of the Java interpreter process. It may indicate an attempt to execute a malicious JAR file or an exploitation attempt via a Java specific vulnerability.

Possible investigation steps

  • Investigate the process execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence and whether they are located in expected locations.
  • Investigate other alerts associated with the user/host during the past 48 hours.
  • Investigate any abnormal account behavior, such as command executions, file creations or modifications, and network connections.
  • Investigate any abnormal behavior by the subject process such as network connections, file modifications, and any spawned child processes.
  • Examine the command line to determine if the command executed is potentially harmful or malicious.
  • Inspect the host for suspicious or abnormal behavior in the alert timeframe.

False positive analysis

  • If this activity is expected and noisy in your environment, consider adding exceptions — preferably with a combination of process and command line conditions.

Response and remediation

  • Initiate the incident response process based on the outcome of the triage.
  • Isolate the involved hosts to prevent further post-compromise behavior.
  • Remove and block malicious artifacts identified during triage.
  • Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
  • Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
  • Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
  • Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).

References

Related rules

to-top