security: CWE-22: Fix path traversal in certificate export — VC-53779#402
Open
torresashjiancyber wants to merge 1 commit into
Open
security: CWE-22: Fix path traversal in certificate export — VC-53779#402torresashjiancyber wants to merge 1 commit into
torresashjiancyber wants to merge 1 commit into
Conversation
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
Fixed CWE-22 path traversal vulnerability in
Export-CmCertificate(aliasExport-VdcCertificate) that allowed a malicious or compromised TPP server to write arbitrary files on the operator host via craftedFileNamefields in certificate export responses.Finding
CVSS: 8.5 High (CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N)
The function joins the server-supplied
FileNamefield fromPOST /vedsdk/certificates/retrieveresponse to the operator's-OutPathwith only.Trim('"')sanitization before passing to[IO.File]::WriteAllBytes(). This allows path traversal attacks using..,\,/, or rooted paths, enabling arbitrary file write with server-controlled content.Vulnerable code (VenafiPS/Public/Export-CmCertificate.ps1:394):
Remediation
Applied server-supplied filename sanitization using
[IO.Path]::GetFileName()to extract only the leaf name, with validation to detect and reject path traversal attempts:This prevents directory traversal by:
Verification
reports/VC-53779/