InfoSec Write-ups

A collection of write-ups from the best hackers in the world on topics ranging from bug bounties and CTFs to vulnhub machines, hardware challenges and real life encounters. Subscribe to our weekly newsletter for the coolest infosec updates: https://weekly.infosecwriteups.com/

Follow publication

Manipulating the WebSocket handshake to exploit vulnerabilities

Postswigger Lab Simple Solution — Manipulating the WebSocket to exploit vulnerabilities | Karthikeyan Nagaraj

Karthikeyan Nagaraj
InfoSec Write-ups
Published in
4 min readJan 16, 2023

--

Lab Description:

This online shop has a live chat feature implemented using WebSockets.

It has an aggressive but flawed XSS filter.

To solve the lab, use a WebSocket message to trigger an alert() popup in the support agent's browser.

What is a WebSocket?

WebSockets are becoming increasingly popular because they greatly simplify the communication between a client and a server.

The WebSocket protocol uses the OSI model application layer (Layer 7) to allow a client and server to perform bidirectional (full duplex) communication. This makes it possible to create dynamic, real-time web applications such as instant messaging and photo-sharing apps.

WebSockets overcome some of the traditional restrictions of communications between browsers and servers:

  • Client requests/server responds — n the past servers had permanent listeners. The client (the one using the browser) didn’t have a fixed listener for long-term connections. This made each communication centered around the client's demands and the server's response.
  • Communication is dependent on the client — the server can only push a resource to a client when the client requests it.
  • Continual checking — clients are constantly forced to refresh results from the server. This is why libraries focus on making all asynchronous calls optimized. They also have to identify their response. The most common solution to this problem is the use of callback functions.

Analysis:

  1. First of all, let’s try the live chat Functionality and Intercept try to Intercept the traffic using Burpsuite

2. Send the Request you find on Websocket History to the Repeater

--

--

Published in InfoSec Write-ups

A collection of write-ups from the best hackers in the world on topics ranging from bug bounties and CTFs to vulnhub machines, hardware challenges and real life encounters. Subscribe to our weekly newsletter for the coolest infosec updates: https://weekly.infosecwriteups.com/

Written by Karthikeyan Nagaraj

Entrepreneur | Writer | Cyber Security Consultant | AI Researcher TopMate - https://topmate.io/cyberw1ng

No responses yet

Write a response