Skip to content

Missing Origin Validation in WebSockets

Moderate
louislam published GHSA-mj22-23ff-2hrr Dec 10, 2023

Package

docker louislam/dockge (Docker)

Affected versions

<= 1.3.2

Patched versions

1.3.3
docker louislam/uptime-kuma (Docker)
<= 1.23.8
1.23.9

Description

Summary

The application uses WebSocket (with Socket.io), but it does not verify that the source of communication is valid. This allows third-party website to access the application on behalf of their client.

Details

When connecting to the server using Socket.IO, the server does not validate the Origin header leading to other site being able to open connections to the server and communicate with it.

Other website still need to authenticate to access most features, however this can circumvent reverse proxy or firewall protections made in place by users deploying the application.

PoC

On another origin, you can serve the following HTML document.

<script src="https://cdn.socket.io/4.7.2/socket.io.min.js"></script>
<script>
        const socket = io("wss://[TARGET_WEBSITE]", { transports: ["websocket"] });
        socket.emit("getGameList", console.log.bind(console))
</script>

image

Impact

Without origin validation, Javascript executed from another origin would be allowed to connect to the application without any user interaction. Without login credentials, such a connection is unable to access protected endpoints containing sensitive data of the application. However, such a connection may allow attacker to further exploit unseen vulnerabilities of the application.

Users with "No-auth" mode configured who are relying on a reverse proxy or firewall to provide protection to the application would be especially vulnerable as it would grant the attacker full access to the application.

Remediation

Additional verification of the HTTP Origin header has been added to the socket.io connection handler. By default, if the Origin header is present, it would be checked against the Host header. Connection would be denied if the hostnames do not match, which would indicate that the request is cross-origin. Connection would be allowed if the Origin header is not present.

Users can override this behaviour by setting environment variable UPTIME_KUMA_WS_ORIGIN_CHECK=bypass.

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
High
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
Low
Availability
Low

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:L/A:L

CVE ID

CVE-2023-49805

Weaknesses

Credits