CVE-2026-27641: Flask-Reuploaded Remote Code Execution via Server-Side Template Injection
Summary
CVE-2026-27641: Flask-Reuploaded vulnerable to Remote Code Execution via Server-Side Template Injection. Affects flask-reuploaded versions < 1.5.0. Fixed in 1.5.0. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
Flask-Reuploaded is a popular extension for Flask that simplifies file uploads. It provides an easy way to handle file uploads while ensuring security and flexibility. However, it has a critical vulnerability that allows remote attackers to exploit the application through Server-Side Template Injection, leading to arbitrary file writes and remote code execution.
Vulnerability Detail
The vulnerability arises from a critical path traversal and extension bypass issue in Flask-Reuploaded. Attackers can manipulate the name parameter to inject malicious code, resulting in unauthorized file writes and potential remote code execution. This vulnerability is particularly dangerous as it can compromise the integrity and confidentiality of the application, allowing attackers to execute arbitrary code on the server.
How To Fix
Latest published version: 1.6.0 as of 22 Oct 2026
pip install --upgrade "flask-reuploaded==1.6.0"
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
1.5.0
This is the first release that contains the fix.
pip install --upgrade "flask-reuploaded==1.5.0"
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
If you cannot update the package immediately, consider implementing the following workarounds:
- Do not pass user input to the
nameparameter. - Use auto-generated filenames only.
- Implement strict input validation if
namemust be used.
Here is an example of how to sanitize user input before saving a file:
from werkzeug.utils import secure_filename
import os
# Sanitize user input before passing to save()
safe_name = secure_filename(request.form.get('custom_name'))
# Remove path separators
safe_name = os.path.basename(safe_name)
# Validate extension matches policy
if not photos.extension_allowed(photos.get_extension(safe_name)):
abort(400)
filename = photos.save(file, name=safe_name)
Conclusion
The Flask-Reuploaded package has a critical vulnerability that allows remote code execution through Server-Side Template Injection. It is essential to update to version 1.5.0 or later to mitigate this risk. If immediate updates are not possible, follow the provided workarounds to secure your application.
See every vulnerability recorded for flask-reuploaded →
FAQ
The CVSS score of this vulnerability is 9.8, indicating a critical severity level.
You can use Vulert to monitor and alert for open-source vulnerabilities in your software. Visit the Vulert playground at Vulert Scanner to check if your application is affected without any signup.
The vulnerability can lead to arbitrary file writes and remote code execution, compromising the security and integrity of the application.
Yes, the vulnerability has been patched in Flask-Reuploaded version 1.5.0. It is recommended to update to this version.
If you cannot update immediately, implement the suggested workarounds to mitigate the risk until you can apply the patch.
References
Related vulnerabilities
Recent vulnerabilities recorded for flask-reuploaded.