Skip to content

User profile page vulnerable to Cross Site Scripting (XSS)

Moderate
DogukanUrker published GHSA-mrcw-j96f-p6v6 Jun 16, 2023

Package

flaskBlog (Python)

Affected versions

Master branch

Patched versions

None

Description

Summary

Improper storage and rendering of the /user/<user> page allows a user's comments to execute arbitrary javascript code.

Details

The html template user.html contains the following code snippet to render comments made by a user:
<div class="content" tag="content">{{comment[2]|safe}}</div>

Use of the "safe" tag causes flask to not escape the rendered content.

To remediate this, simply remove the |safe tag from the HTML above.

PoC

  1. Make a post as a user
  2. Leave a comment on the post containing: <script>alert(1);</script>
  3. Browse to your profile page and notice the popup

Impact

Classic cross site scripting vulnerability affecting users who visit the profile of a poster who's post contains scripted comments. It may be possible to write a self-replicating payload to spread this comment like a worm across other profiles.

Severity

Moderate

CVE ID

CVE-2024-22414

Weaknesses

No CWEs

Credits