# Code Snippets <= 4.1.0 - Unauthenticated Client-Side Path Traversal via 'from' Parameter

- **ID:** WPSEC-2026-4040
- **Plugin:** Code Snippets (`code-snippets`), https://wordpress.org/plugins/code-snippets/
- **Affected versions:** from 3.10.0 before 4.1.1
- **Fixed in:** 4.1.1 (Update to 4.1.1 or later.)
- **Severity:** High 8.8 (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H)
- **Weakness:** CWE-22
- **Usage among sites WPSec scans:** plugin Medium, affected versions Medium (as of 2026-11-26)
- **Attack surface analysis:** https://attacksurface.wpsec.com/plugin/code-snippets
- **Fix released:** 2026-11-25
- **Published:** 2026-11-26
- **URL:** https://wpsec.com/vuln/WPSEC-2026-4040/

## 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/

Source: WPSec, https://wpsec.com/vuln/WPSEC-2026-4040/

License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Free to use, share and adapt, also commercially, if you credit WPSec and link to this advisory.
