{
  "containers": {
    "cna": {
      "affected": [
        {
          "product": "Apache APISIX",
          "vendor": "Apache Software Foundation",
          "versions": [
            {
              "lessThanOrEqual": "2.12.1",
              "status": "affected",
              "version": "Apache APISIX",
              "versionType": "custom"
            }
          ]
        }
      ],
      "credits": [
        {
          "lang": "en",
          "value": "Thanks for Guangli Dong from www.huoxian.cn"
        }
      ],
      "descriptions": [
        {
          "lang": "en",
          "value": "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.\n\nSystems satisfy three conditions below are affected by this attack:\n1. use body_schema validation in the request-validation plugin\n2. upstream application uses a special JSON library that chooses the first occurred value, like jsoniter or gojay\n3. upstream application does not validate the input anymore.\n\nThe fix in APISIX is to re-encode the validated JSON input back into the request body at the side of APISIX."
        },
        {
          "lang": "en",
          "value": "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."
        }
      ],
      "metrics": [
        {
          "other": {
            "content": {
              "other": "low"
            },
            "type": "unknown"
          }
        }
      ],
      "problemTypes": [
        {
          "descriptions": [
            {
              "cweId": "CWE-20",
              "description": "CWE-20 Improper Input Validation",
              "lang": "en",
              "type": "CWE"
            }
          ]
        }
      ],
      "providerMetadata": {
        "orgId": "Not found",
        "shortName": "Not found"
      },
      "references": [
        {
          "tags": [
            "x_refsource_CONFIRM"
          ],
          "url": "https://lists.apache.org/thread/03vd2j81krxmpz6xo8p1dl642flpo6fv"
        }
      ],
      "source": {
        "discovery": "UNKNOWN"
      },
      "title": "Apache APISIX: the body_schema check in request-validation plugin can be bypassed",
      "workarounds": [
        {
          "lang": "en",
          "value": "1. upgrade APISIX to 2.13.0 if you need to use the body_schema validation in the request-validation plugin\n2. add additional validation in the application code, embrace defensive programming"
        }
      ],
      "x_ValidationErrors": [
        "$.cveMetadata.assignerOrgId -- validator = pattern",
        "$.containers.cna.providerMetadata.orgId -- validator = pattern"
      ],
      "x_generator": {
        "engine": "Vulnogram 0.0.9"
      },
      "x_legacyV4Record": {
        "CNA_private": {
          "CVE_list": [],
          "CVE_table_description": [],
          "email": "",
          "emailed": "",
          "internal_comments": "",
          "owner": "apisix",
          "publish": {
            "month": "",
            "year": "",
            "ym": ""
          },
          "share_with_CVE": true,
          "todo": [],
          "userslist": "dev@apisix.apache.org"
        },
        "CVE_data_meta": {
          "AKA": "",
          "ASSIGNER": "security@apache.org",
          "DATE_PUBLIC": "",
          "ID": "CVE-2022-25757",
          "STATE": "PUBLIC",
          "TITLE": "Apache APISIX: the body_schema check in request-validation plugin can be bypassed"
        },
        "affects": {
          "vendor": {
            "vendor_data": [
              {
                "product": {
                  "product_data": [
                    {
                      "product_name": "Apache APISIX",
                      "version": {
                        "version_data": [
                          {
                            "platform": "",
                            "version_affected": "<=",
                            "version_name": "Apache APISIX",
                            "version_value": "2.12.1"
                          }
                        ]
                      }
                    }
                  ]
                },
                "vendor_name": "Apache Software Foundation"
              }
            ]
          }
        },
        "configuration": [],
        "credit": [
          {
            "lang": "eng",
            "value": "Thanks for Guangli Dong from www.huoxian.cn"
          }
        ],
        "data_format": "MITRE",
        "data_type": "CVE",
        "data_version": "4.0",
        "description": {
          "description_data": [
            {
              "lang": "eng",
              "value": "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.\n\nSystems satisfy three conditions below are affected by this attack:\n1. use body_schema validation in the request-validation plugin\n2. upstream application uses a special JSON library that chooses the first occurred value, like jsoniter or gojay\n3. upstream application does not validate the input anymore.\n\nThe fix in APISIX is to re-encode the validated JSON input back into the request body at the side of APISIX."
            },
            {
              "lang": "eng",
              "value": "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."
            }
          ]
        },
        "exploit": [],
        "generator": {
          "engine": "Vulnogram 0.0.9"
        },
        "impact": [
          {
            "other": "low"
          }
        ],
        "problemtype": {
          "problemtype_data": [
            {
              "description": [
                {
                  "lang": "eng",
                  "value": "CWE-20 Improper Input Validation"
                }
              ]
            }
          ]
        },
        "references": {
          "reference_data": [
            {
              "name": "",
              "refsource": "CONFIRM",
              "url": "https://lists.apache.org/thread/03vd2j81krxmpz6xo8p1dl642flpo6fv"
            }
          ]
        },
        "solution": [],
        "source": {
          "advisory": "",
          "defect": [],
          "discovery": "UNKNOWN"
        },
        "timeline": [],
        "work_around": [
          {
            "lang": "en",
            "value": "1. upgrade APISIX to 2.13.0 if you need to use the body_schema validation in the request-validation plugin\n2. add additional validation in the application code, embrace defensive programming"
          }
        ]
      }
    }
  },
  "cveMetadata": {
    "assignerOrgId": "Not found",
    "assignerShortName": "Not found",
    "cveId": "CVE-2022-25757",
    "state": "PUBLISHED"
  },
  "dataType": "CVE_RECORD",
  "dataVersion": "5.0"
}