# CVE-2024-40636: Basic Auth Credential Leakage to Logs After Fetch Registry Error in Steeltoe.Discovery.Eureka with Peer Awareness

> Attackers with log access can view unmasked Basic Auth credentials when multiple Eureka server URLs are configured and a fetch error occurs.

- **Severity:** Medium 5.3 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 17 Jul 2024
- **Updated:** 2 Aug 2024
- **Also known as:** GHSA-vmcp-66r5-3pcp

## What is CVE-2024-40636?

CVE-2024-40636 is a medium-severity vulnerability in SteeltoeOSS security-advisories, published on 17 Jul 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

Steeltoe is an open source project that provides a collection of libraries that helps users build production-grade cloud-native applications using externalized configuration, service discovery, distributed tracing, application management, and more. When utilizing multiple Eureka server service URLs with basic auth and encountering an issue with fetching the service registry, an error is logged with the Eureka server service URLs but only the first URL is masked. The code in question is  `_logger.LogError(e, "FetchRegistry Failed for Eureka service urls: {EurekaServerServiceUrls}", new Uri(ClientConfig.EurekaServerServiceUrls).ToMaskedString());` in the `DiscoveryClient.cs` file which may leak credentials into logs. This issue has been addressed in version 3.2.8 of the Steeltoe.Discovery.Eureka nuget package.

Weakness: CWE-532 (Insertion of Sensitive Information into Log File)

## Which versions are affected by CVE-2024-40636?

8 open source packages ship an affected version, including Steeltoe.Discovery.ClientAutofac, Steeltoe.Discovery.ClientCore and Steeltoe.Discovery.Eureka.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `Steeltoe.Discovery.ClientAutofac` | NuGet | All versions to 2.5.5 | None |
| `Steeltoe.Discovery.ClientAutofac` | NuGet | All versions to 2.5.5 | None |
| `Steeltoe.Discovery.ClientCore` | NuGet | All versions | None |
| `Steeltoe.Discovery.ClientCore` | NuGet | All versions | None |
| `Steeltoe.Discovery.Eureka` | NuGet | All versions | 3.2.8 |
| `Steeltoe.Discovery.Eureka` | NuGet | All versions | 3.2.8 |
| `Steeltoe.Discovery.EurekaBase` | NuGet | All versions to 2.5.5 | None |
| `Steeltoe.Discovery.EurekaBase` | NuGet | All versions to 2.5.5 | None |

## How do I fix CVE-2024-40636?

Upgrade to a fixed version.

## Is CVE-2024-40636 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-40636 exists.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-40636 and fix it if it is affected.

What it is: CVE-2024-40636 is a medium-severity vulnerability in SteeltoeOSS security-advisories, published on 17 Jul 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-40636 exists.

Affected packages and fixed versions:
- Steeltoe.Discovery.ClientAutofac (NuGet): affected all versions up to 2.5.5; no fix listed
- Steeltoe.Discovery.ClientAutofac (NuGet): affected all versions up to 2.5.5; no fix listed
- Steeltoe.Discovery.ClientCore (NuGet): affected all versions; no fix listed
- Steeltoe.Discovery.ClientCore (NuGet): affected all versions; no fix listed
- Steeltoe.Discovery.Eureka (NuGet): affected all versions; fixed in 3.2.8
- Steeltoe.Discovery.Eureka (NuGet): affected all versions; fixed in 3.2.8
- Steeltoe.Discovery.EurekaBase (NuGet): affected all versions up to 2.5.5; no fix listed
- Steeltoe.Discovery.EurekaBase (NuGet): affected all versions up to 2.5.5; no fix listed

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2024-40636/ (Markdown: https://insights.sbomify.com/CVE-2024-40636/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2024-40636
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2024-40636
- OSV: https://osv.dev/vulnerability/CVE-2024-40636

---
From sbomify Insights: https://insights.sbomify.com/CVE-2024-40636/
Summaries are generated and may contain mistakes; the official description above is the record.
