Skip to content
Heist/ feed
Back to feed
Medium

qs.stringify with allowEmptyArrays does not encode the keys of empty arrays, allowing query string parameter injection

Type: advisorySources: Official CVE List

### Summary `qs.stringify` with `allowEmptyArrays: true` writes the key of an empty array without encoding it, even though keys are encoded by default. A key that contains `&` (or the configured `delimiter`), `=`, or `#` therefore becomes query string syntax instead of data, so a caller-supplied key name can add parameters to the serialized query string, or cut it short. ### Details In `lib/stringify.js`, the `allowEmptyArrays` branch returns `adjustedPrefix + '[]'` early, before the code that passes every other key through `encoder` and `formatter`. So `{ "x&k=v": ["1"] }` serializes as `x%26k%3Dv%5B0%5D=1`, but `{ "x&k=v": [] }` serializes as `x&k=v[]`. The early return applies at any depth (`{ "a": { "b&k=v": [] } }` gives `a[b&k=v][]`), under every `arrayFormat`, with `allowDots`, and with a custom `encoder`, which is never called for that key. With `encode: false` or `encodeValuesOnly: true`, keys are intentionally left unencoded on every path; those configurations are not affected. #### PoC ```js var qs = require("qs"); var query = qs.stringify({ q: "hi", "x&apiKey=evil&y": [] }, { allowEmptyArrays: true }); // "q=hi&x&apiKey=evil&y[]" qs.parse(query); // { q: "hi", x: "", apiKey: "evil", y: [""] } qs.stringify({ "x#": [], z: "1" }, { allowEmptyArrays: true }); // "x#[]&z=1": in a URL, everything after "#" becomes the fragment ``` #### Fix Applied in 234d505 on `main` and released as v6.17.0, and backported to v6.16.2, v6.15.4, v6.14.3, v6.13.4, and v6.12.6: the key of

Products
qs
Affected versions
Not specified
Fixed versions
Not specified
CVEs
CVE-2026-110910
Confirmed fixed CVEs
Not specified
Updated in this feed
31 Oct 2026, 15:41 UTC · Revision 1

Source evidence

qs.stringify with allowEmptyArrays does not encode the keys of empty arrays, allowing query string parameter injection

core-cve · Original source

Published 27 Oct 2026, 06:42 UTC

### Summary `qs.stringify` with `allowEmptyArrays: true` writes the key of an empty array without encoding it, even though keys are encoded by default. A key that contains `&` (or the configured `delimiter`), `=`, or `#` therefore becomes query string syntax instead of data, so a caller-supplied key name can add parameters to the serialized query string, or cut it short. ### Details In `lib/stringify.js`, the `allowEmptyArrays` branch returns `adjustedPrefix + '[]'` early, before the code that passes every other key through `encoder` and `formatter`. So `{ "x&k=v": ["1"] }` serializes as `x%26k%3Dv%5B0%5D=1`, but `{ "x&k=v": [] }` serializes as `x&k=v[]`. The early return applies at any depth (`{ "a": { "b&k=v": [] } }` gives `a[b&k=v][]`), under every `arrayFormat`, with `allowDots`, and with a custom `encoder`, which is never called for that key. With `encode: false` or `encodeValuesOnly: true`, keys are intentionally left unencoded on every path; those configurations are not affected. #### PoC ```js var qs = require("qs"); var query = qs.stringify({ q: "hi", "x&apiKey=evil&y": [] }, { allowEmptyArrays: true }); // "q=hi&x&apiKey=evil&y[]" qs.parse(query); // { q: "hi", x: "", apiKey: "evil", y: [""] } qs.stringify({ "x#": [], z: "1" }, { allowEmptyArrays: true }); // "x#[]&z=1": in a URL, everything after "#" becomes the fragment ``` #### Fix Applied in 234d505 on `main` and released as v6.17.0, and backported to v6.16.2, v6.15.4, v6.14.3, v6.13.4, and v6.12.6: the key of

cve:CVE-2026-110910

qs

Fixed versions: Not specified

