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

XSS in canonical tag. #247

Closed
vdvcoder opened this issue Mar 30, 2021 · 2 comments
Closed

XSS in canonical tag. #247

vdvcoder opened this issue Mar 30, 2021 · 2 comments

Comments

@vdvcoder
Copy link

What steps will reproduce the problem?

  1. Setting the canonical config to null (using Url::current())

  2. Capture a post request with burpsuite.

  3. Send the post request to repeator.

  4. Change the POST URI to:
    POST /<redacted>/<redacted>/<redacted>/<redacted>/deelnemen'"><svg/onload=alert()>

  5. Send the request.

What is the expected result?

<link rel="canonical" href="https://<redacted>.<redacted>/<redacted>/<redacted>/<redacted>/<redacted>/deelnemen'&quot;&gt;&lt;svg/onload=alert()&gt;"/>

What do you get instead?

<link rel="canonical" href="https://<redacted>.<redacted>/<redacted>/<redacted>/<redacted>/<redacted>/deelnemen'"><svg/onload=alert()>"/>

Payload triggers.

Additional info

How to solve:
vendor/artesaos/seotools/src/SEOTools/SEOMeta.php

Line: 475
return $this->canonical ?: (($canonical_config === null) ? app('url')->full() : $canonical_config);

Change into:

return $this->canonical ?: (($canonical_config === null) ? htmlspecialchars(app('url')->current()) : $canonical_config);

NOTE: Also look for other places where you call ap('url')->current() to sanitize the input.

Q A
This Package Version 0.19.1
Laravel Framework Version 8.32.1
PHP version 7.4
Operating system Mac OS Big Sur
@SAEIIID
Copy link

SAEIIID commented Apr 27, 2021

i use seotools for Laravel but not ideal performance :(

@J-Brk
Copy link
Collaborator

J-Brk commented Apr 27, 2021

i use seotools for Laravel but not ideal performance :(

This has nothing to do with XSS. It would be good to review your own code if you're having bad performance.

If there is any specific issue your having with the package, feel free to open an issue.

@vdvcoder vdvcoder closed this as completed May 3, 2021
vinicius73 added a commit that referenced this issue May 3, 2021
Fixes #247 XSS in canonical tag
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

No branches or pull requests

3 participants