Skip to content
Account takeover Write-up Intermediate

Changing Any User’s Profile Picture To Account Takeover

The profile picture upload endpoint accepted SVG files with embedded JavaScript without sanitisation, and the save request included a user ID that could be changed to another user's ID. An attacker could set any user's avatar to a malicious SVG and, if the victim opened the image, steal their session cookies and take over the account.

medium.com

Published on medium.com

<?xml version=”1.0" standalone=”no”?> <!DOCTYPE svg PUBLIC “-//W3C//DTD SVG 1.1//EN” “http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg version=”1.1" baseProfile=”full” xmlns=”http://www.w3.org/2000/svg"> <polygon id=”triangle” points=”0,0 0,50 50,0" fill=”#009900" stroke=”#004400"/> <script…

NOOBIEx404, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the server trusted a user-supplied user ID in the avatar save request without verifying ownership, and it accepted SVG uploads without sanitising embedded scripts.

Impact

An attacker could change any user's profile picture to a malicious SVG; if the victim opened the image, JavaScript would run and send their session cookies to the attacker, leading to account takeover.

What the attacker needed

A free account; victim opens the profile picture in a browser

How it was found

  1. Create two accounts, one as victim and one as attacker.
  2. Upload an SVG file containing JavaScript as the attacker's profile picture.
  3. Capture the profile picture save request in Burp Suite.
  4. Change the userid parameter from the attacker's ID to the victim's ID.
  5. Send the request and receive a 200 OK response.
  6. Reload the victim's profile page to see the changed picture, then open the picture to trigger the JavaScript.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

A website let people upload a profile picture, and it allowed a type of image file (SVG) that can contain JavaScript code. The request that saved the picture also included a user ID, and the server did not check that the ID belonged to the person making the request. By changing that ID, the attacker could set another user's picture to a file that runs code when opened, which could steal the victim's login cookies.

What is Account takeover?

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.

Similar reports

View all

Same bug class and techniques, clearest first.

Account takeover

The lesson behind this report.

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.