Skip to content
New issue

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

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

Already on GitHub? # to your account

Prevent XSS by stripping tags from $_SERVER['REQUEST_URI']. #16

Merged
merged 2 commits into from
Dec 15, 2015
Merged

Prevent XSS by stripping tags from $_SERVER['REQUEST_URI']. #16

merged 2 commits into from
Dec 15, 2015

Conversation

jhowardjr
Copy link

When $og->url() is called, without a parameter, tags can be injected into the page where the og tags are rendered. Here's an example of how it can be done:
http://example.com/?"><script>alert(1234)</script>

…e of an attack would be ?"><script>alert(1234)</script>
@chriskonnertz
Copy link
Owner

Hello,

thank you for reporting this security issue.

What is the intention of the second line?

$safeRequestURI = preg_replace('/alert|log/is','',$safeRequestURI);

For example, this is a valid URL:

http://localhost/opengraph/test.php?alert=test

Your code transforms this URL to:

http://localhost/opengraph/test.php?=test

This seems unnecessary to me?

@jhowardjr
Copy link
Author

I was testing something else it is unnecessary.

chriskonnertz added a commit that referenced this pull request Dec 15, 2015
Prevent XSS by stripping tags from $_SERVER['REQUEST_URI'].
@chriskonnertz chriskonnertz merged commit 98d240c into chriskonnertz:master Dec 15, 2015
@chriskonnertz
Copy link
Owner

Thanks!

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants