Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross-Site Scripting (XSS) vulnerability in storefront js #11

Closed
alexbaat opened this issue Sep 16, 2020 · 2 comments · Fixed by #53
Closed

Cross-Site Scripting (XSS) vulnerability in storefront js #11

alexbaat opened this issue Sep 16, 2020 · 2 comments · Fixed by #53

Comments

@alexbaat
Copy link

We use this plugin on multiple shops and in our security scans a vulnerabillity came up.
Within the file src/Resources/app/storefront/src/main.js there are these lines:

        const gtmPush = request.getResponseHeader('gtm-push');

        if (gtmPush && window.dataLayer) {
            window.dataLayer.push(JSON.parse(gtmPush));

            if (window.gaRegisterClickTracking) {
                window.gaRegisterClickTracking();
            }
        }

If I manually add a cookie '_gtm_push' in my browser with a random value, and reload the page, this value is reflected within the source code, for instance the result is

<script type="text/javascript">
  window.dataLayer.push(MyRandomValue);
</script>

So this script is vulnerable for cross-site scripting.
I would like to fix this but I first want to understand why these lines are in the code because I don't know why you should fetch this value.

@wbm-sbasler
Copy link
Collaborator

The loadened event will be fired when switching between product pages in the listing. When you reload the page, the variable in meta.html.twig will be filled in StorefrontRenderSubscriber.php. That would most likely the place where you can fix this issue.

@wbm-sbasler
Copy link
Collaborator

@alexbaat i could not really reproduce this, maybe i missed something.
Can you please tell me the steps to reproduce, with all necessary requirements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants