// For flags

CVE-2022-25757

Apache APISIX: the body_schema check in request-validation plugin can be bypassed

Severity Score

9.8
*CVSS v3.1

Exploit Likelihood

*EPSS

Affected Versions

*CPE

Public Exploits

0
*Multiple Sources

Exploited in Wild

-
*KEV

Decision

-
*SSVC
Descriptions

In Apache APISIX before 2.13.0, when decoding JSON with duplicate keys, lua-cjson will choose the last occurred value as the result. By passing a JSON with a duplicate key, the attacker can bypass the body_schema validation in the request-validation plugin. For example, `{"string_payload":"bad","string_payload":"good"}` can be used to hide the "bad" input. Systems satisfy three conditions below are affected by this attack: 1. use body_schema validation in the request-validation plugin 2. upstream application uses a special JSON library that chooses the first occurred value, like jsoniter or gojay 3. upstream application does not validate the input anymore. The fix in APISIX is to re-encode the validated JSON input back into the request body at the side of APISIX. Improper Input Validation vulnerability in __COMPONENT__ of Apache APISIX allows an attacker to __IMPACT__. This issue affects Apache APISIX Apache APISIX version 2.12.1 and prior versions.

En Apache APISIX versiones anteriores a 2.13.0, cuando es decodificado JSON con claves duplicadas, lua-cjson elegirá como resultado el último valor ocurrido. Al pasar un JSON con una clave duplicada, el atacante puede omitir la comprobación body_schema en el plugin de comprobación de peticiones. Por ejemplo, "{"string_payload": "bad", "string_payload": "good"}" puede usarse para ocultar la entrada "bad". Los sistemas que cumplen las tres condiciones siguientes están afectados por este ataque: 1. usar la comprobación body_schema en el plugin de comprobación de peticiones 2. la aplicación upstream usa una librería JSON especial que elige el primer valor ocurrido, como jsoniter o gojay 3. la aplicación upstream ya no comprueba la entrada. La solución en APISIX es recodificar la entrada JSON comprobada en el cuerpo de la petición en el lado de APISIX. Una vulnerabilidad de comprobación de entrada inapropiada en __COMPONENT__ de Apache APISIX permite a un atacante __IMPACT__. Este problema afecta a Apache APISIX versiones 2.12.1 y anteriores

*Credits: Thanks for Guangli Dong from www.huoxian.cn
CVSS Scores
Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High
Attack Vector
Network
Attack Complexity
Medium
Authentication
None
Confidentiality
Partial
Integrity
Partial
Availability
Partial
* Common Vulnerability Scoring System
SSVC
  • Decision:-
Exploitation
-
Automatable
-
Tech. Impact
-
* Organization's Worst-case Scenario
Timeline
  • 2022-02-22 CVE Reserved
  • 2022-03-28 CVE Published
  • 2024-08-03 CVE Updated
  • 2024-11-01 EPSS Updated
  • ---------- Exploited in Wild
  • ---------- KEV Due Date
  • ---------- First Exploit
CWE
  • CWE-20: Improper Input Validation
CAPEC
Affected Vendors, Products, and Versions
Vendor Product Version Other Status
Vendor Product Version Other Status <-- --> Vendor Product Version Other Status
Apache
Search vendor "Apache"
Apisix
Search vendor "Apache" for product "Apisix"
< 2.13.0
Search vendor "Apache" for product "Apisix" and version " < 2.13.0"
-
Affected