Detection: Log4Shell JNDI Payload Injection Attempt

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.

 1
 2| from datamodel Web.Web 
 3| regex _raw="[jJnNdDiI]{4}(\:
 4|\%3A
 5|\/
 6|\%2F)\w+(\:\/\/
 7|\%3A\%2F\%2F)(\$\{.*?\}(\.)?)?" 
 8| fillnull 
 9| stats count by action, category, dest, dest_port, http_content_type, http_method, http_referrer, http_user_agent, site, src, url, url_domain, user 
10| `log4shell_jndi_payload_injection_attempt_filter`

Data Source

Name Platform Sourcetype Source
Nginx Access N/A 'nginx:plus:kv' '/var/log/nginx/access.log'

Macros Used

Name Value

| log4shell_jndi_payload_injection_attempt_filter | search * |

log4shell_jndi_payload_injection_attempt_filter is an empty macro by default. It allows the user to filter out any results (false positives) without editing the SPL.

Annotations

- MITRE ATT&CK
+ Kill Chain Phases
+ NIST
+ CIS
- Threat Actors
ID Technique Tactic
T1190 Exploit Public-Facing Application Initial Access
T1133 External Remote Services Initial Access
Delivery
Installation
DE.AE
CIS 10

Default Configuration

This detection is configured by default in Splunk Enterprise Security to run with the following settings:

Setting Value
Disabled true
Cron Schedule 0 * * * *
Earliest Time -70m@m
Latest Time -10m@m
Schedule Window auto
Creates Risk Event True
This configuration file applies to all detections of type anomaly. These detections will use Risk Based Alerting.

Implementation

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.

Associated Analytic Story

Risk Based Analytics (RBA)

Risk Message:

CVE-2021-44228 Log4Shell triggered for host $dest$

Risk Object Risk Object Type Risk Score Threat Objects
dest system 15 No Threat Objects
user user 15 No Threat Objects

References

Detection Testing

Test Type Status Dataset Source Sourcetype
Validation Passing N/A N/A N/A
Unit Passing Dataset nginx nginx:plus:kv
Integration ✅ Passing Dataset nginx nginx:plus:kv

Replay any dataset to Splunk Enterprise by using our replay.py tool or the UI. Alternatively you can replay a dataset into a Splunk Attack Range


Source: GitHub | Version: 4