CVE-2025-62417: bagisto has CSV Formula Injection in Create New Product
9.1
Basic Information
Technical Details
| Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
|---|---|---|---|
| bagisto/bagisto | composer | <= 2.3.7 | 2.3.8 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability is a classic case of CSV Formula Injection (CWE-1236), where the application fails to sanitize user-provided input before including it in a CSV export. The root cause is the lack of input validation and sanitization on product attributes, specifically those that use a rich text editor (TinyMCE).
The analysis of the patch commit 8076c708498a0187bc952d5f5f705e0cb1919682 reveals the vulnerable code path and the fix. The vulnerability is triggered when a user with privileges to edit products injects a string starting with a formula character (e.g., =) into a product field. The Webkul\Admin\Http\Controllers\Catalog\ProductController::update function was identified as the vulnerable function because, prior to the patch, it would take this raw, unsanitized input via request()->all() and save it to the database.
The patch addresses this by introducing several changes:
- A new dependency,
stevebauman/purify, is added for HTML sanitization. - A new helper function,
clean_content(), is created inpackages/Webkul/Core/src/Http/helpers.php. This function uses the new library to clean the content and also removes potentially harmful template syntax. - The
packages/Webkul/Admin/src/Http/Requests/ProductForm.phpform request is modified to use a newpassedValidation()method. This method is automatically called after validation passes and it sanitizes the input for any TinyMCE-enabled fields by applying theclean_content()function. - Finally, the
ProductController::updatemethod is changed to use the data from theProductFormrequest object ($request->all()) instead of the global raw request (request()->all()). This ensures that the controller receives the sanitized data.
Therefore, any runtime profile during the exploitation of this vulnerability on an unpatched system would show the Webkul\Admin\Http\Controllers\Catalog\ProductController::update method processing the malicious input. While the vulnerability manifests upon CSV export, the fix was applied at the point of data entry to prevent malicious data from being stored in the first place.
Vulnerable functions
Webkul\Admin\Http\Controllers\Catalog\ProductController::updatepackages/Webkul/Admin/src/Http/Controllers/Catalog/ProductController.php