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

Security Fix for Cross-site Scripting (XSS) - huntr.dev #193

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

huntr-helper
Copy link

https://huntr.dev/users/Asjidkalam has fixed the Cross-site Scripting (XSS) vulnerability 🔨. Asjidkalam has been awarded $25 for fixing the vulnerability through the huntr bug bounty program 💵. Think you could fix a vulnerability like this?

Get involved at https://huntr.dev/

Q | A
Version Affected | ALL
Bug Fix | YES
Original Pull Request | 418sec#1
GitHub Issue | #190
Vulnerability README | https://github.com/418sec/huntr/blob/master/bounties/packagist/opencart-overclocked/1/README.md

User Comments:

📊 Metadata *

Fixed Cross Site Scripting.

Bounty URL: https://www.huntr.dev/bounties/1-packagist-opencart-overclocked

⚙️ Description *

Reflected Cross-Site Scripting (XSS) may allow an attacker to execute JavaScript code in the context of the victim's browser. This may lead to unauthorized actions being performed, unauthorized access to data, stealing of session information, denial of service, etc. An attacker needs to coerce a user into visiting a link with the XSS payload to be properly exploited against a victim.

💻 Technical Description *

The following code shows that the $_GET['token'] variable is reflected in the victim's browser without any input validation, leading to reflected XSS:

var token = "<?php echo $_GET['token']; ?>";

To fix the issue, PHP's htmlspecialchars() is used to convert special characters to HTML entities.

Reference: https://stackoverflow.com/questions/1996122/how-to-prevent-xss-with-html-php

🐛 Proof of Concept (PoC) *

Payload: "; alert(1); //
Use this payload with the GET parameter token to trigger the XSS

🔥 Proof of Fix (PoF) *

After using the htmlspecialchars, all payloads are sanitized to prevent triggering XSS.

👍 User Acceptance Testing (UAT)

Just wrapped the echo command with the htmlspecialchars, no breaking changes introduced. :)

Asjidkalam and others added 2 commits August 6, 2020 17:21
Fixed Cross Site scripting on OpenCart-Overclocked
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 this pull request may close these issues.

3 participants