Описание
Craft Commerce has Stored XSS via Order Status Message with potential database exfiltration
Summary
A stored XSS vulnerability exists in Craft Commerce’s Order Status History Message. The message is rendered using the |md filter, which permits raw HTML, enabling malicious script execution. If a user has database backup utility permissions (which do not require an elevated session), an attacker can exfiltrate the entire database, including all user credentials, customer PII, order history, and 2FA recovery codes.
Users are recommended to update to the patched 5.5.2 release to mitigate the issue.
Proof of Concept
Required Permissions
- General
- Access the control panel
- Access Craft Commerce
- Access to the database backup utility
- Craft Commerce
- Manage orders
- Edit orders
Attacker Server Setup
To reproduce this attack, you need a server to receive the exfiltrated database.
- Save the Python script as
receiver.pyon your attacker machine. - Run it:
python3 receiver.py-- Change the port if needed.
Server Python Script
Steps to Reproduce
- Log in to the admin panel
- Navigate to Commerce → Orders
- Create a new order, enter a customer email, and mark the order as completed. The Order should be saved now; if not, save it.
- Edit the order
- Change the order status, a new text field (Status Message) will appear once the status is changed
- Make sure you have multiple order statuses; if not, create one from (/admin/commerce/settings/orderstatuses)
- In the Status Message field, enter the XSS payload below
- Save/Update the order
- Log out & log in again with an admin account
- Visit the order page (/admin/commerce/orders/{Order_ID})
- XSS executes → Full database backup is triggered and exfiltrated
- Go back to the attacker’s server and notice a zipped file containing the full exfiltrated database.
XSS Payload (DB Exfiltration)
Note: Replace ATTACKER:8888 with your listener server.
Technical Details (Vulnerable Code)
File: vendor/craftcms/commerce/src/templates/orders/_history.twig
Sink: {{ orderHistory.message | md }}
Root Cause: The |md Twig filter (Markdown) processes the message but does not sanitize HTML tags.
Impact
The exfiltrated database backup includes, but is not limited to:
- Usernames, emails, and password hashes.
- Customer PII: Names, addresses, and complete order history.
- Transaction records, customer profiles, and coupon codes.
- GraphQL tokens.
- 2FA recovery codes.
- Potentially, payment gateway secrets (if stored directly instead of using environment variables).
Note: This XSS can also be leveraged for the same attacks described in previous reports, including privilege escalation and forced password changes.
Mitigation
Sanitize the message before rendering:
Or escape HTML before Markdown processing:
Additionally, requiring an elevated session for the DB Backup utility would increase the difficulty of exploitation, although it would not prevent the attack, as it might occur while an active elevated session is in place.
Resources:
https://github.com/craftcms/commerce/commit/4665a47c0961aee311a42af2ff94a7c470f0ad8c
Ссылки
- https://github.com/craftcms/commerce/security/advisories/GHSA-8478-rmjg-mjj5
- https://nvd.nist.gov/vuln/detail/CVE-2026-25483
- https://github.com/craftcms/commerce/commit/4665a47c0961aee311a42af2ff94a7c470f0ad8c
- https://github.com/craftcms/commerce/releases/tag/4.10.1
- https://github.com/craftcms/commerce/releases/tag/5.5.2
Пакеты
craftcms/commerce
>= 5.0.0, <= 5.5.1
5.5.2
craftcms/commerce
>= 4.0.0-RC1, <= 4.10.0
4.10.1
Связанные уязвимости
Craft Commerce is an ecommerce platform for Craft CMS. In versions from 4.0.0-RC1 to 4.10.0 and from 5.0.0 to 5.5.1, a stored XSS vulnerability exists in Craft Commerce’s Order Status History Message. The message is rendered using the |md filter, which permits raw HTML, enabling malicious script execution. If a user has database backup utility permissions (which do not require an elevated session), an attacker can exfiltrate the entire database, including all user credentials, customer PII, order history, and 2FA recovery codes. This issue has been patched in versions 4.10.1 and 5.5.2.