Log4Shell JNDI Payload Injection Attempt

Original Source: [splunk source]
Name:Log4Shell JNDI Payload Injection Attempt
id:c184f12e-5c90-11ec-bf1f-497c9a704a72
version:3
date:2024-09-30
author:Jose Hernandez
status:production
type:Anomaly
Description:The following analytic identifies attempts to inject Log4Shell JNDI payloads via web calls. It leverages the Web datamodel and uses regex to detect patterns like `${jndi:ldap://` in raw web event data, including HTTP headers. This activity is significant because it targets vulnerabilities in Java web applications using Log4j, such as Apache Struts and Solr. If confirmed malicious, this could allow attackers to execute arbitrary code, potentially leading to full system compromise. Immediate investigation is required to determine if the attempt was successful and to mitigate any potential exploitation.
Data_source:
  • -Nginx Access
search:| from datamodel Web.Web
| regex _raw="[jJnNdDiI]{4}(\:|\%3A|\/|\%2F)\w+(\:\/\/|\%3A\%2F\%2F)(\$\{.*?\}(\.)?)?"
| fillnull
| stats count by action, category, dest, dest_port, http_content_type, http_method, http_referrer, http_user_agent, site, src, url, url_domain, user
| `log4shell_jndi_payload_injection_attempt_filter`


how_to_implement:This detection requires the Web datamodel to be populated from a supported Technology Add-On like Splunk for Apache or Splunk for Nginx.
known_false_positives:If there is a vulnerablility scannner looking for log4shells this will trigger, otherwise likely to have low false positives.
References:
  -https://www.lunasec.io/docs/blog/log4j-zero-day/
drilldown_searches:
name:'View the detection results for - "$user$" and "$dest$"'
search:'%original_detection_search% | search user = "$user$" dest = "$dest$"'
earliest_offset:'$info_min_time$'
latest_offset:'$info_max_time$'
name:'View risk events for the last 7 days for - "$user$" and "$dest$"'
search:'| from datamodel Risk.All_Risk | search normalized_risk_object IN ("$user$", "$dest$") starthoursago=168 | stats count min(_time) as firstTime max(_time) as lastTime values(search_name) as "Search Name" values(risk_message) as "Risk Message" values(analyticstories) as "Analytic Stories" values(annotations._all) as "Annotations" values(annotations.mitre_attack.mitre_tactic) as "ATT&CK Tactics" by normalized_risk_object | `security_content_ctime(firstTime)` | `security_content_ctime(lastTime)`'
earliest_offset:'$info_min_time$'
latest_offset:'$info_max_time$'
tags:
  analytic_story:
    - 'Log4Shell CVE-2021-44228'
    - 'CISA AA22-257A'
    - 'CISA AA22-320A'
  asset_type:Endpoint
  confidence:30
  cve:
    - 'CVE-2021-44228'
  impact:50
  message:CVE-2021-44228 Log4Shell triggered for host $dest$
  mitre_attack_id:
    - 'T1190'
    - 'T1133'
  observable:
    name:'user'
    type:'User'
    - role:
      - 'Victim'
    name:'dest'
    type:'Hostname'
    - role:
      - 'Victim'
  product:
    - 'Splunk Enterprise'
    - 'Splunk Enterprise Security'
    - 'Splunk Cloud'
  required_fields:
    - 'action'
    - 'category'
    - 'dest'
    - 'dest_port'
    - 'http_content_type'
    - 'http_method'
    - 'http_referrer'
    - 'http_user_agent'
    - 'site'
    - 'src'
    - 'url'
    - 'url_domain'
    - 'user'
  risk_score:15
  security_domain:threat

tests:
name:'True Positive Test'
 attack_data:
  data: https://media.githubusercontent.com/media/splunk/attack_data/master/datasets/attack_techniques/T1190/log4j_proxy_logs/log4j_proxy_logs.log
  source: nginx
  sourcetype: nginx:plus:kv
manual_test:None