The vulnerability, CVE-2026-40981, is an authorization bypass in Spring Cloud Config's Google Secrets Manager backend. The root cause was that the application trusted the X-Project-ID HTTP header sent by the client to determine which Google Cloud Project to retrieve secrets from. There was no validation to ensure the requested project was one the client was authorized to access.
The analysis of the patch between vulnerable version 5.0.2 and fixed version 5.0.3 revealed that the fix was implemented in commit 4e93ce54d0c0abcbcdfaba3a6833a93afe8f59bc. The key change was the introduction of a new class, GcpProjectResolutionSupport, and a new configuration property, spring.cloud.config.server.gcp-secret-manager.allowed-project-ids.
The vulnerable methods, getSecrets() and checkRemotePermissions() in the GoogleSecretManagerV1AccessStrategy class, previously called a private method getProjectId() that directly read and used the project ID from the X-Project-ID header. An attacker could craft a request with this header pointing to any GCP project, and if the Spring Cloud Config server had credentials with access to that project, it would return the secrets.
The patch refactored the logic to use GcpProjectResolutionSupport. This new component now validates the project ID from the header against the allowed-project-ids list when token-mandatory is false. If the list is empty, no client-supplied project IDs are allowed, effectively mitigating the vulnerability. This ensures that clients can only request secrets from projects explicitly allowed by the server's configuration.