Code Snippets <= 4.1.0 - Unauthenticated Client-Side Path Traversal via 'from' Parameter
- ID
- WPSEC-2026-4040
- Plugin
- Code Snippets (code-snippets)
- Affected
- from 3.10.0 before 4.1.1
- Remediation
- Update to 4.1.1 or later.
- CVSS 3.1
- CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
- Weakness
- CWE-22
- Usage
- Plugin Medium · Affected versions Medium among sites WPSec scans, 2026-11-26
- Attack surface
- Code Snippets on WPSec AttackSurface
- Fix released
- Published
Description
The Code Snippets plugin for WordPress is vulnerable to Client-Side Path Traversal via the 'from' query parameter on the Import screen in all versions from 3.10.0 up to, and including, 4.1.0. This is due to the importer name being read from the URL and placed into REST API request paths without validation or URL encoding. When the screen loads, the plugin automatically sends a GET request to that path, and it sends a POST request when the user runs an import. Both requests carry the logged-in user's REST nonce. This makes it possible for unauthenticated attackers to redirect these authenticated requests to other REST API routes, with query parameters they choose, and perform actions as the administrator, for example changing user roles or modifying snippets. Exploitation requires tricking a site administrator into following a crafted link.
References
- https://wpsec.com/vuln/WPSEC-2026-4040/
- https://plugins.svn.wordpress.org/code-snippets/tags/4.1.1/
- https://wordpress.org/plugins/code-snippets/
Published by WPSec. Provided as is, without warranty. Corrections: contact us.
This advisory as JSON, OSV or Markdown · All advisories: JSON, OSV, RSS