Skip to content

CVE-2026-27212: Verified Repro With Script Download

CVE-2026-27212: Swiper Prototype Pollution

CVE-2026-27212 is verified against swiper · npm. Affected versions: >= 6.5.1, < 12.1.2. Fixed in 12.1.2. Vulnerability class: Prototype Pollution. This high reproduction includes runnable sandbox proof, artifacts, and a plain-text agent view under REPRO-2026-00107.

REPRO-2026-00107 swiper · npm Prototype Pollution Feb 20, 2026 CVE entry ↗ .txt
Severity
HIGH
CVSS
7.8
Reproduced in
10m 21s
Tool calls
87
Spend
$0.43
01 · Overview

What Is CVE-2026-27212?

CVE-2026-27212 is a critical prototype pollution vulnerability (CWE-1321) in the Swiper npm package that lets an attacker pollute Object.prototype despite a previous mitigation attempt. Pruva reproduced it (reproduction REPRO-2026-00107).

02 · Severity & CVSS

CVE-2026-27212 Severity & CVSS Score

CVE-2026-27212 is rated high severity, with a CVSS base score of 7.8 out of 10.

HIGH threat level
7.8 / 10 CVSS base
Weakness CWE-1321 — Improperly Controlled Modification of Object-Attribute Properties and Methods

High — serious impact or readily exploitable. Prioritize remediation.

03 · Affected Versions

Affected swiper Versions

swiper · npm versions >= 6.5.1, < 12.1.2 are affected.

How to Reproduce CVE-2026-27212

$ pruva-verify REPRO-2026-00107
or curl -O https://pruva.dev/api/v1/reproductions/REPRO-2026-00107/artifacts/reproduction_steps.sh && chmod +x reproduction_steps.sh && ./reproduction_steps.sh
Run in a VM or disposable container. This exploits a real vulnerability.
06 · Proof of Reproduction

Proof of Reproduction for CVE-2026-27212

Reproduced by Pruva's autonomous agents — 87 tool calls over 10 min. Full root-cause analysis and the complete transcript are below.

How the agent worked 316 events · 87 tool calls · 10 min
10 minDuration
87Tool calls
75Reasoning steps
316Events
Agent activity over 10 min
Support
16
Repro
63
Variant
233
0:0010:21

Root Cause and Exploit Chain for CVE-2026-27212

Summary

A prototype pollution vulnerability exists in the swiper npm package (versions >=6.5.1, < 12.1.2) that can be bypassed by modifying Array.prototype.indexOf. The vulnerability resides in shared/utils.mjs at line 94 where indexOf() is used to check whether user-provided input contains forbidden strings like __proto__. An attacker can override Array.prototype.indexOf to always return -1, causing the filter to incorrectly allow __proto__ keys through, resulting in successful prototype pollution of Object.prototype.

Impact

  • Package: swiper (npm package)
  • Affected Versions: >=6.5.1, < 12.1.2
  • Fixed In: 12.1.2
  • Severity: CRITICAL
Risk and Consequences

This is a prototype pollution vulnerability which can have severe security implications:

  1. Authentication Bypass - Polluted prototypes can modify authentication logic
  2. Denial of Service - Modified prototypes can cause application crashes or unexpected behavior
  3. Property Injection - Arbitrary properties can be injected into all objects
  4. Logic Manipulation - Application business logic can be altered through prototype manipulation

Any application that processes attacker-controlled input using this package may be affected, particularly when using extendDefaults() or similar methods that merge user input with internal configuration objects.

Root Cause

Technical Explanation

The vulnerability exists in the swiper package's utility functions, specifically in shared/utils.mjs around line 94. The code attempts to prevent prototype pollution by checking if input keys contain forbidden strings:

// Vulnerable pattern (conceptual)
if (forbiddenKeys.indexOf(key) !== -1) {
    // Block the key
}

The problem is that indexOf() is a method called on the forbiddenKeys array. Since indexOf is defined on Array.prototype, it can be globally overridden:

Array.prototype.indexOf = () => -1;

