Skip to content

security: CWE-295: Fix insecure IdP transport — VC-53762#661

Open
torresashjiancyber wants to merge 1 commit into
Venafi:masterfrom
torresashjiancyber:VC-53762-logos-fix-c
Open

security: CWE-295: Fix insecure IdP transport — VC-53762#661
torresashjiancyber wants to merge 1 commit into
Venafi:masterfrom
torresashjiancyber:VC-53762-logos-fix-c

Conversation

@torresashjiancyber
Copy link
Copy Markdown

Summary

Fixed CWE-295 vulnerability where OAuth2 token requests to the OIDC IdP could inherit the insecure global http.DefaultTransport when --insecure flag is set, exposing credentials to TLS MITM attacks.

Finding

CWE-295 / CWE-757: Improper Certificate Validation
CVSS: 8.2

The Firefly connector's Authorize() method used context.Background() for OAuth2 token calls (config.Token() and config.PasswordCredentialsToken()). When the global http.DefaultTransport has InsecureSkipVerify:true set (via --insecure flag in cmdHelper.go:170), these calls silently disable certificate validation for the IdP token endpoint, exposing client_secret and passwords to TLS MITM attacks.

Vulnerable code locations:

  • pkg/venafi/firefly/connector.go:148 - config.Token(context.Background())
  • pkg/venafi/firefly/connector.go:176 - config.PasswordCredentialsToken(context.Background(), ...)

Remediation

Created a dedicated TLS-verified HTTP client and injected it into the OAuth2 context:

idpClient := &http.Client{
    Transport: &http.Transport{
        Proxy: http.ProxyFromEnvironment,
    },
}
idpCtx := context.WithValue(context.Background(), oauth2.HTTPClient, idpClient)

Both token calls now use idpCtx instead of context.Background(), ensuring IdP communication always validates certificates regardless of the global --insecure setting.

Verification

  • Modified 1 file: pkg/venafi/firefly/connector.go
  • Added dedicated secure HTTP client for IdP token requests
  • IdP token endpoints now enforce certificate validation independently of global transport settings

Note: Build/test failures are due to Go toolchain environment issues unrelated to this security fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant