Skip to content

laf logs leak

Critical
maslow published GHSA-g9c8-wh35-g75f Jan 3, 2024

Package

laf

Affected versions

< v1.0.0-beta.13

Patched versions

None

Description

Summary

In the Laf version design, the log uses communication with k8s to quickly retrieve logs from the container without the need for additional storage; However, this interface does not verify the permissions of the pod, which allows authenticated users to obtain any pod logs under the same namespace through this method, thereby obtaining sensitive information printed in the logs.

Details

The new version of LAF log directly obtains container logs through client node, but the authentication of this interface only passes the dual authentication of 'JwtAuthGuard' and 'Application AuthGuard'. In other words, as long as my Jwt and appID are legal enough, it can pass the verification.

The current goal is to construct a communication channel, where client node obtains specific log content through ns and podName; PodName is controllable, we only need to find the corresponding podName to view its log information.

There is no network isolation in each container of LAF. We successfully sniffed Prometheus through service detection of the cluster, but unfortunately, we were unable to access Prometheus. Upon closer inspection of the code, we found that feature (server): support resource monitor (#1468) restricted Prometheus's network access, requiring it to be a container under the same ns. Currently, the two ns of LAF in the public cloud are still distinguished, It's a bit regrettable.

However, Prometheus components are usually not authenticated, so we can access metrics information and successfully obtain relevant metadata information for all clusters:

curl http://prometheus-kube-state-metrics.xxxxxx:8080/metrics

now we can use this infomation to create a poc, first login and get your own token, then:

curl https://laf.run/v1/apps/xxxx/logs/<container_name>\?containerName\=<container> -H "Authorization: Bearer <YOUR_SELF_TOKEN>"

PoC

curl https://laf.run/v1/apps/xxxx/logs/<container_name>\?containerName\=<container> -H "Authorization: Bearer <YOUR_SELF_TOKEN>"

Impact

all users in laf.

Severity

Critical

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
None
User interaction
Required
Scope
Changed
Confidentiality
High
Integrity
High
Availability
High

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:N/UI:R/S:C/C:H/I:H/A:H

CVE ID

CVE-2023-50253

Weaknesses

Credits