Improper Restriction of Rendered UI Layers or Frames in Sylius
Impact
It is possible for a page controlled by an attacker to load the website within an iframe. This will enable a clickjacking attack, in which the attacker's page overlays the target application's interface with a different interface provided by the attacker
Source excerpt · OSVAffected packages
Start with the recorded fix for your release branch. Check your installed version and test compatibility before upgrading. Fixing this advisory does not rule out other vulnerabilities in the release.
| Affected range | Recorded fix |
|---|---|
| Earlier releases before 1.9.10Ecosystem versions | 1.9.10 |
| From 1.10.0 before 1.10.11Ecosystem versions | 1.10.11 |
| From 1.11.0 before 1.11.2Ecosystem versions | 1.11.2 |
Version evidence: OSV · GHSA-4jp3-q2qm-9fmw
View original version evidence (199 explicit versions)
Original source description
Impact
It is possible for a page controlled by an attacker to load the website within an iframe. This will enable a clickjacking attack, in which the attacker's page overlays the target application's interface with a different interface provided by the attacker
Patches
The issue is fixed in versions: 1.9.10, 1.10.11, 1.11.2, and above.
Workarounds
Every response from app should have an X-Frame-Options header set to: sameorigin. To achieve that you just need to add a new subscriber in your app.
<?php
// src/EventListener/XFrameOptionsSubscriber.php
namespace App\EventListener
final class XFrameOptionsSubscriber implements EventSubscriberInterface
{
public static function getSubscribedEvents(): array
{
return [
KernelEvents::RESPONSE => 'onKernelResponse',
];
}
public function onKernelResponse(ResponseEvent $event): void
{
if (!$this->isMainRequest($event)) {
return;
}
$response = $event->getResponse();
$response->headers->set('X-Frame-Options', 'sameorigin');
}
private function isMainRequest(ResponseEvent $event): bool
{
if (\method_exists($event, 'isMainRequest')) {
return $event->isMainRequest();
}
return $event->isMasterRequest();
}
}
And register it in the container:
# config/services.yaml
services:
# ...
App\EventListener\XFrameOptionsSubscriber:
tags: ['kernel.event_subscriber']
For more information
If you have any questions or comments about this advisory:
- Open an issue in Sylius issues
- Email us at security@sylius.com
References
- Security advisory github.com/Sylius/Sylius/security/advisories/GHSA-4jp3-q2qm-9fmw
- Security advisory nvd.nist.gov/vuln/detail/CVE-2022-24733
- Source reference github.com/Sylius/Sylius
- Release notes github.com/Sylius/Sylius/releases/tag/v1.10.11
- Release notes github.com/Sylius/Sylius/releases/tag/v1.11.2
- Release notes github.com/Sylius/Sylius/releases/tag/v1.9.10