Skip to content
This repository was archived by the owner on Jun 1, 2026. It is now read-only.

security: CWE-377: Insecure tmp private keys — VC-53731#145

Open
torresashjiancyber wants to merge 1 commit into
Venafi:mainfrom
torresashjiancyber:VC-53731-logos-fix-c
Open

security: CWE-377: Insecure tmp private keys — VC-53731#145
torresashjiancyber wants to merge 1 commit into
Venafi:mainfrom
torresashjiancyber:VC-53731-logos-fix-c

Conversation

@torresashjiancyber

Copy link
Copy Markdown

Summary

Fixes CWE-377 (Insecure Temporary File) vulnerability in certificate issuance scripts that were writing private keys to /tmp with world-readable permissions.

Finding

The issue-cert.sh scripts in both projects/ccm-idp/ and projects/secrets-manager/ were creating private key files in predictable /tmp locations with default permissions (0644), allowing any local user to read the private keys before they were moved or deleted.

CVSS: 5.7 (CVSS:4.0/AV:L/AC:L/AT:P/PR:L/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N)

Remediation

Applied the following security hardening measures:

  1. Set restrictive umask: Added umask 077 at script initialization to ensure all created files have 0600 permissions (readable/writable only by owner)
  2. Secure temp directory creation: Replaced predictable /tmp/$cn and /tmp/${CERT_NAME} paths with mktemp -d for cryptographically secure temporary directory creation
  3. Automatic cleanup: Added trap 'rm -rf "$tmp_dir"' EXIT to ensure temporary files are deleted on script exit (success or failure)

Verification

  • No build or test infrastructure detected in repository
  • Changes verified by code review
  • Private keys now created with 0600 permissions in secure temporary directories
  • Cleanup trap ensures no residual key material on disk

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant