Home page logo

bugtraq logo Bugtraq mailing list archives

FreeBSD Ports Security Advisory FreeBSD-SA-02:14.pam-pgsql
From: FreeBSD Security Advisories <security-advisories () freebsd org>
Date: Tue, 12 Mar 2002 06:27:51 -0800 (PST)


FreeBSD-SA-02:14                                            Security Advisory
                                                                FreeBSD, Inc.

Topic:          pam-pgsql port authentication bypass

Category:       ports
Module:         pam-pgsql
Announced:      2002-03-12
Credits:        Jacques A. Vidrine <nectar () FreeBSD org>
Affects:        pam-pgsql port prior to pam-pgsql-0.5.2
Corrected:      2002-01-21 20:06:05 UTC
FreeBSD only:   NO

I.   Background

pam-pgsql is a PAM module which allows PAM-enabled applications such
as login(1) to use a PostgreSQL database for user authentication.

II.  Problem Description

The affected versions of the pam-pgsql port contain a vulnerability
that may allow a remote user to cause arbitrary SQL code to be
executed.  pam-pgsql constructs a SQL statement to be executed by the
PostgreSQL server in order to lookup user information, verify user
passwords, and change user passwords.  The username and password given
by the user is inserted into the SQL statement without any quoting or
other safety checks.

The pam-pgsql port is not installed by default, nor is it "part of
FreeBSD" as such: it is part of the FreeBSD ports collection, which
contains thousands of third-party applications in a ready-to-install
format. The ports collection shipped with FreeBSD 4.4 contains this
problem since it was discovered after the release.

FreeBSD makes no claim about the security of these third-party
applications, although an effort is underway to provide a security
audit of the most security-critical ports.

III. Impact

A user interacting with a PAM-enabled application may insert arbitrary
SQL code into the username or password fields during authentication or
while changing passwords, leading to several exploit opportunities.
In all versions of the pam-pgsql port prior to 0.5.2, attackers may
add or change user account records.  In addition, in versions of the
pam-pgsql port prior to 0.3, attackers may cause pam-pgsql to
completely bypass password authentication, allowing them to
authenticate as any user and obtain unauthorized access using the
PAM-enabled application.  Since common PAM applications include
login(1) and sshd(8), both local and remote attacks are possible.

IV.  Workaround

1) Deinstall the pam-pgsql port/package if you have it installed.

V.   Solution

One of the following:

1) Upgrade your entire ports collection and rebuild the port.

2) Download a new port skeleton for the pam-pgsql port from:


and use it to rebuild the port.

3) Use the portcheckout utility to automate option (2) above. The
portcheckout port is available in /usr/ports/devel/portcheckout or the
package can be obtained from:


VI.  Correction details

The following list contains the revision numbers of each file that was
corrected in the FreeBSD Ports Collection.

Path                                                             Revision
- -------------------------------------------------------------------------
ports/security/pam-pgsql/Makefile                                     1.9
ports/security/pam-pgsql/distinfo                                     1.3
ports/security/pam-pgsql/pkg-descr                                    1.2
- -------------------------------------------------------------------------

VII. References

This vulnerability is very similar to previous vulnerabilities
involving Apache modules and discovered by RUS-CERT.
Version: GnuPG v1.0.6 (FreeBSD)
Comment: For info see http://www.gnupg.org


  By Date           By Thread  

Current thread:
  • FreeBSD Ports Security Advisory FreeBSD-SA-02:14.pam-pgsql FreeBSD Security Advisories (Mar 13)
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]