When this override is in place:

  1. forbiddenKeys.indexOf('__proto__') returns -1 (instead of the actual index)
  2. The check indexOf(...) !== -1 evaluates to false
  3. The __proto__ key is allowed through the filter
  4. Object.prototype gets polluted with attacker-controlled properties
Bypass Mechanism

The exploit chain works as follows:

  1. Override Phase: Array.prototype.indexOf = () => -1;
  2. Input Phase: Attacker provides {"__proto__":{"polluted":"yes"}}
  3. Filter Bypass: The indexOf check returns -1, so __proto__ passes validation
  4. Merge Phase: The library merges the malicious payload into the target object
  5. Pollution: Object.prototype.polluted is set to "yes"
  6. Impact: All objects now have the polluted property
Fix Information

The issue was fixed in version 12.1.2. The fix likely replaces the indexOf()-based check with a more robust approach that doesn't rely on prototype methods that can be overridden, such as:

  • Using Object.prototype.hasOwnProperty.call() checks
  • Using a Set with has() method
  • Using includes() from a frozen array
  • Implementing a custom comparison function that doesn't rely on prototype methods

Reproduction Steps

Script Reference

The reproduction script is located at: repro/reproduction_steps.sh

What the Script Does
  1. Creates a temporary directory and initializes npm
  2. Installs the vulnerable version of swiper (12.1.1)
  3. Creates a test script that:
    • Imports the swiper package
    • Overrides Array.prototype.indexOf to always return -1
    • Checks {}.polluted before exploitation (should be undefined)
    • Calls swiper.default.extendDefaults() with a malicious payload containing {"__proto__":{"polluted":"yes"}}
    • Checks {}.polluted after exploitation
    • Restores the original Array.prototype.indexOf
  4. Runs the test and reports results
  5. Cleans up temporary files
Expected Evidence of Reproduction

When the vulnerability is present, the script outputs:

Before exploit: {}.polluted = undefined
After exploit: {}.polluted = yes

[VULNERABILITY CONFIRMED] Prototype pollution successful!
Object.prototype was polluted with 'polluted' property.

The key indicator is that {}.polluted changes from undefined to "yes", proving that Object.prototype was successfully polluted.

Evidence

Log Files
  • Installation log: logs/npm_install.log
  • Test output: logs/test_output.log
Key Excerpts

From logs/test_output.log:

Testing prototype pollution in swiper...
Before exploit: {}.polluted = undefined
After exploit: {}.polluted = yes

[VULNERABILITY CONFIRMED] Prototype pollution successful!
Object.prototype was polluted with 'polluted' property.
Environment Details
  • Node.js Version: v22.22.0
  • npm Version: 10.9.4
  • Tested Package: swiper@12.1.1
  • Operating System: Linux (containerized environment)

Recommendations / Next Steps

Suggested Fix Approach
  1. Replace indexOf()-based checks with alternatives that cannot be easily bypassed:

    // Instead of:
    if (forbiddenKeys.indexOf(key) !== -1)
    
    // Use:
    const forbiddenSet = new Set(['__proto__', 'constructor', 'prototype']);
    if (forbiddenSet.has(key))
    
  2. Use Object.freeze() on critical arrays to prevent prototype manipulation

  3. Validate keys explicitly without relying on prototype methods:

    if (key === '__proto__' || key === 'constructor' || key === 'prototype')
    
  4. Use Object.prototype.hasOwnProperty.call() for property checks

Upgrade Guidance

Immediate Action Required: Upgrade to swiper version 12.1.2 or later.

npm install swiper@latest
Testing Recommendations
  1. Add regression tests that specifically test prototype pollution scenarios
  2. Test with various prototype overrides (Array.prototype.indexOf, Array.prototype.includes, etc.)
  3. Implement input validation tests for all user-controlled data entry points
  4. Consider using libraries like safe-object-assign or safe-extend for object merging operations
Additional Security Measures
  1. Implement Content Security Policy (CSP) headers where applicable
  2. Use input sanitization libraries
  3. Regularly audit dependencies for prototype pollution vulnerabilities
  4. Consider using Object.create(null) for objects that shouldn't inherit from Object.prototype

Additional Notes

Idempotency Confirmation

