Skip to content

Conversation

@JohannesLks
Copy link

Fixes #526
The regex -----BEGIN .* PRIVATE KEY.*----- was matching -----BEGIN PGP PRIVATE KEY BLOCK----- in /etc/ImageMagick-6/mime.xml, causing a false positive for SSH keys.

Fixed by removing the trailing .* before ----- so the regex now requires the key header to end directly with -----, which excludes PGP key definitions that have BLOCK-----` at the end.

Tested key types still detected:

  • RSA PRIVATE KEY
  • EC PRIVATE KEY
  • OPENSSH PRIVATE KEY
  • DSA PRIVATE KEY

The regex '-----BEGIN .* PRIVATE KEY.*-----' was matching
'-----BEGIN PGP PRIVATE KEY BLOCK-----' in /etc/ImageMagick-6/mime.xml,
causing a false positive for SSH keys.

Fixed by removing the trailing .* before ----- so the regex now requires
the key header to end directly with -----, which excludes PGP key
definitions that have 'BLOCK-----' at the end.

Tested key types still detected:
- RSA PRIVATE KEY
- EC PRIVATE KEY
- OPENSSH PRIVATE KEY
- DSA PRIVATE KEY
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.

ImageMagick "SSH key" false positive

1 participant