Advisory

GHSA-4jp3-q2qm-9fmw

Also known as: CVE-2022-24733

Summary

Improper Restriction of Rendered UI Layers or Frames in Sylius

Details

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:

Severity

Medium Basis: The source's own band: MODERATE

Dates

Published
2022-03-14 21:55 UTC
Modified
2023-11-08 04:08 UTC

Affected packages and fixes

sylius/sylius

Packagist · All systems

Affected

  • introduced 0, fixed 1.9.10 (ecosystem)

Fixed versions

1.9.10

Fix

The export has no generic command for this ecosystem.

sylius/sylius

Packagist · All systems

Affected

  • introduced 1.10.0, fixed 1.10.11 (ecosystem)

Fixed versions

1.10.11

Fix

The export has no generic command for this ecosystem.

sylius/sylius

Packagist · All systems

Affected

  • introduced 1.11.0, fixed 1.11.2 (ecosystem)

Fixed versions

1.11.2

Fix

The export has no generic command for this ecosystem.

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0

Sources & licences