security: CWE-326: Replace DES with AES256 for SSH legacy PEM encryption — VC-53763#660
Open
torresashjiancyber wants to merge 1 commit into
Open
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
Replaces weak single-DES (56-bit) encryption with AES-256 for SSH RSA private keys when using
--format legacy-peminvcert sshenroll.Finding
CWE-326 / CWE-327:
encodePrivKeyToPEM()inpkg/util/sshKeyGenerator.gowas hard-coded to usePEMCipherDES(single 56-bit DES) when encrypting SSH RSA private keys with thelegacy-pemformat. This cipher is cryptographically weak and susceptible to exhaustive key search regardless of passphrase strength.The vulnerable line at
pkg/util/sshKeyGenerator.go:44used:Remediation
Changed the cipher parameter from
PEMCipherDEStoPEMCipherAES256to align with the encryption used in all other legacy-PEM code paths in the codebase (e.g.,pkg/util/utils.go:77,82).Changed file:
pkg/util/sshKeyGenerator.go: Line 44 - replacedPEMCipherDESwithPEMCipherAES256Verification
This is a minimal, single-token change that upgrades the encryption cipher from 56-bit DES to 256-bit AES for password-protected SSH private keys in legacy PEM format, matching the existing security standard used elsewhere in the codebase.
Auto-generated by Project Logos Pattern-C remediation (VC-53763)