Complete source record
{
  "id": "ba313e2f8b851cb4cf455bfeeff8ba30b6336cd52d9733532e8222b30a261547",
  "url": "https://www.cve.org/CVERecord?id=CVE-2026-110910",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "qs.stringify with allowEmptyArrays does not encode the keys of empty arrays, allowing query string parameter injection",
    "summary": "### Summary `qs.stringify` with `allowEmptyArrays: true` writes the key of an empty array without encoding it, even though keys are encoded by default. A key that contains `&` (or the configured `delimiter`), `=`, or `#` therefore becomes query string syntax instead of data, so a caller-supplied key name can add parameters to the serialized query string, or cut it short. ### Details In `lib/stringify.js`, the `allowEmptyArrays` branch returns `adjustedPrefix + '[]'` early, before the code that passes every other key through `encoder` and `formatter`. So `{ \"x&k=v\": [\"1\"] }` serializes as `x%26k%3Dv%5B0%5D=1`, but `{ \"x&k=v\": [] }` serializes as `x&k=v[]`. The early return applies at any depth (`{ \"a\": { \"b&k=v\": [] } }` gives `a[b&k=v][]`), under every `arrayFormat`, with `allowDots`, and with a custom `encoder`, which is never called for that key. With `encode: false` or `encodeValuesOnly: true`, keys are intentionally left unencoded on every path; those configurations are not affected. #### PoC ```js var qs = require(\"qs\"); var query = qs.stringify({ q: \"hi\", \"x&apiKey=evil&y\": [] }, { allowEmptyArrays: true }); // \"q=hi&x&apiKey=evil&y[]\" qs.parse(query); // { q: \"hi\", x: \"\", apiKey: \"evil\", y: [\"\"] } qs.stringify({ \"x#\": [], z: \"1\" }, { allowEmptyArrays: true }); // \"x#[]&z=1\": in a URL, everything after \"#\" becomes the fragment ``` #### Fix Applied in 234d505 on `main` and released as v6.17.0, and backported to v6.16.2, v6.15.4, v6.14.3, v6.13.4, and v6.12.6: the key of ",
    "evidence": "cve:CVE-2026-110910",
    "products": [
      {
        "name": {
          "value": "qs",
          "evidence": "/containers/cna/affected/0/product"
        },
        "prerequisites": [],
        "fixed_versions": [],
        "affected_versions": []
      }
    ],
    "severity": "medium",
    "structured": {
      "id": "CVE-2026-110910",
      "aliases": [
        "CVE-2026-110910"
      ],
      "metrics": [
        {
          "format": "CVSS",
          "cvssV3_1": {
            "scope": "UNCHANGED",
            "version": "3.1",
            "baseScore": 3.7,
            "attackVector": "NETWORK",
            "baseSeverity": "LOW",
            "vectorString": "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:N",
            "integrityImpact": "LOW",
            "userInteraction": "NONE",
            "attackComplexity": "HIGH",
            "availabilityImpact": "NONE",
            "privilegesRequired": "NONE",
            "confidentialityImpact": "NONE"
          },
          "scenarios": [
            {
              "lang": "en",
              "value": "GENERAL"
            }
          ]
        },
        {
          "format": "CVSS",
          "cvssV4_0": {
            "Safety": "NOT_DEFINED",
            "version": "4.0",
            "Recovery": "NOT_DEFINED",
            "baseScore": 6.3,
            "Automatable": "NOT_DEFINED",
            "attackVector": "NETWORK",
            "baseSeverity": "MEDIUM",
            "valueDensity": "NOT_DEFINED",
            "vectorString": "CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N",
            "exploitMaturity": "NOT_DEFINED",
            "providerUrgency": "NOT_DEFINED",
            "userInteraction": "NONE",
            "attackComplexity": "LOW",
            "attackRequirements": "PRESENT",
            "privilegesRequired": "NONE",
            "subIntegrityImpact": "NONE",
            "vulnIntegrityImpact": "LOW",
            "subAvailabilityImpact": "NONE",
            "vulnAvailabilityImpact": "NONE",
            "subConfidentialityImpact": "NONE",
            "vulnConfidentialityImpact": "NONE",
            "vulnerabilityResponseEffort": "NOT_DEFINED"
          },
          "scenarios": [
            {
              "lang": "en",
              "value": "GENERAL"
            }
          ]
        }
      ],
      "affected": [
        {
          "repo": "https://github.com/ljharb/qs",
          "vendor": "ljharb",
          "product": "qs",
          "versions": [
            {
              "status": "affected",
              "version": "6.12.0",
              "lessThan": "6.12.6",
              "versionType": "semver"
            },
            {
              "status": "affected",
              "version": "6.13.0",
              "lessThan": "6.13.4",
              "versionType": "semver"
            },
            {
              "status": "affected",
              "version": "6.14.0",
              "lessThan": "6.14.3",
              "versionType": "semver"
            },
            {
              "status": "affected",
              "version": "6.15.0",
              "lessThan": "6.15.4",
              "versionType": "semver"
            },
            {
              "status": "affected",
              "version": "6.16.0",
              "lessThan": "6.16.2",
              "versionType": "semver"
            }
          ],
          "packageName": "qs",
          "collectionURL": "https://npmjs.com/qs",
          "defaultStatus": "unaffected"
        }
      ],
      "modified": "2026-10-27T19:32:36.456Z",
      "provider": "cve",
      "references": [
        "https://github.com/ljharb/qs/security/advisories/GHSA-w4cr-vjpx-p82q",
        "https://github.com/ljharb/qs/commit/234d5051f5071efaa025a7ca9e4d34a56a460a1b",
        "https://github.com/ljharb/qs/commit/6b8bf1a53d7b0c5e7e434eaae8e2c0cffd5c2492",
        "https://github.com/ljharb/qs/commit/033526fc82f2e80a3d896df2bce9137e34cb5dc5",
        "https://github.com/ljharb/qs/commit/f9dd4830cb922363822cdfdca2cceb3ed9792224",
        "https://github.com/ljharb/qs/commit/ad445aa23e4c3a97394c3b9a5f9d7a7159eb1f17",
        "https://github.com/ljharb/qs/commit/5d3b1b9ec6afd0cfc760c8e12862873789a32fc8",
        "https://github.com/ljharb/qs/pull/561",
        "https://github.com/ljharb/qs/issues/626"
      ],
      "provider_metadata": {
        "cna": {
          "orgId": "7ffcee3d-2c14-4c3e-b844-86c6a321a158",
          "shortName": "harborist",
          "dateUpdated": "2026-10-27T19:32:36.456Z"
        }
      }
    },
    "related_cves": [
      {
        "value": "CVE-2026-110910",
        "evidence": "/cveMetadata/cveId"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/containers/cna/metrics"
  },
  "source_id": "core-cve",
  "document_id": 398110,
  "published_at": "2026-10-27T06:42:42.365+00:00"
}