CVE-2026-126604: Incorrect Behavior Order: Validate Before Canonicalize in sanitize-filename

Published Dec 3, 2026
·
Updated

sanitize-filename (PyPI) < 1.2.1 is vulnerable to path traversal attacks. sanitize() removed blacklisted characters before applying Unicode NFKD normalization. Characters such as FULLWIDTH SOLIDUS (U+FF0F), FULLWIDTH REVERSE SOLIDUS (U+FF3C) and SMALL REVERSE SOLIDUS (U+FE68) passed the blacklist and became real path separators in the returned value. An attacker who controls the input filename could make sanitize() return an absolute path. Example, sanitize("\uFF0F..\uFF0F..\uFF0F..\uFF0Fetc\uFF0Fpasswd")

Affected Software

1 affected component
pypi/sanitize-filename<1.2.1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Fixed in 1.2.1

Event History

Dec 3, 2026
CVE Published
via MITRE·10:33 PM
Data Sourced
via MITRE·10:33 PM
RemedyDescriptionSeverityWeakness

Frequently Asked Questions

1

Which deployments are exposed?

Deployments using the PyPI sanitize-filename package at versions earlier than 1.2.1 are affected if they pass attacker-controlled filename input to sanitize() and use the returned value as a filesystem path or filename.

2

What does an attacker need to exploit this issue?

An attacker needs control over the input filename supplied to sanitize(). They can use Unicode characters that are not removed by the blacklist but become path separators after Unicode NFKD normalization, enabling traversal or an absolute returned path.

3

Is upgrading available, and what should be done if it cannot be applied immediately?

Version 1.2.1 is the referenced fixed release. If upgrading is not immediately possible, do not rely on sanitize() output alone for untrusted filenames; ensure the resulting path cannot escape the intended directory before using it.

4

How can I identify potentially vulnerable usage?

Review uses of sanitize() that accept untrusted filenames, especially where its returned value is joined to or used as a filesystem path. Inputs containing FULLWIDTH SOLIDUS (U+FF0F), FULLWIDTH REVERSE SOLIDUS (U+FF3C), or SMALL REVERSE SOLIDUS (U+FE68) are relevant indicators.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203