Bug 547662 (CVE-2009-4034)

Summary: CVE-2009-4034 postgresql: incorrect verification of SSL certificates with NUL in name
Product: [Other] Security Response Reporter: Tomas Hoger <thoger>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: low Docs Contact:
Priority: low    
Version: unspecifiedCC: mjc, tgl, vdanen
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-02-22 16:33:14 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: 552617    
Bug Blocks:    

Description Tomas Hoger 2009-12-15 10:55:07 UTC
A CVE-2009-2408-like flaw was found in the way PostgreSQL handled CommonNames with embedded NUL character (\0) in SSL certificates.  An attacker able to get a specially-crafted certificate signed by the CA trusted by PostgreSQL client or server could use this flaw to perform a MITM attack against the client, or authenticate as different user when client certificate authentication was configured on the server.

Description from the upstream security page:

  http://www.postgresql.org/support/security.html

  NULL Bytes in SSL Certificates can be used to falsify client or server
  authentication. This only affects users who have SSL enabled, perform
  certificate name validation or client certificate authentication, and
  where the Certificate Authority (CA) has been tricked into issuing invalid
  certificates. The use of a CA that can be trusted to always issue valid
  certificates is recommended to ensure you are not vulnerable to this issue.

  Affected versions:
  8.4, 8.3, 8.2, 8.1, 8.0, 7.4

  Fixed in:
  8.4.2, 8.3.9, 8.2.15, 8.1.19, 8.0.23, 7.4.27

Upstream commit:
http://git.postgresql.org/gitweb?p=postgresql.git;a=commitdiff;h=6d468770312724fced8b9913ec2065096d473344

Comment 1 Tomas Hoger 2009-12-15 11:01:32 UTC
While the upstream applied the fix to all currently supported versions, this really only is a security flaw in 8.4 and later versions.  Previous versions do not compare connection host name with the certificate CommonName at all.  Client certificate authentication was also only introduced in 8.4.

With the patch applied in older versions, a certificate with \0 in CN will cause the client to abort connection even though no other name validation is performed.

We are not treating this as security in pre-8.4 versions.  Future postgresql packages updates may, however, contain this fix (e.g. when rebasing to newer upstream point releases).

Comment 3 Fedora Update System 2009-12-16 17:11:10 UTC
postgresql-8.3.9-1.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/postgresql-8.3.9-1.fc11

Comment 4 Fedora Update System 2009-12-18 04:36:21 UTC
postgresql-8.3.9-1.fc11 has been pushed to the Fedora 11 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 5 Fedora Update System 2009-12-18 04:39:40 UTC
postgresql-8.4.2-1.fc12 has been pushed to the Fedora 12 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 7 Tomas Hoger 2010-02-22 16:33:14 UTC
Fixed in Fedora, not a security flaw for Red Hat Enterprise Linux 3, 4 and 5 (see comment #1).