Submitted by MevSec
The Websocket service accepts messages for 32MB size.
File: repos\node\rpc\websockets.go
This size is 3 times bigger than what Golang accepts by default (10MB) on the HTTP service, while there is no reason that websocket payloads are bigger than HTTP payloads. In addition, there is no rate limiting within the code for the websockets.
As a consequence, an external attacker can take down the JSON RPC server by :
When the WebSocket server runs, it listens to the messages with readLoop() (L211).
When a message is received, the message body is put in mb variable. (L222)
This content will then be used to instance a msg variable.
File: repos\node\rpc\websockets.go
Afterwards, some other variables are defined:
Depending on the method, a switch case will determine the execution path.
If the method is unknown, a call is done to tcpGetAndSendResponse():
File: repos\node\rpc\websockets.go
This tcpGetAndSendResponse function will call the RPC, locally with HTTP:
File: repos\node\rpc\websockets.go
However, this function does not perform any sanitation check.
If an attacker sends a 32Mb message on Websockets, it will internally forward the call to the HTTP server with 32Mb payload.
A PoC was developed to exploit the vulnerability with :
The PoC can be found here : https://gist.github.com/0xfadam/2846ee14d67ea95741f27e50570ac77a
The PoC can be launch with the following commands:
A video showing the crash of the server after exploitation can be found below :
https://drive.google.com/open?id=130MD8xBhNPNawRYksuETfP1P0Kr9Zxom&usp=drive_fs
The Zetachain server needs to:
lumtis (ZetaChain) confirmed
0xean (Judge) decreased severity to Medium and commented:
