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 publish.php #5

Closed
fnuef55555 opened this issue Jul 5, 2018 · 0 comments
Closed

XSS in publish.php #5

fnuef55555 opened this issue Jul 5, 2018 · 0 comments

Comments

@fnuef55555
Copy link

Hi Developers,

you do not sanitize the 5 $_POST variables username,contentname,tagline,content, and genre against XSS vectors in publish.php when inserting new articles in the database. This can lead to different harmfull actions performed against users by injected code. You should consider applying filter functions similar to the attached patch.
patch.txt
Note that this patch does filter all HTML tags..what might not be an option for you as you use an editor that produces HTML tags. However there are solutions for these cases too, e.g.: HTML Purifier(http://htmlpurifier.org/)

POC:
This will insert a malicious XSS code inside each of the mentioned fields with the username of user shown as author and does not even require authentication.
$ curl -d "username=user'#\"><script>alert('usr');</script><a href=\"#&contentname=<script>alert('title');</script>&tagline=<script>alert('tags');</script>&content=<script>alert('content');</script>&<script>alert('gen');</script>" -X POST http://localhost/Social-Platform-Donut/596841401/publish.php

Further, you should consider authenticating the user and the calling script before processing POST requests in general and reading static contents from storage when accessible instead of passing and reading them from easily alterable request parameters.

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