Search

Find a vulnerability

Search criteria

    1 vulnerability found for Struts2 JSON by Apache

    GCVE-1988-2026-0479

    Vulnerability from gna-1988 – Published: 2026-11-02 07:30 – Updated: 2026-11-02 07:30
    VLAI
    Title
    Apache Struts2 JSON Plugin Insecure Deserialisation -- Object Deserialisation Element-Count Limit Bypass
    Summary
    As of the current versions of the Apache Struts2 JSON Plugin (e.g., version 7.4.0 and the 7.5.0 snapshot dated 28 October 2026), attackers can bypass the element-count limit purported to protect Object deserialisation added to said code as part of the WW-5618 and S2-072 "hardening controls". Please note that this vulnerability and the attack string is different than the previously reported bypass against the JSON array deserialisation, which was discussed in detail via "Continued Apache Struts2 JSON Plugin Insecure Deserialisation" (28 October 2026) and "Maximised JSON Array Attacks -- "Let the Commas Hit the Floor" Proof of Concept" (28 October 2026). Said previous discussions pertained strictly to bypassing protections on array deserialisation, with distinct code paths, mistakes, and attack strings. Description: The information system's JavaScript Object Notation (JSON) object parser enforces the `maxElements` resource limit by checking the size of the `HashMap` being populated rather than by counting the number of key-value pairs actually being parsed, so a payload consisting of entirely repeated keys never grows the map past a single entry while incurring both memory and compute costs. Impact: An attacker who can send a request body to any endpoint protected by a `JSONInterceptor` configured with a `maxElements` ceiling (including the default value) can construct a JSON object consisting of an arbitrarily large number of duplicate-key pairs -- for example, the same key repeated hundreds of thousands of times -- bounded only by the value of `struts.json.maxLength`, and have every pair be fully parsed, hashed, and boxed before the `maxElements` check ever has a chance to trip since `Map.put(Object, Object)` with an already-present key never increases the value `ret.size()`. Attackers can force disproportionate CPU and allocation work, memory usage (similar to that discussed in "Continued Apache Struts2 JSON Plugin Insecure Deserialisation" (28 October 2026) and "Maximised JSON Array Attacks -- "Let the Commas Hit the Floor" Proof of Concept" (28 October 2026)) with a single request and exhaust server resources across concurrent requests. For example, attackers can build a single object containing 262,143 String-Double key-value pairs (only limited by `struts.json.maxLength`, to a 2MB string), with a single request consuming over 46MB and taking ~37ms to parse and build on a pre-warmed system (assume 64-bit HotSpot JVM running with compressed oops and 8-byte alignment, which is a standard configuration). Making several concurrent requests of such a nature can quickly create denial of service conditions. Examples: Sample Vulnerable Code `StrutsJSONReader.object()` in the `struts2-json-plugin` module, enforces the `maxElements` ceiling by comparing the size of the `HashMap` being populated against the limit immediately before every `put(Object, Object)` call, as shown below. ```java protected Map<String, Object> object() throws JSONException { if (this.depth >= this.maxDepth) { throw new JSONException("JSON object nesting exceeds maximum allowed depth (" + this.maxDepth + "). Use " + JSONConstants.JSON_MAX_DEPTH + " to increase the limit."); } this.depth++; try { Map<String, Object> ret = new HashMap<>(); Object next = this.read(); if (next != OBJECT_END) { String key = (String) next; validateKeyLength(key); while (this.token != OBJECT_END) { this.read(); // should be a colon if (this.token != OBJECT_END) { if (ret.size() >= this.maxElements) { throw new JSONException("JSON object exceeds maximum allowed elements (" + this.maxElements + "). Use " + JSONConstants.JSON_MAX_ELEMENTS + " to increase the limit."); } ret.put(key, this.read()); if (this.read() == COMMA) { Object name = this.read(); if (name instanceof String nextKey) { key = nextKey; validateKeyLength(key); } else { throw buildInvalidInputException(); } } } } } return ret; } finally { this.depth--; } } ``` Code snippet from `struts-2-json-plugin`'s plugins/json/src/main/java/org/apache/struts2/json/StrutsJSONReader.java, lines 156-196 Importantly, attackers can further couple this with the previously disclosed Apache Struts2 JSON Plugin `maxElements` bypass in the `array()` method in the same class (please see the aforementioned Full Disclosure postings for details). While attackers can choose from a variety of Objects, `Double` is the most damaging for this particular attack since they incur the cost of building and boxing/unboxing and are never cached (unlike `Long` and `String` objects). _______________________________________________ Sent through the Full Disclosure mailing list https://nmap.org/mailman/listinfo/fulldisclosure Web Archives & RSS: https://seclists.org/fulldisclosure/
    Severity
    No CVSS data available.
    Assigner
    VULNARCHIVE GNA GNA-1988
    GNA scorecard E 38/100 over 581 records in the last 180 days details
    Impacted products
    Vendor Product Version
    Apache Struts2 JSON Affected: unknown
    Create a notification for this product.

    {
      "containers": {
        "cna": {
          "affected": [
            {
              "product": "Struts2 JSON",
              "vendor": "Apache",
              "versions": [
                {
                  "status": "affected",
                  "version": "unknown"
                }
              ]
            }
          ],
          "credits": [
            {
              "lang": "en",
              "type": "finder",
              "value": "Daniel Owens via Fulldisclosure"
            }
          ],
          "descriptions": [
            {
              "lang": "en",
              "value": "As of the current versions of the Apache Struts2 JSON Plugin (e.g., version 7.4.0 and the 7.5.0 snapshot dated 28 \nOctober 2026), attackers can bypass the element-count limit purported to protect Object deserialisation added to said \ncode as part of the WW-5618 and S2-072 \"hardening controls\".  Please note that this vulnerability and the attack string \nis different than the previously reported bypass against the JSON array deserialisation, which was discussed in detail \nvia \"Continued Apache Struts2 JSON Plugin Insecure Deserialisation\" (28 October 2026) and \"Maximised JSON Array Attacks \n-- \"Let the Commas Hit the Floor\" Proof of Concept\" (28 October 2026).  Said previous discussions pertained strictly to \nbypassing protections on array deserialisation, with distinct code paths, mistakes, and attack strings.\n\nDescription:\nThe information system\u0027s JavaScript Object Notation (JSON) object parser enforces the `maxElements` resource limit by \nchecking the size of the `HashMap` being populated rather than by counting the number of key-value pairs actually being \nparsed, so a payload consisting of entirely repeated keys never grows the map past a single entry while incurring both \nmemory and compute costs.\n\nImpact:\nAn attacker who can send a request body to any endpoint protected by a `JSONInterceptor` configured with a \n`maxElements` ceiling (including the default value) can construct a JSON object consisting of an arbitrarily large \nnumber of duplicate-key pairs -- for example, the same key repeated hundreds of thousands of times -- bounded only by \nthe value of `struts.json.maxLength`, and have every pair be fully parsed, hashed, and boxed before the `maxElements` \ncheck ever has a chance to trip since `Map.put(Object, Object)` with an already-present key never increases the value \n`ret.size()`.\n\n\nAttackers can force disproportionate CPU and allocation work, memory usage (similar to that discussed in \"Continued \nApache Struts2 JSON Plugin Insecure Deserialisation\" (28 October 2026) and \"Maximised JSON Array Attacks -- \"Let the \nCommas Hit the Floor\" Proof of Concept\" (28 October 2026)) with a single request and exhaust server resources across \nconcurrent requests.  For example, attackers can build a single object containing 262,143 String-Double key-value pairs \n(only limited by `struts.json.maxLength`, to a 2MB string), with a single request consuming over 46MB and taking ~37ms \nto parse and build on a pre-warmed system (assume 64-bit HotSpot JVM running with compressed oops and 8-byte alignment, \nwhich is a standard configuration).  Making several concurrent requests of such a nature can quickly create denial of \nservice conditions.\n\n\n\nExamples:\n\nSample Vulnerable Code\n\n`StrutsJSONReader.object()` in the `struts2-json-plugin` module, enforces the `maxElements` ceiling by comparing the \nsize of the `HashMap` being populated against the limit immediately before every `put(Object, Object)` call, as shown \nbelow.\n\n\n\n```java\n\n    protected Map\u003cString, Object\u003e object() throws JSONException {\n\n        if (this.depth \u003e= this.maxDepth) {\n\n            throw new JSONException(\"JSON object nesting exceeds maximum allowed depth (\"\n\n                    + this.maxDepth + \"). Use \" + JSONConstants.JSON_MAX_DEPTH + \" to increase the limit.\");\n\n        }\n\n        this.depth++;\n\n        try {\n\n            Map\u003cString, Object\u003e ret = new HashMap\u003c\u003e();\n\n            Object next = this.read();\n\n            if (next != OBJECT_END) {\n\n                String key = (String) next;\n\n                validateKeyLength(key);\n\n                while (this.token != OBJECT_END) {\n\n                    this.read(); // should be a colon\n\n\n\n                    if (this.token != OBJECT_END) {\n\n                        if (ret.size() \u003e= this.maxElements) {\n\n                            throw new JSONException(\"JSON object exceeds maximum allowed elements (\"\n\n                                    + this.maxElements + \"). Use \" + JSONConstants.JSON_MAX_ELEMENTS + \" to increase \nthe limit.\");\n\n                        }\n\n                        ret.put(key, this.read());\n\n\n\n                        if (this.read() == COMMA) {\n\n                            Object name = this.read();\n\n\n\n                            if (name instanceof String nextKey) {\n\n                                key = nextKey;\n\n                                validateKeyLength(key);\n\n                            } else {\n\n                                throw buildInvalidInputException();\n\n                            }\n\n                        }\n\n                    }\n\n                }\n\n            }\n\n\n\n            return ret;\n\n        } finally {\n\n            this.depth--;\n\n        }\n\n    }\n\n```\n\nCode snippet from `struts-2-json-plugin`\u0027s plugins/json/src/main/java/org/apache/struts2/json/StrutsJSONReader.java, \nlines 156-196\n\n\n\nImportantly, attackers can further couple this with the previously disclosed Apache Struts2 JSON Plugin `maxElements` \nbypass in the `array()` method in the same class (please see the aforementioned Full Disclosure postings for details).  \nWhile attackers can choose from a variety of Objects, `Double` is the most damaging for this particular attack since \nthey incur the cost of building and boxing/unboxing and are never cached (unlike `Long` and `String` objects).\n_______________________________________________\nSent through the Full Disclosure mailing list\nhttps://nmap.org/mailman/listinfo/fulldisclosure\nWeb Archives \u0026 RSS: https://seclists.org/fulldisclosure/"
            }
          ],
          "providerMetadata": {
            "dateUpdated": "2026-11-02T07:30:01Z",
            "orgId": "4e2abfbf-4a2a-4b76-a4e0-d77c18ba156c",
            "shortName": "VULNARCHIVE"
          },
          "references": [
            {
              "tags": [
                "technical-description",
                "exploit"
              ],
              "url": "https://vuln.freearchive.org/archive/full-disclosure/2026/Nov/0"
            },
            {
              "tags": [
                "technical-description"
              ],
              "url": "https://seclists.org/fulldisclosure/2026/Nov/0"
            },
            {
              "url": "https://nmap.org/mailman/listinfo/fulldisclosure"
            },
            {
              "url": "https://seclists.org/fulldisclosure/"
            }
          ],
          "source": {
            "defect": [
              "https://seclists.org/fulldisclosure/2026/Nov/0"
            ],
            "discovery": "EXTERNAL"
          },
          "title": "Apache Struts2 JSON Plugin Insecure Deserialisation -- Object Deserialisation Element-Count Limit Bypass",
          "x_gcve": [
            {
              "recordType": "advisory",
              "relationships": [],
              "vulnId": "GCVE-1988-2026-0479",
              "x_vulnarchive": {
                "archiveUrl": "https://vuln.freearchive.org/archive/full-disclosure/2026/Nov/0",
                "automated": true,
                "contentSha256": "de00da61dd4c2dcab26d627c86f18ebc2fce3a5d9a9d59656bfc83d0613f2adb",
                "evidenceScore": 9,
                "messageId": "",
                "originalUrl": "https://seclists.org/fulldisclosure/2026/Nov/0",
                "policy": "vulnarchive-1",
                "sourceFormat": "text/html",
                "sourcePublishedAt": "2026-10-29T11:16:48Z"
              }
            }
          ]
        }
      },
      "cveMetadata": {
        "assignerOrgId": "4e2abfbf-4a2a-4b76-a4e0-d77c18ba156c",
        "assignerShortName": "VULNARCHIVE",
        "datePublished": "2026-11-02T07:30:01Z",
        "dateUpdated": "2026-11-02T07:30:01Z",
        "state": "PUBLISHED",
        "vulnId": "GCVE-1988-2026-0479"
      },
      "dataType": "CVE_RECORD",
      "dataVersion": "5.2"
    }