CVE-2026-27212: Swiper Prototype Pollution Vulnerability

CRITICAL
Advisory Identifier: GHSA-hmx5-qpq5-p643
CWE-1321
Published
Advisory Summary

CVE-2026-27212 is a CRITICAL prototype pollution vulnerability (CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')) affecting Swiper libraries in the npm ecosystem. The issue involves prototype pollution in swiper. Remediation is available by upgrading affected packages to version 12.1.2.

CVE-2026-27212 at a Glance

CVE Identifier CVE-2026-27212
GHSA Identifier GHSA-hmx5-qpq5-p643
Severity CRITICAL
CVSS v3.1 Base Score N/A
CWE Classification CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')
Affected Product Swiper
Package Ecosystem npm
Published Date
Last Updated

How to Fix CVE-2026-27212

To remediate this vulnerability, upgrade all affected Swiper dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

swiper fixed: 12.1.2
npm install swiper@12.1.2
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls swiper

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-27212, inspect your project dependencies using npm:

npm ls swiper

Analyze the terminal output to locate any version of Swiper in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 12.1.2), your application is affected.

Note: The npm ls swiper command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution'), where the product receives input from an upstream component that specifies attributes that are to be initialized or updated in an object, but it does not properly control modifications of attributes of the object prototype. In Swiper, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary A prototype pollution vulnerability exists in the the npm package swiper (>=6.5.1, < 12.1.2). Despite a previous fix that attempted to mitigate prototype pollution by checking whether user input contained a forbidden key, it is still possible to pollute `Object.prototype` via a crafted input using Array.prototype. The exploit works across Windows and Linux and on Node and Bun runtimes. This issue is fixed in version 12.1.2 ### Details The vulnerability resides in line 94 of shared/utils.mjs where indexOf() function is used to check whether user provided input contain forbidden strings. ### PoC #### Steps to reproduce 1. Install latest version of swiper using npm install 2. Run the following code snippet: ```javascript var swiper = require('swiper'); Array.prototype.indexOf = () => -1; let obj = {}; var malicious_payload = '{"__proto__":{"polluted":"yes"}}'; console.log({}.polluted); swiper.default.extendDefaults(JSON.parse(malicious_payload)); console.log({}.polluted); // prints yes -> indicating that the patch was bypassed and prototype pollution occurred ``` #### Expected behavior Prototype pollution should be prevented and {} should not gain new properties. This should be printed on the console: ``` undefined undefined OR throw an Error ``` #### Actual behavior Object.prototype is polluted This is printed on the console: ``` undefined yes ``` ### Impact This is a prototype pollution vulnerability, which can have severe security implications depending on how swiper is used by downstream applications. Any application that processes attacker-controlled input using this package may be affected. It could potentially lead to the following problems: 1. Authentication bypass 2. Denial of service - Even if an attacker is not able to exploit prototype pollution in swiper, if there is a prototype pollution within the project from other dependencies, modifying global `Array.prototype.indexOf` property can result in crash when swiper.default.extendDefaults is called because swiper makes use of this global property. This can lead to Denial of Service. 3. Remote code execution (if polluted property is passed to sinks like eval or child_process) ### Related CVEs [CVE-2026-25521](https://github.com/advisories/GHSA-rxrv-835q-v5mh) [CVE-2026-25047](https://github.com/advisories/GHSA-2733-6c58-pf27) [CVE-2026-26021](https://github.com/advisories/GHSA-2c4m-g7rx-63q7)

CVE-2026-27212 Affected Swiper Versions

1 component(s)
Fixed Versions:
12.1.2
Product / Package Ecosystem Affected Versions Fixed Version
swiper
npm
≥ 6.5.1
< 12.1.2
12.1.2

References

Frequently Asked Questions

What is CVE-2026-27212?
CVE-2026-27212 is a security vulnerability in Swiper involving Prototype pollution in swiper under CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution').
Which Swiper versions are affected?
Affected versions include releases prior to 12.1.2 across affected packages: swiper.
What version fixes CVE-2026-27212?
Upgrading to 12.1.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is swiper affected?
Yes, swiper is affected in releases prior to 12.1.2. Upgrade your dependency to 12.1.2 or later.
What CWE is associated with CVE-2026-27212?
CVE-2026-27212 is classified under CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution') (The product receives input from an upstream component that specifies attributes that are to be initialized or updated in an object, but it does not properly control modifications of attributes of the object prototype.).
How can I check npm dependencies for CVE-2026-27212?
Run the dependency tree command: 'npm ls swiper'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-hmx5-qpq5-p643",
  "modified" : "2026-02-23T22:27:46Z",
  "published" : "2026-02-19T20:28:35Z",
  "aliases" : [ "CVE-2026-27212" ],
  "summary" : "Prototype pollution in swiper",
  "details" : "### Summary\nA prototype pollution vulnerability exists in the the npm package swiper (>=6.5.1, < 12.1.2). Despite a previous fix that attempted to mitigate prototype pollution by checking whether user input contained a forbidden key, it is still possible to pollute `Object.prototype` via a crafted input using Array.prototype. The exploit works across Windows and Linux and on Node and Bun runtimes. This issue is fixed in version 12.1.2\n\n### Details\nThe vulnerability resides in line 94 of shared/utils.mjs where indexOf() function is used to check whether user provided input contain forbidden strings.\n\n### PoC\n#### Steps to reproduce\n1. Install latest version of swiper using npm install \n2. Run the following code snippet:\n```javascript\nvar swiper = require('swiper');\nArray.prototype.indexOf = () => -1;        \nlet obj = {};\nvar malicious_payload = '{\"__proto__\":{\"polluted\":\"yes\"}}';\nconsole.log({}.polluted);\nswiper.default.extendDefaults(JSON.parse(malicious_payload));\nconsole.log({}.polluted);  // prints yes -> indicating that the patch was bypassed and prototype pollution occurred\n```\n\n#### Expected behavior\nPrototype pollution should be prevented and {} should not gain new properties.\nThis should be printed on the console:\n```\nundefined\nundefined OR throw an Error\n```\n\n#### Actual behavior\nObject.prototype is polluted\nThis is printed on the console:\n```\nundefined \nyes\n```\n\n### Impact\nThis is a prototype pollution vulnerability, which can have severe security implications depending on how swiper is used by downstream applications. Any application that processes attacker-controlled input using this package may be affected.\nIt could potentially lead to the following problems:\n1. Authentication bypass\n2. Denial of service - Even if an attacker is not able to exploit prototype pollution in swiper, if there is a prototype pollution within the project from other dependencies, modifying global `Array.prototype.indexOf` property can result in crash when swiper.default.extendDefaults is called because swiper makes use of this global property. This can lead to Denial of Service.  \n3. Remote code execution (if polluted property is passed to sinks like eval or child_process)\n\n### Related CVEs\n[CVE-2026-25521](https://github.com/advisories/GHSA-rxrv-835q-v5mh)\n[CVE-2026-25047](https://github.com/advisories/GHSA-2733-6c58-pf27)\n[CVE-2026-26021](https://github.com/advisories/GHSA-2c4m-g7rx-63q7)",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "swiper"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "6.5.1"
      }, {
        "fixed" : "12.1.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/nolimits4web/swiper/security/advisories/GHSA-hmx5-qpq5-p643"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-27212"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nolimits4web/swiper/commit/d3e663322a13043ca63aaba235d8cf3900e0c8cf"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/nolimits4web/swiper"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nolimits4web/swiper/releases/tag/v12.1.2"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1321" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-02-19T20:28:35Z",
    "nvd_published_at" : "2026-02-21T06:17:01Z"
  }
}