Problem in Web Application Feature like chat, let's debug the Root Cause [Problem in Secure WebSocket (wss)]

Tell everybody, what you think about SafeSquid!
Speak your mind!
India aashish97
Posts: 117
Joined: Sat Jul 06, 2019 10:45 am

Problem in Web Application Feature like chat, let's debug the Root Cause [Problem in Secure WebSocket (wss)]

Post by aashish97 » Sat Apr 18, 2020 7:17 am

Hello All,

Before Actually moving towards the explaination let's first try to understand a quick web application design.

Most of the web application uses AJAX Call in other words Application feature few data in the backend and update the frontend without the need of Whole Page Refresh.

Example: Cricket Match Updates ( cricbuzz ) , realtime stats like money control, realtime dashboards of a companies financial stats, websites that provide online video streaming, online chatting, Realtime chatting web apps like WhatsApp Web also uses WebSocket Protocol etc many websites uses such feature to update a specific Section of a web application.

Many Application also use WebSocket Protocol.

A quick Google search explains WebSocket as:
----------------------------------------------------------------
WebSocket is a computer communications protocol, providing full-duplex communication channels over a single TCP connection.
-----------------------------------------------------------------

This WebSocket Protocol (ws) is also plain Text Format and therefore to make it Secure or use secure connection in this protocol, WebSocket Secure ( wss ) is used.

Inorder to establish a secure WebSocket Connection via a Proxy, the respective Application ( example a browser ) will frist send a Connect Request and then initiate the Secure Web Socket Connection ( wss ).

Inorder to use Secure WebSocket via Proxy, the Proxy should be WebSocket Protocol Compatible like Burp Suite , Charles Proxy etc

But SafeSquid is a HTTP Proxy Server, it does not support WebSocket Protocol as till now.

Therefore any web application using Secure WebSocket Protocol will not be able establish Connection to the server
Inorder to let the Application use WebSocket Protocol we need to bypass it from SSL Inspection.

The below Post Explains such a scenario where the client complains of a website where chat is not working because it uses WebSocket Protocol and how to debug such a problem easily using browser based debugging tool.

This post helps user to understand the problem faced when using SAFESQUID-SWG with SSL INSPECTION ENABLED on web application which uses 【 SECURE 】WebSocket for different purposes like chat portal, online video conferencing, messaging syncing like live feeds (cricket updates )

Client reported problem faced by them : Samsung website chat not working .

Some Web Applications Connect to other Web Services [They use Third Party Applications like ChatBots]

To get a better picture on the actual problem.
The Debugging Tool can provide some good information like one shown below.

Press F12 on the window which is facing the problem.

The "Console" Tab should be able to provide some information regarding such problem.

[attachment=0]websocketProblemInSamSung.png[/attachment]

Quick Test Case:
for such chat applications error a WebSocket keyword should be more than enough

While troubleshooting in the client setup just via the browser we were able to quickly understand the problem and fix it.

The debugging tool helped us solve the problem.
In the console window, we can see that their is an WebSocket connect establishment error.

i.e In the below screenshot "SAMSUNG" uses ChatBots which connects to "chatbot.ase1.ecom-mobile-samsung.com".

The debugging tool helps us understand the actual reason why the web application is not able to work properly.

If the connection to the server is showing error then the web application will not provide proper functionality.

Debugging tool are quick and effective way to understand the problem on the client setup.

This also explains us the actual problem.
Sometimes the problem is also due to the web browser as explained in the previous post.
Attachments
websocketProblemInSamSung.png
websocketProblemInSamSung.png (147.32 KiB) Viewed 1339 times