Skip to content

🚨 [security] [js] Update swiper 12.0.3 → 12.1.2 (minor)#667

Open
depfu[bot] wants to merge 1 commit intomainfrom
depfu/update/importmap/swiper-12.1.2
Open

🚨 [security] [js] Update swiper 12.0.3 → 12.1.2 (minor)#667
depfu[bot] wants to merge 1 commit intomainfrom
depfu/update/importmap/swiper-12.1.2

Conversation

@depfu
Copy link
Contributor

@depfu depfu bot commented Mar 6, 2026


🚨 Your current dependencies have known security vulnerabilities 🚨

This dependency update fixes known security vulnerabilities. Please see the details below and assess their impact carefully. We recommend to merge and deploy this as soon as possible!


Here is everything you need to know about this upgrade. Please take a good look at what changed and the test results before merging this pull request.

What changed?

✳️ swiper (12.0.3 → 12.1.2) · Repo · Changelog

Security Advisories 🚨

🚨 Prototype pollution in swiper

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:
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
CVE-2026-25047
CVE-2026-26021

Release Notes

12.1.1

Bug Fixes

  • a11y: fix focus in virtual mode enabled (3055008), closes #8147
  • core: avoid double-subtracting offsets in centerInsufficientSlides (#8158) (60b0052)
  • core: prevent duplicate module initialization in constructor (#8155) (#8156) (07738a2)
  • types: support boolean as a11y value (#8157) (6bf76d5)

12.1.0

Bug Fixes

  • autoplay: broken custom delay percentages with pause/resume (#8133) (0afecde)
  • core: Don't use data-swiper-slide-index for realIndex when virtual module is enabled (#8142) (bd957f8)
  • core: Escape all CSS selector special characters (d35f41a), closes #8135
  • core: support slidesOffsetBefore and slidesOffsetAfert in cssMode (45b98d0), closes #7926
  • fix lazy preloader removal error in react in vue (332f5c7), closes #8149
  • thumbs: update slide classes on virtual swiper update (#8141) (9752771)
  • types: Add autoScroll to thumbs.update type signature (#8146) (5d91e6e)
  • zoom: initialize gesture state after programmatic zoom (#8112) (71e9511)

Features

  • keyboard: add support for custom speed parameter in keyboard navigation (#8148) (7a4a0e5)
  • new snapToSlideEdge parameter (de3131f), closes #8021 #4780

Does any of this look wrong? Please let us know.

Commits

See the full diff on Github. The new version differs by 25 commits:


Depfu Status

Depfu will automatically keep this PR conflict-free, as long as you don't add any commits to this branch yourself. You can also trigger a rebase manually by commenting with @depfu rebase.

All Depfu comment commands
@​depfu rebase
Rebases against your default branch and redoes this update
@​depfu recreate
Recreates this PR, overwriting any edits that you've made to it
@​depfu merge
Merges this PR once your tests are passing and conflicts are resolved
@​depfu cancel merge
Cancels automatic merging of this PR
@​depfu close
Closes this PR and deletes the branch
@​depfu reopen
Restores the branch and reopens this PR (if it's closed)
@​depfu pause
Ignores all future updates for this dependency and closes this PR
@​depfu pause [minor|major]
Ignores all future minor/major updates for this dependency and closes this PR
@​depfu resume
Future versions of this dependency will create PRs again (leaves this PR as is)

@depfu depfu bot added the depfu label Mar 6, 2026
@digitaltom
Copy link
Collaborator

@depfu rebase

@depfu depfu bot force-pushed the depfu/update/importmap/swiper-12.1.2 branch from 478165b to 7d1c511 Compare March 6, 2026 23:33
@coveralls
Copy link

Pull Request Test Coverage Report for Build 22786403718

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 99.363%

Totals Coverage Status
Change from base Build 22785818017: 0.0%
Covered Lines: 780
Relevant Lines: 785

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants