Skip to content
Access control Write-up Intermediate

What is a WebSocket?

The application established a WebSocket before MFA was completed and returned confidential content based only on a user ID, with no authentication or authorization on the socket. An attacker could supply any user ID to retrieve that user's confidential content, and a malicious web page could open the socket and exfiltrate data because WebSockets are not bound by the Same Origin Policy.

blog.secureideas.com

Published on blog.secureideas.com

This is the story from one of our recent penetration testing engagements. Still, the story is a familiar one for those who are testing newer web applications that use one of the multitudes of evolving web app platforms built on a poorly understood technology stack.

The author, on blog.secureideas.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 WebSocket endpoint performed no authentication or authorization and relied solely on a user-supplied ID to select confidential content, and it was opened before MFA was completed.

Impact

An unauthenticated attacker could retrieve any user's confidential content given only the user's ID, and a malicious web page could open the socket and exfiltrate data, including from an internal network, without triggering pattern-based defences.

What the attacker needed

Knowledge of a valid user ID; ability to open a WebSocket to the server

The fix

The WebSocket should authenticate and authorize every connection and message, and confidential content should not be sent until MFA is complete.

How it was found

  1. Map the application and notice WebSocket traffic in the proxy history.
  2. Observe that the WebSocket is established before MFA is completed and confidential content is pushed to the browser.
  3. Write a proof-of-concept page that opens a WebSocket, sends a user ID, and listens for messages.
  4. Supply different user IDs over the same WebSocket and confirm that both users' confidential content is returned.

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 WebSocket is a persistent two-way connection between a browser and a server, different from normal web requests. Here the server sent private content over that connection before the user had finished a second login step, and it trusted only a user ID to decide whose content to send. Because any website can open a WebSocket to another server, a malicious page could also read that private content.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.