CatalogLog4Shell
Log4Shell (CVE-2021-44228)
Shared component log4shell
Unauthenticated remote code execution in Apache Log4j 2 via JNDI lookup substitution in log messages. CVSS 10.0. Exploited at planetary scale from Dec 2021. Listed in CISA KEV on 10 Dec 2021.
- Aliases
- Published
- Updated
What the bug is
Log4Shell is the public name for CVE-2021-44228 in Apache Log4j 2. Chen Zhaojun of Alibaba Cloud Security Team discovered it. Apache's security page rates it CVSS 3.1 10.0 CRITICAL.
JNDI features used in configurations, log messages, and parameters did not protect against attacker-controlled LDAP and other JNDI endpoints. An attacker who can control log messages or log message parameters can execute arbitrary code loaded from LDAP servers when message lookup substitution is enabled. Only the log4j-core JAR is impacted; log4j-api alone is not.
Apache lists affected versions as [2.0-beta9, 2.3.1) U [2.4, 2.12.2) U [2.13.0, 2.15.0), with initial fixes in 2.3.1, 2.12.2, and 2.15.0. Follow-on issues (CVE-2021-45046, CVE-2021-45105, CVE-2021-44832) led Apache to recommend 2.17.1 (Java 8+), 2.12.4 (Java 7), or 2.3.2 (Java 6) as the hardened line. Cloudflare later reported limited scanning as early as 1 Dec 2021, days before public disclosure.
Attack path
- Attacker-controlled stringA string containing a JNDI lookup reaches an application that logs it with Log4j 2.
- Message lookupLog4j expands the lookup and contacts an attacker-controlled naming service.
- Remote loadThe JVM may load and execute attacker-supplied code from that endpoint.
- Code execRemote code runs with the privileges of the logging process. Conceptual impact class only.
High-level only. Not a reproduction guide.
Exploitation status
CISA KEV
Listed in CISA KEV as of .
CISA KEV entry for CVE-2021-44228, Apache Log4j2 Remote Code Execution Vulnerability. dateAdded 2021-12-10. knownRansomwareCampaignUse Known.
First seen
Seen . Source: Cloudflare
Cloudflare reports three instances of attempted exploitation or scanning on 1 Dec 2021, including one at 04:36:50 UTC, before public disclosure.
What defenders should do today
Do today
- 1
Upgrade Log4j 2
Move to Apache's hardened releases: 2.17.1 or later (Java 8+), 2.12.4 (Java 7), or 2.3.2 (Java 6). Prefer removing the vulnerable log4j-core JAR over temporary JVM flags.
- 2
Inventory every Log4j 2 copy
Search application servers, fat JARs, containers, appliances, and vendor products. CISA points to CERT/CC scanners and file-based inventories for CVE-2021-44228.
This week
- 1
Block outbound JNDI-style callbacks where possible
Restrict egress from application hosts to unexpected LDAP, RMI, and DNS callback destinations while patching rolls out. This is interim only.
- 2
Hunt for post-exploitation
Microsoft observed coin miners, Cobalt Strike, reverse shells, and ransomware after successful exploitation. Review hosts that ran vulnerable Log4j for persistence and lateral movement.
Detection rules
Sigma
Log4j RCE CVE-2021-44228 Generic
title: Log4j RCE CVE-2021-44228 Generic id: 5ea8faa8-db8b-45be-89b0-151b84c82702 status: test description: Detects exploitation attempt against log4j RCE vulnerability reported as CVE-2021-44228 (Log4Shell) references: - https://web.archive.org/web/20231230220738/https://www.lunasec.io/docs/blog/log4j-zero-day/ - https://news.ycombinator.com/item?id=29504755 - https://github.com/tangxiaofeng7/apache-log4j-poc - https://gist.github.com/Neo23x0/e4c8b03ff8cdf1fa63b7d15db6e3860b - https://github.com/YfryTchsGD/Log4jAttackSurface - https://twitter.com/shutingrz/status/1469255861394866177?s=21 author: Florian Roth (Nextron Systems) date: 2021-12-10 modified: 2022-02-06 tags: - attack.initial-access - attack.t1190 - detection.emerging-threats logsource: category: webserver detection: keywords: - '${jndi:ldap:/' - '${jndi:rmi:/' - '${jndi:ldaps:/' - '${jndi:dns:/' - '/$%7bjndi:' - '%24%7bjndi:' - '$%7Bjndi:' - '%2524%257Bjndi' - '%2F%252524%25257Bjndi%3A' - '${jndi:${lower:' - '${::-j}${' - '${jndi:nis' - '${jndi:nds' - '${jndi:corba' - '${jndi:iiop' - 'Reference Class Name: foo' - '${${env:BARFOO:-j}' - '${::-l}${::-d}${::-a}${::-p}' - '${base64:JHtqbmRp' - '${${env:ENV_NAME:-j}ndi${env:ENV_NAME:-:}$' - '${${lower:j}ndi:' - '${${upper:j}ndi:' - '${${::-j}${::-n}${::-d}${::-i}:' filter: - 'w.nessus.org/nessus' - '/nessus}' condition: keywords and not filter falsepositives: - Vulnerability scanning level: highBy Florian Roth (Nextron Systems), . Source. License: DRL-1.1
Potential JNDI Injection Exploitation In JVM Based Application
title: Potential JNDI Injection Exploitation In JVM Based Application id: bb0e9cec-d4da-46f5-997f-22efc59f3dca status: test description: Detects potential JNDI Injection exploitation. Often coupled with Log4Shell exploitation. references: - https://www.wix.engineering/post/threat-and-vulnerability-hunting-with-application-server-error-logs - https://secariolabs.com/research/analysing-and-reproducing-poc-for-log4j-2-15-0 author: Moti Harmats date: 2023-02-11 tags: - attack.initial-access - attack.t1190 logsource: category: application product: jvm definition: 'Requirements: application error logs must be collected (with LOG_LEVEL=ERROR and above)' detection: keywords: - 'com.sun.jndi.ldap.' - 'org.apache.logging.log4j.core.net.JndiManager' condition: keywords falsepositives: - Application bugs level: highBy Moti Harmats, . Source. License: DRL-1.1
SPL (Splunk)
Log4Shell JNDI Payload Injection Attempt
| 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`By Jose Hernandez, . Source. License: Apache-2.0
Uses Splunk ES macros and data models from splunk/security_content; the trailing _filter macro is a tuning hook.
Outbound Network Connection from Java Using Default Ports
| tstats `security_content_summariesonly` count FROM datamodel=Endpoint.Processes WHERE Processes.process_name IN ( "java.exe", "javaw.exe" ) BY Processes.action Processes.dest Processes.original_file_name Processes.parent_process Processes.parent_process_exec Processes.parent_process_guid Processes.parent_process_id Processes.parent_process_name Processes.parent_process_path Processes.process Processes.process_exec Processes.process_guid Processes.process_hash Processes.process_id Processes.process_integrity_level Processes.process_name Processes.process_path Processes.user Processes.user_id Processes.vendor_product | `drop_dm_object_name(Processes)` | `security_content_ctime(firstTime)` | `security_content_ctime(lastTime)` | join process_id dest [ | tstats `security_content_summariesonly` count FROM datamodel=Network_Traffic.All_Traffic WHERE All_Traffic.dest_port IN ( 389, 636, 1099, 1389 ) BY All_Traffic.action All_Traffic.app All_Traffic.bytes All_Traffic.bytes_in All_Traffic.bytes_out All_Traffic.dest All_Traffic.dest_ip All_Traffic.dest_port All_Traffic.dvc All_Traffic.protocol All_Traffic.protocol_version All_Traffic.src All_Traffic.src_ip All_Traffic.src_port All_Traffic.transport All_Traffic.user All_Traffic.vendor_product All_Traffic.direction All_Traffic.process_id | `drop_dm_object_name(All_Traffic)` | rename dest as connection_to_CNC | rename src as dest ] | table _time dest parent_process_path parent_process_name parent_process process_path process_name process process_hash connection_to_CNC dest_port user | `outbound_network_connection_from_java_using_default_ports_filter`By Mauricio Velazco, Lou Stella, Splunk, . Source. License: Apache-2.0
Uses Splunk ES macros and data models from splunk/security_content; the trailing _filter macro is a tuning hook.
KQL (Microsoft Sentinel / Defender)
User agent search for log4j exploitation attempt
let UserAgentString = dynamic (["${jndi:ldap:/", "${jndi:rmi:/", "${jndi:ldaps:/", "${jndi:dns:/", "${jndi:iiop:/","${jndi:","${jndi:nds:/","${jndi:corba/"]); let UARegexMinimalString=dynamic(['{','%7b', '%7B']); let UARegex = @'(\\$|%24)(\\{|%7B)([^jJ]*[jJ])([^nN]*[nN])([^dD]*[dD])([^iI]*[iI])(:|%3A|\\$|%24|}|%7D)'; (union isfuzzy=true (OfficeActivity | where UserAgent has_any (UserAgentString) or UserAgent matches regex UARegex | summarize StartTime = min(TimeGenerated), EndTime = max(TimeGenerated) by UserAgent, SourceIP = ClientIP, Account = UserId, Type, Operation ), (AzureDiagnostics | where Category in ("FrontdoorWebApplicationFirewallLog", "FrontdoorAccessLog", "ApplicationGatewayFirewallLog", "ApplicationGatewayAccessLog") | where userAgent_s has_any (UserAgentString) or userAgent_s matches regex UARegex | summarize StartTime = min(TimeGenerated), EndTime = max(TimeGenerated) by UserAgent = userAgent_s, SourceIP = column_ifexists("clientIp_s",clientIP_s), Type, column_ifexists("originalHost_s",host_s), Url = requestUri_s, HttpStatus = column_ifexists("httpStatusDetails_s",httpStatus_d), column_ifexists("trackingReference_s",transactionId_g), ruleName_s, ResourceType, ResourceId ), ( W3CIISLog | where csUserAgent has_any (UserAgentString) or csUserAgent matches regex UARegex | summarize StartTime = min(TimeGenerated), EndTime = max(TimeGenerated) by UserAgent = csUserAgent, SourceIP = cIP, Account = csUserName, Type, sSiteName, csMethod, Url = csUriStem ), ( AWSCloudTrail | where UserAgent has_any (UserAgentString) or UserAgent matches regex UARegex | summarize StartTime = min(TimeGenerated), EndTime = max(TimeGenerated) by UserAgent, SourceIP = SourceIpAddress, Account = UserIdentityUserName, Type, EventName ), (SigninLogs | where UserAgent has_any (UserAgentString) or UserAgent matches regex UARegex | summarize StartTime = min(TimeGenerated), EndTime = max(TimeGenerated) by UserAgent, SourceIP = IPAddress, Account = UserPrincipalName, Type, Operation = OperationName, tostring(LocationDetails), tostring(DeviceDetail), AppDisplayName, ClientAppUsed ), (AADNonInteractiveUserSignInLogs | where UserAgent has_any (UserAgentString) or UserAgent matches regex UARegex | summarize StartTime = min(TimeGenerated), EndTime = max(TimeGenerated) by UserAgent, SourceIP = IPAddress, Account = UserPrincipalName, Type, Operation = OperationName, tostring(LocationDetails), tostring(DeviceDetail), AppDisplayName, ClientAppUsed ), (_Im_WebSession (httpuseragent_has_any=array_concat(UserAgentString,UARegexMinimalString)) | where HttpUserAgent has_any (UserAgentString) or HttpUserAgent matches regex UARegex | summarize StartTime = min(TimeGenerated), EndTime = max(TimeGenerated) by HttpUserAgent, SourceIP = SrcIpAddr, DstIpAddr, Account = SrcUsername, Url, Type ) )By Microsoft Sentinel community (Azure/Azure-Sentinel), . Source. License: MIT
LogScale (CrowdStrike)
Java process spawns a shell or downloader (Falcon)
#event_simpleName=ProcessRollup2 event_platform=Lin | ParentBaseFileName=java | FileName=/^(sh|bash|dash|curl|wget)$/i | groupBy([aid, ComputerName, FileName, CommandLine], limit=max)By vuln2shell, . Source. License: CC0 1.0
Written by vuln2shell. Untested, tune before use.
Falcon port of the child-process half of Elastic's Log4Shell-era Java service exploitation rule (no network sequence). Baseline Java apps that shell out.
ES|QL / EQL (Elastic)
Potential Java Service Exploitation via Suspicious Child Process
sequence by host.id with maxspan=5s [network where event.action == "connection_accepted" and network.direction == "ingress" and process.name : "java" and destination.port < 49152 and source.port >= 32768] by process.pid [process where event.type == "start" and /* Suspicious JAVA child process */ process.parent.name : "java" and process.name : ( "sh", "bash", "dash", "ksh", "tcsh", "zsh", "ash", "mksh", "busybox", "curl", "wget", "perl*", "python*", "ruby*", "php*", "lua*", "socat", "nc", "ncat", "netcat", "netcat.openbsd", "netcat.traditional", "nc.openbsd", "nc.traditional", "nohup", "setsid", "disown", "hostname", "whoami", "id" ) and not process.command_line like~ ( "bash -c ulimit -u", "bash /opt/flutter/bin/flutter*", "bash -c echo $$", "/bin/bash /opt/python3/bin/jira*", "/bin/sh -c env LC_ALL=C /usr/sbin/lpc status*" )] by process.parent.pid
Suricata / Snort
ET EXPLOIT Apache log4j RCE Attempt (http ldap) (CVE-2021-44228)
alert http any any -> [$HOME_NET,$HTTP_SERVERS] any (msg:"ET EXPLOIT Apache log4j RCE Attempt (http ldap) (CVE-2021-44228)"; flow:established,to_server; content:"|24 7b|jndi|3a|ldap|3a 2f 2f|"; nocase; fast_pattern; reference:url,lunasec.io/docs/blog/log4j-zero-day/; reference:cve,2021-44228; classtype:attempted-admin; sid:2034647; rev:1; metadata:attack_target Server, created_at 2021_12_10, cve CVE_2021_44228, deployment Perimeter, deployment Internal, confidence High, signature_severity Major, tag Exploit, tag CISA_KEV, updated_at 2021_12_10, mitre_tactic_id TA0001, mitre_tactic_name Initial_Access, mitre_technique_id T1190, mitre_technique_name Exploit_Public_Facing_Application;)By Emerging Threats (Proofpoint), . Source. License: BSD-3-Clause (ET Open, sids 2000000-2799999)
More detection content
- Microsoft: Guidance for preventing, detecting, and hunting for CVE-2021-44228
By Microsoft, . Many Defender and Sentinel queries.
- Florian Roth: Log4Shell detection gist (grep and regex)
By Florian Roth
- Splunk: Hunting for Log4Shell
By Splunk Threat Research Team
- Azure Sentinel: Malicious Connection to LDAP port for CVE-2021-44228
By Microsoft Sentinel community,
- signature-base: Log4j YARA rules
By Florian Roth,
- Cloudflare: Exploitation of Log4j before public disclosure and WAF evasion patterns
By Cloudflare,
Vendor signatures
| Signal | Log source | What to look for |
|---|---|---|
| Fortinet IPS / WAF signatures | WAF / IPS event logs | Fortinet released IPS signature Apache.Log4j.Error.Log.Remote.Code.Execution (VID 51006) in IPS package 19.215, plus web application signatures in database 0.00301 / 0.00305. |
Affected products
Products that share
Apache later published follow-on CVEs (45046, 45105, 44832). Prefer 2.17.1+ / 2.12.4 / 2.3.2 over the first 2.15.0 hotfix alone.
| Product | Status | Fixed version / ETA | Advisory | Notes |
|---|---|---|---|---|
| Network & security appliances2 | ||||
| Cisco products (multiple)Cisco | Affected | See cisco-sa-apache-log4j-qRuKNEbd | First Published: 2021 December 10 18:45 GMT. Critical Vulnerabilities in Apache Log4j Java Logging Library. | |
| FortiOS / FortiGateFortinet | Vendor stated not affected | Not stated | The following products are NOT impacted: FortiOS (includes FortiGate & FortiWiFi). Fortinet lists many other products as impacted or under investigation in FG-IR-21-245. | |
| CMS & applications4 | ||||
| Apache Log4j 2Apache Software Foundation | Affected | 2.17.1 / 2.12.4 / 2.3.2 | Versions affected [2.0-beta9, 2.3.1) U [2.4, 2.12.2) U [2.13.0, 2.15.0). JNDI lookup can be exploited to execute arbitrary code loaded from an LDAP server. | |
| Minecraft: Java EditionMojang / Microsoft | Affected | Patched launcher / 1.18.1; JVM flags for older servers | This exploit affects many services including Minecraft Java Edition. Versions below 1.7 are not affected. | |
| GhidraNSA | Affected | Ghidra 10.1 (includes Log4j 2.15.0) | Includes log4j 2.15.0 which addresses the issue. | |
| VMware products (multiple)VMware | Affected | See VMSA-2021-0028 response matrix | Critical vulnerabilities in Apache Log4j identified by CVE-2021-44228 and CVE-2021-45046 have been publicly disclosed which impact VMware products. | |
| Containers, cloud, CDN & hosting platforms1 | ||||
| Red Hat OpenShift Logging (Elasticsearch components)Red Hat | Affected | RHSA-2021:5127 through RHSA-2021:5137 (14 Dec 2021) | In Red Hat OpenShift Logging the vulnerable log4j library is shipped in the Elasticsearch components. | |
Timeline7
Key events
Newest first.
CISA issues Emergency Directive ED 22-02 for federal agencies.
SourceMicrosoft publishes hunting guidance and confirms coin miners, Cobalt Strike, ransomware, and nation-state use.
SourceNVD publishes CVE-2021-44228. CISA adds it to KEV the same day.
SourceCisco, VMware, Minecraft, and others publish product advisories.
SourcePublic PoC repositories such as kozmer/log4j-shell-poc appear on GitHub.
SourcePublic discussion of the Log4j 2 JNDI RCE begins; Cloudflare dates broad awareness to 9 Dec 2021.
SourceCloudflare observes limited scanning and attempted exploitation before public disclosure.
Source
Full timeline (7)
Fri 17 Dec 20211
CISA issues Emergency Directive ED 22-02 for federal agencies.
Source
Sat 11 Dec 20211
Microsoft publishes hunting guidance and confirms coin miners, Cobalt Strike, ransomware, and nation-state use.
Source
Fri 10 Dec 20213
Thu 9 Dec 20211
Public discussion of the Log4j 2 JNDI RCE begins; Cloudflare dates broad awareness to 9 Dec 2021.
Source
Wed 1 Dec 20211
Cloudflare observes limited scanning and attempted exploitation before public disclosure.
Source
News & write-ups
Research3
Vendor2
- Apache Log4j Security Vulnerabilities
Apache Logging Services
- VMSA-2021-0028
VMware
Government1
PoC index (for defenders)
Public proof-of-concept links for defensive validation, with a source and a validation status.
- log4j-shell-pocValidated
Public PoC repository created 10 Dec 2021. Description: A Proof-Of-Concept for the CVE-2021-44228 vulnerability.