Bug 929223 (CVE-2013-1899)

Summary: CVE-2013-1899 postgresql: Insecure switch parsing
Product: [Other] Security Response Reporter: Jan Lieskovsky <jlieskov>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: unspecifiedCC: jfrey, jrafanie, security-response-team, tgl
Target Milestone: ---Keywords: Reopened, Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard: impact=important,public=20130404,reported=20130327,source=upstream,cvss2=5.0/AV:N/AC:L/Au:N/C:N/I:N/A:P,rhel-5/postgresql=notaffected,rhel-5/postgresql84=notaffected,rhel-6/postgresql=notaffected,fedora-all/postgresql=affected,cfme-5/postgresql=wontfix
Fixed In Version: PostgreSQL 9.0.13, PostgreSQL 9.1.9, PostgreSQL 9.2.4 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-10-08 15:26:55 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On: 947202, 948308, 948312    
Bug Blocks: 929332    

Description Jan Lieskovsky 2013-03-29 10:48:40 EDT
A denial of service flaw was found in the way command switch parsing logic of PostgreSQL, an advanced Object-Relational database management system, processed certain database names (a database name beginning with '-' character was interpreted as it if were a command line switch for a standalone backend). A remote attacker could issue a specially-crafted SQL query that, when processed by the PostgreSQL server would lead to unauthorized modification of the server's configuration file or attacker's ability to replace server's critical database / table with a junk file (of their choose), during the server's crash recovery process (denial of service).
Comment 2 Jan Lieskovsky 2013-03-29 10:58:01 EDT
This issue does NOT affect the version of the postgresql package, as shipped with Red Hat Enterprise Linux 5.

--

This issue does NOT affect the version of the postgresql84 package, as shipped with Red Hat Enterprise Linux 5.

--

This issue does NOT affect the version of the postgresql package, as shipped with Red Hat Enterprise Linux 6.

--

This issue affects the versions of the postgresql package, as shipped with Fedora release of 17 and 18.
Comment 3 Jan Lieskovsky 2013-03-29 11:02:13 EDT
Acknowledgements:

Red Hat would like to thank the PostgreSQL project for reporting this issue. Upstream acknowledges Mitsumasa Kondo and Kyotaro Horiguchi as the original issue reporters.
Comment 6 Huzaifa S. Sidhpurwala 2013-04-01 02:51:38 EDT
Statement:

Not Vulnerable. This issue does not affect the version of postgresql as shipped with Red Hat Enterprise Linux 5 and 6. This issue does not affect the version of postgresql84 as shipped with Red Hat Enterprise Linux 5.
Comment 16 Vincent Danen 2013-04-04 10:42:10 EDT
Created postgresql tracking bugs for this issue

Affects: fedora-all [bug 948312]
Comment 17 Tomas Hoger 2013-04-04 10:56:02 EDT
Upstream announcement:

http://www.postgresql.org/about/news/1456/
Comment 18 Fedora Update System 2013-04-05 18:59:19 EDT
postgresql-9.2.4-1.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 19 Fedora Update System 2013-04-05 19:11:31 EDT
postgresql-9.1.9-1.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 20 Tomas Hoger 2013-04-07 15:53:01 EDT
Upstream FAQ for this issue:

http://www.postgresql.org/support/security/faq/2013-04-04/
Comment 22 Tomas Hoger 2013-04-10 01:55:51 EDT
LWN article related to this issue, from Josh Berkus is of the PostgreSQL Core Team:

https://lwn.net/Articles/546550/
Comment 23 Tomas Hoger 2013-04-10 01:57:09 EDT
Metasploit scanner to identify vulnerable PostgreSQL versions:

http://dev.metasploit.com/redmine/projects/framework/repository/entry/modules/auxiliary/scanner/postgres/postgres_dbname_flag_injection.rb
Comment 24 Jan Lieskovsky 2013-04-11 02:54:30 EDT
Third party analysis of the issue (and possible consequences):

http://blog.blackwinghq.com/2013/04/08/2/
Comment 25 Fedora Update System 2013-04-20 15:59:22 EDT
postgresql-9.2.4-1.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.