security: CWE-295: Fix TLS bypass persistent vulnerability — VC-53780#403
Open
torresashjiancyber wants to merge 1 commit into
Open
security: CWE-295: Fix TLS bypass persistent vulnerability — VC-53780#403torresashjiancyber wants to merge 1 commit into
torresashjiancyber wants to merge 1 commit into
Conversation
…estore Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> VC-53780
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes CWE-295 (Improper Certificate Validation) by addressing two defects in certificate validation bypass:
Process-global policy leak (PS5.1): The module now captures and restores the original certificate policy in a
finallyblock, preventing the accept-all policy from persisting beyond the intended request.Silent vault metadata restoration: The module now emits
Write-WarningwhenSkipCertificateCheckis restored from vault metadata, making the security downgrade visible to operators and in CI logs.Finding
CWE-295: Improper Certificate Validation
VenafiPS/Public/Invoke-TrustRestMethod.ps1VenafiPS/Private/Invoke-TrustGraphQL.ps1VenafiPS/Public/New-TrustClient.ps1Defect 1: Process-Global Certificate Policy
On Windows PowerShell 5.1, when
-SkipCertificateCheckis used, the module assigns a permanent accept-allICertificatePolicyto the process-global[System.Net.ServicePointManager]::CertificatePolicywith no restoration. This causes every subsequent HTTPS call in the process (to any server) to silently accept forged certificates.Defect 2: Silent Vault Metadata Persistence
When a session is saved with
-VaultAccessTokenName/-VaultRefreshTokenName, theSkipCertificateCheckflag is persisted to vault metadata and silently re-applied on every future session restore, even months later and without any visible indication on the command line.Remediation
Fix for Defect 1 (Process-Global Policy Leak)
Files:
Invoke-TrustRestMethod.ps1,Invoke-TrustGraphQL.ps1$originalCertificatePolicy = $nullbefore the certificate check block$originalCertificatePolicy = [System.Net.ServicePointManager]::CertificatePolicyfinallyblock that already restores$ProgressPreferenceThe accept-all policy is now only in force for the duration of the single
Invoke-WebRequest/Invoke-RestMethodcall.Fix for Defect 2 (Silent Vault Restore)
File:
New-TrustClient.ps1Added
Write-Warningimmediately after restoredSkipCertificateCheckis applied in bothVaultAccessTokenandVaultRefreshTokenparameter sets (2 locations):The flag is still honored (no behavior change for operators who deliberately seeded it), but the downgrade is now visible in interactive consoles and CI logs.
Verification
Changes Applied:
Write-Warning,$nullchecks)Impact:
-SkipCertificateCheck)SkipCertificateCheckis not used or not stored in vaultTesting:
finallyblock brace balance preserved🤖 Generated by Project Logos Pattern-C security remediation