The reproduction script has been tested twice consecutively and produces consistent results:

  • First run: Exit code 0, vulnerability confirmed
  • Second run: Exit code 0, vulnerability confirmed

The script is fully idempotent - it creates a fresh temporary directory for each run, installs dependencies cleanly, runs the test, and removes all temporary files.

Edge Cases and Limitations
  1. Runtime Dependency: The exploit requires JavaScript runtime access to modify Array.prototype. This is typically only possible in server-side JavaScript (Node.js, Bun) or if an attacker can execute arbitrary code in a browser context.

  2. Method Scope: The vulnerability specifically affects code paths that use indexOf() for forbidden key validation. Other protection mechanisms may still block some attack vectors.

  3. Cleanup Requirement: The exploit modifies global prototypes. Proper cleanup (restoring original methods) is essential to prevent side effects in the same execution context.

  4. Bun Runtime: According to the advisory, this exploit also works on Bun runtime. The same fix should be applicable.

  5. Previous Fix Bypass: This vulnerability is a bypass of a previous fix. Future fixes should consider all possible prototype pollution vectors, not just the specific one addressed previously.

CVE-2026-27212 Reproduction Transcript

The agent's step-by-step process — every tool call, every handoff, the moment the exploit fired.

Full session Replay every step — scrub the timeline or play it back.

Event 1/40
0:001:37
0:00
session startedaccounts/fireworks/models/kimi-k2p5 · ghsa-hmx5-qpq5-p643 · ghsa-hmx
0:06
0:24
0:27
0:33
web search
0:49
0:49
extract_facts
no facts extracted
0:50
0:50
0:50
supportrepro
1:15
1:15
1:15
1:16
1:16
1:16
1:26
1:26
#!/bin/bash
set -euo pipefail

# Portable root detection - works anywhere
ROOT="${PRUVA_ROOT:-$(cd "$(dirname "$0")/.." && pwd)}"
LOGS="$ROOT/logs"
mkdir -p "$LOGS"

cd "$ROOT"

# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color

echo "========================================"
echo "GHSA-hmx5-qpq5-p643: Prototype pollution in swiper"
echo "========================================"
1:27
1:31
$chmod +x repro/reproduction_steps.sh && ./repro/reproduction_steps.sh
4.1s
========================================
GHSA-hmx5-qpq5-p643: Prototype pollution in swiper
========================================
Installing vulnerable version of swiper (12.1.1)...

1:37

Artifacts and Evidence for CVE-2026-27212

Scripts, logs, diffs, and output captured during the reproduction.

No artifacts available

08 · How to Fix

How to Fix CVE-2026-27212

Upgrade swiper · npm to 12.1.2 or later.

Coming soon

Step-by-step mitigation and hardening guidance for CVE-2026-27212 — configuration checks, workarounds where no patch exists, and how to verify you're protected — is on the way.

10 · FAQ

FAQ: CVE-2026-27212

How does the CVE-2026-27212 prototype pollution bypass work?

An attacker overrides Array.prototype.indexOf (e.g. to always return -1), which causes Swiper's forbidden-key filter to incorrectly conclude that __proto__ is not present in the input, letting a crafted payload using Array.prototype pass through and pollute Object.prototype. The exploit works across Windows and Linux, on both Node and Bun runtimes.

Which Swiper versions are affected by CVE-2026-27212, and where is it fixed?

Swiper versions >= 6.5.1 and < 12.1.2 are affected; it is fixed in 12.1.2.

How severe is CVE-2026-27212?

It is rated critical: prototype pollution of this kind can enable authentication-logic bypass, denial of service, arbitrary property injection, and manipulation of application logic in any code that processes attacker-controlled input through affected merge/extend functions.

How can I reproduce CVE-2026-27212?

Download the verified script from this page and run it in an isolated environment against Swiper < 12.1.2. It overrides Array.prototype.indexOf and feeds a crafted __proto__-bearing payload through Swiper's input handling, showing Object.prototype becoming polluted, then confirms 12.1.2 is not exploitable.
11 · References

References for CVE-2026-27212

Authoritative sources for CVE-2026-27212 — official vulnerability databases and the upstream advisory. Pruva's reproduction verifies the issue firsthand; these are the primary records to corroborate it.