GHSA-3cpp-fv95-mpr5: Shopware vulnerable to Server-Side Request Forgery (SSRF) – order invoice
2.7
Basic Information
Technical Details
| Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
|---|---|---|---|
| shopware/platform | composer | >= 6.7.0.0, < 6.7.3.1 | 6.7.3.1 |
| shopware/platform | composer | < 6.6.10.7 | 6.6.10.7 |
| shopware/core | composer | >= 6.7.0.0, < 6.7.3.1 | 6.7.3.1 |
| shopware/core | composer | < 6.6.10.7 | 6.6.10.7 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability is a Server-Side Request Forgery (SSRF) that occurs during the generation of PDF documents for orders. The root cause is improper sanitization of user-provided input, specifically the 'documentComment' field, which is included in the generated documents.
The analysis of the provided patch f32737b34798d4800b81c67efee17905380d2be4 shows that the fix involves modifying Twig templates. The key change is in src/Core/Framework/Resources/views/documents/includes/comment.html.twig, where the sw_sanitize filter is now called with (null, true). This enables a stricter sanitization mode that strips all HTML tags, including the malicious <img> tags that cause the SSRF.
The vulnerability is triggered when a document is rendered. The test files modified in the patch (InvoiceRendererTest.php, CreditNoteRendererTest.php, etc.) point to the Shopware\Core\Checkout\Document\Renderer\* classes as being responsible for this rendering process. Although the patch does not modify these PHP classes directly, they are the ones that orchestrate the rendering of the vulnerable Twig templates. Therefore, their render methods (a conventional name for such methods) are the primary functions that would appear in a runtime profile during exploitation.
Additionally, the Shopware\Core\Framework\Adapter\Twig\Extension\SanitizeExtension::sw_sanitize function is identified as a key component. The vulnerability stems from its insecure default behavior. The patch remediates the vulnerability by invoking this function with parameters that enforce stricter sanitization.
In summary, an attacker with admin privileges can inject an <img> tag with a malicious src attribute into the document comment. When the server generates the PDF for the document, the PDF generation library attempts to fetch the image from the specified URL, leading to an SSRF attack. The identified functions are all part of this vulnerable document generation process.
Vulnerable functions
Shopware\Core\Checkout\Document\Renderer\InvoiceRenderer::rendersrc/Core/Checkout/Document/Renderer/InvoiceRenderer.php
Shopware\Core\Checkout\Document\Renderer\CreditNoteRenderer::rendersrc/Core/Checkout/Document/Renderer/CreditNoteRenderer.php
Shopware\Core\Checkout\Document\Renderer\DeliveryNoteRenderer::rendersrc/Core/Checkout/Document/Renderer/DeliveryNoteRenderer.php
Shopware\Core\Checkout\Document\Renderer\StornoRenderer::rendersrc/Core/Checkout/Document/Renderer/StornoRenderer.php
Shopware\Core\Framework\Adapter\Twig\Extension\SanitizeExtension::sw_sanitizesrc/Core/Framework/Adapter/Twig/Extension/SanitizeExtension.php