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 vulnerability in creating Posts #331

Closed
C0deBr8kr opened this issue Apr 23, 2017 · 6 comments
Closed

XSS vulnerability in creating Posts #331

C0deBr8kr opened this issue Apr 23, 2017 · 6 comments
Assignees

Comments

@C0deBr8kr
Copy link

Exploit Title: Stored XSS vulnerability possible in creating posts in canvas (v3.3.0)
Date: 22-April-2017
Exploit Author: @C0deBr8kr
Software Link: https://github.com/cnvs/canvas/archive/v3.3.0.zip
Version: 3.3.0

Description:
XSS allows an attacker to run arbitrary scripts on the users browser.

Exploit POC:
Browser used: Chrome version 57.0.2987.133

  1. Login as a user/ admin user.
  2. Go to Posts > Add New.
  3. The title and the content fields are vulnerable to stored XSS.
  4. Enter <script>alert('XSS in title')</script> in the Title,'some subtitle' in subtitle and <script>alert('XSS in content')</script> in the content field.
  5. Publish the post.
  6. Now, navigate to the "All posts" page. The script in the 'title' field will have executed and you will see an alert box with 'XSS in title'.
  7. Now go to the preview of this post by clicking on the magnifying glass next to the newly created post.
  8. The script that we had entered in the content will now have executed and you will see an alert box with 'XSS in content'.

References:
https://www.owasp.org/index.php/Cross-site_Scripting_(XSS)

Screenshots:
screen shot 2017-04-22 at 4 47 47 pm

  1. Creating a post.

screen shot 2017-04-22 at 4 48 25 pm

  1. XSS on "All posts" page.

screen shot 2017-04-22 at 4 48 43 pm

  1. Post created.

screen shot 2017-04-22 at 4 50 54 pm

  1. XSS on the post page.

screen shot 2017-04-22 at 4 51 10 pm

  1. Post page.

Impact: An attacker can execute arbitrary script on an unsuspecting user's browser.
For instance - Since, there is no seperation between the posts created by a privileged and an unprivileged user, an unprivileged user can create a post with script to steal the administrator's cookies or perform an action on his behalf.

Mitigation: Input should be properly validated before storing in the database and output from the database should also be properly encoded before displaying it to the user.

@C0deBr8kr
Copy link
Author

Thank you for taking it up so quick. Similar vulnerabilities also exist while creating new tags and users.

@austintoddj
Copy link
Owner

@C0deBr8kr Thank you for writing up such a neatly detailed Issue. Will look into this ASAP.

@reliq
Copy link
Contributor

reliq commented May 4, 2017

@reliq reliq closed this as completed May 4, 2017
@austintoddj austintoddj reopened this May 14, 2017
@austintoddj
Copy link
Owner

@reliq Re-opened with branch xss-protection. Biggest thing to be aware of before finishing the feature is that the integration tests pass.

@fredodev
Copy link

fredodev commented Aug 1, 2017

Not sure how far this can be taken but wanted to note that XSS via markdown is also possible.

e.g. ![a" onerror="alert('Potential XSS');"](x)

Create/modify post:
screen shot 2017-08-01 at 2 43 31 am

Result when visiting post:
screen shot 2017-08-01 at 2 43 42 am

@austintoddj
Copy link
Owner

First off, thanks for taking the time to create the issue. Closing because everything v3.x related will remain as-is and won’t receive anymore updates. The next release is slated for this week, so stay tuned!

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

4 participants