Bug 1670364 (CVE-2019-6690)

Summary: CVE-2019-6690 python-gnupg: improper input validation in gnupg.GPG.encrypt() and gnupg.GPG.decrypt()
Product: [Other] Security Response Reporter: msiddiqu
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED WONTFIX QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: bbuckingham, bcourt, bkearney, me, mmccune, msiddiqu, ohadlevy, pwouters, rchan, rjerrido
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: python-gnupg 0.4.4 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-01-20 11:59:13 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1670366, 1670367, 1670368, 1686551    
Bug Blocks: 1670381    

Description msiddiqu 2019-01-29 12:03:31 UTC
From the source : 

We discovered a way to inject data through the passphrase property of the gnupg.GPG.encrypt() and gnupg.GPG.decrypt() methods when symmetric encryption is used. 
The supplied passphrase is not validated for newlines, and the library passes --passphrase-fd=0 to the gpg executable, which expects the passphrase on the first line of stdin, and the ciphertext to be decrypted or plaintext to be encrypted on subsequent lines. 

By supplying a passphrase containing a newline an attacker can control/modify the ciphertext/plaintext being decrypted/encrypted.

Vulnerable in:  python-gnupg 0.4.3 and maybe earlier versions.
Mitigation   :  Users should upgrade to python-gnupg 0.4.4

Upstream     : 

https://github.com/stigtsp/CVE-2019-6690-python-gnupg-vulnerability

https://github.com/vsajip/python-gnupg/commit/39eca266dd837e2ad89c94eb17b7a6f50b25e7cf#diff-88b99bb28683bd5b7e3a204826ead112

https://github.com/vsajip/python-gnupg/commit/3003b654ca1c29b0510a54b9848571b3ad57df19#diff-88b99bb28683bd5b7e3a204826ead112

References   :

https://blog.hackeriet.no/cve-2019-6690-python-gnupg-vulnerability/
https://ctftime.org/task/7458

Comment 1 msiddiqu 2019-01-29 12:04:23 UTC
Created python-gnupg tracking bugs for this issue:

Affects: epel-6 [bug 1670367]
Affects: epel-7 [bug 1670368]
Affects: fedora-all [bug 1670366]

Comment 3 Riccardo Schirone 2019-03-07 16:25:47 UTC
Mitigation:

Filter out newlines from passphrases before passing them to python-gnupg.

Comment 8 Richard Maciel Costa 2019-04-25 03:48:09 UTC
Statement:

The issue affects the versions of python-gnupg shipped with Red Hat Update Infrastructure 3, however the vulnerable functions are never used by the product.

The issue affects the versions of python-gnupg shipped with Red Hat Satellite 6, however the vulnerable functions are never used by the product.

Comment 9 Product Security DevOps Team 2021-01-20 11:59:13 UTC
This bug is now closed. Further updates for individual products will be reflected on the CVE page(s):

https://access.redhat.com/security/cve/cve-2019-6690