Date: 27 January 2005
Click here for printable version
Click here for PGP verifiable version
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
===========================================================================
AUSCERT External Security Bulletin Redistribution
ESB-2005.0082 -- iDEFENSE Security Advisory 01.26.05
Openswan XAUTH/PAM Buffer Overflow Vulnerability
27 January 2005
===========================================================================
AusCERT Security Bulletin Summary
---------------------------------
Product: Openswan 1.0.8 and prior
Openswan 2.2.0 and prior
Publisher: iDEFENSE
Operating System: Linux variants
Impact: Execute Arbitrary Code/Commands
Access: Existing Account
Original Bulletin: http://www.idefense.com/application/poi/display?id=190
Comment: Openswan is only vulnerable if compiled with the XAUTH and PAM
options enabled.
- --------------------------BEGIN INCLUDED TEXT--------------------
Openswan XAUTH/PAM Buffer Overflow Vulnerability
iDEFENSE Security Advisory 01.26.05
I. BACKGROUND
Openswan is an open source implementation of IPSEC for the Linux
Operating System. Openswan is based on the discontinued FreeS/WAN
project.
More information is available on the vendor's website:
http://www.openswan.org/
II. DESCRIPTION
Remote exploitation of a stack based buffer overflow vulnerability in
Xelerance Corp.'s Openswan could allow attackers to execute arbitrary
code.
The vulnerability specifically exists due to a lack of bounds checking
in the pluto application when Openswan is compiled with XAUTH and PAM
support. The get_internal_addresses() function in
programs/pluto/xauth.c allocates a small character array and copies an
overly long user controlled buffer into the array as seen below. The
resulting stack overflow may be leveraged to execute arbitrary code
with permissions of the pluto process.
in programs/pluto/id.h:
47: #define IDTOA_BUF 512
in programs/pluto/xauth.c:
148: #ifdef XAUTH_USEPAM
149: int retval;
150: char str[48];
151: #endif
...
169: if(retval == PAM_SUCCESS)
170: {
171: char buf[IDTOA_BUF];
...
185: sprintf(str,"ID=%s", buf);
III. ANALYSIS
Successful exploitation of the vulnerability can allow remote attackers
to execute code with privileges of the pluto process. Exploitation in
the wild will be limited due to the fact that Openswan would need to be
compiled with XAUTH and PAM options enabled which are both disabled by
default. In addition, exploitation occurs after an IKE Phase-1 Security
Association (SA) has been established which requires authentication of
a shared key and the supplied client certificate, further reducing the
impact of this vulnerability.
IV. DETECTION
iDEFENSE has confirmed that Openswan 2.2.0 is vulnerable. All previous
versions of Openswan also contain the vulnerable code.
V. WORKAROUND
The XAUTH and PAM configuration options can be found in Makefile.inc in
the Openswan source tree. Disable both configuration options or apply
the following vendor-supplied patch:
Index: xauth.c
===================================================================
RCS file: /xelerance/master/openswan-2/programs/pluto/xauth.c,v
retrieving revision 1.35
diff -u -p -u -r1.35 xauth.c
- - --- xauth.c 30 Nov 2004 15:30:24 -0000 1.35
+++ xauth.c 8 Jan 2005 02:25:35 -0000
@@ -187,7 +187,7 @@ int get_internal_addresses(struct connec {
#ifdef XAUTH_USEPAM
int retval;
- - - char str[48];
+ char str[IDTOA_BUF+sizeof("ID=")+2];
#endif
#ifdef NAT_TRAVERSAL /* only NAT-T code lets us do virtual ends */
@@ -222,7 +222,7 @@ int get_internal_addresses(struct connec
memmove(buf, c1+3,
strlen(c1) + 1 - 3);
}
}
- - - sprintf(str,"ID=%s", buf);
+ snprintf(str, sizeof(str), "ID=%s", buf);
pam_putenv(con->pamh,str);
pam_open_session(con->pamh,0);
}
VI. VENDOR RESPONSE
The vendor has addressed this vulnerability in newly released Openswan
packages. Users should upgrade to Openswan 1.0.9 or Openswan 2.3.0
depending on their current configuration. New packages are available
from the following link:
http://www.openswan.org/code/
VII. CVE INFORMATION
A Mitre Corp. Common Vulnerabilities and Exposures (CVE) number has not
been assigned yet.
VIII. DISCLOSURE TIMELINE
01/06/2005 Initial vendor notification
01/06/2005 Initial vendor response
01/26/2005 Public disclosure
IX. CREDIT
The discoverer of this vulnerability wishes to remain anonymous.
Get paid for vulnerability research
http://www.idefense.com/poi/teams/vcp.jsp
X. LEGAL NOTICES
Copyright (c) 2005 iDEFENSE, Inc.
Permission is granted for the redistribution of this alert
electronically. It may not be edited in any way without the express
written consent of iDEFENSE. If you wish to reprint the whole or any
part of this alert in any other medium other than electronically, please
email customerservice@idefense.com for permission.
Disclaimer: The information in the advisory is believed to be accurate
at the time of publishing based on currently available information. Use
of the information constitutes acceptance for use in an AS IS condition.
There are no warranties with regard to this information. Neither the
author nor the publisher accepts any liability for any direct, indirect,
or consequential loss or damage arising from use of, or reliance on,
this information.
- --------------------------END INCLUDED TEXT--------------------
You have received this e-mail bulletin as a result of your organisation's
registration with AusCERT. The mailing list you are subscribed to is
maintained within your organisation, so if you do not wish to continue
receiving these bulletins you should contact your local IT manager. If
you do not know who that is, please send an email to auscert@auscert.org.au
and we will forward your request to the appropriate person.
NOTE: Third Party Rights
This security bulletin is provided as a service to AusCERT's members. As
AusCERT did not write the document quoted above, AusCERT has had no control
over its content. The decision to follow or act on information or advice
contained in this security bulletin is the responsibility of each user or
organisation, and should be considered in accordance with your organisation's
site policies and procedures. AusCERT takes no responsibility for consequences
which may arise from following or acting on information or advice contained in
this security bulletin.
NOTE: This is only the original release of the security bulletin. It may
not be updated when updates to the original are made. If downloading at
a later date, it is recommended that the bulletin is retrieved directly
from the author's website to ensure that the information is still current.
Contact information for the authors of the original document is included
in the Security Bulletin above. If you have any questions or need further
information, please contact them directly.
Previous advisories and external security bulletins can be retrieved from:
http://www.auscert.org.au/render.html?cid=1980
If you believe that your computer system has been compromised or attacked in
any way, we encourage you to let us know by completing the secure National IT
Incident Reporting Form at:
http://www.auscert.org.au/render.html?it=3192
===========================================================================
Australian Computer Emergency Response Team
The University of Queensland
Brisbane
Qld 4072
Internet Email: auscert@auscert.org.au
Facsimile: (07) 3365 7031
Telephone: (07) 3365 4417 (International: +61 7 3365 4417)
AusCERT personnel answer during Queensland business hours
which are GMT+10:00 (AEST).
On call after hours for member emergencies only.
===========================================================================
-----BEGIN PGP SIGNATURE-----
Comment: http://www.auscert.org.au/render.html?it=1967
iQCVAwUBQfhIHSh9+71yA2DNAQLrEAP+MSn5YMXkpcO53k4f4Yy0wtwdw8Mgp9aB
ZQUcvTHxxxg/xRjGVTWZ+6gWmIIe6MqxpgmUqAcwXq4+FZWRQ2mN7WIxJUs+Xube
nAM7PI8RGJ/xdJAwxqlXwZR2h8jW8V0rThaxXicYySobljms6vGRe473Q6xumvN1
qB9UPXzZVlU=
=E72I
-----END PGP SIGNATURE-----
|