Canvas: XSS vulnerability in creating Posts

Created on 23 Apr 2017  路  6Comments  路  Source: austintoddj/canvas

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 in the Title,'some subtitle' in subtitle and 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.

Most helpful comment

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

All 6 comments

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

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

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

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

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

austintoddj picture austintoddj  路  10Comments

hide-me picture hide-me  路  5Comments

connecteev picture connecteev  路  4Comments

prestontoor picture prestontoor  路  4Comments

karlmonson picture karlmonson  路  10Comments