SecurityTracker.com
Keep Track of the Latest Vulnerabilities
with SecurityTracker!
    Home    |    View Topics    |    Search    |    Contact Us    |    Help    |   

SecurityTracker
Archives


Welcome to SecurityTracker!
 
Click to Sign Up
Sign Up
Sign Up for Your FREE Weekly SecurityTracker E-mail Alert Summary
Instant Alerts
Buy our Premium Vulnerability Notification Service to receive customized, instant alerts
Affiliates
Put SecurityTracker Vulnerability Alerts on Your Web Site -- It's Free!
Partners
Become a Partner and License Our Database or Notification Service
Report a Bug
Report a vulnerability that you have found to SecurityTracker
bugs
@
securitytracker.com

Sign Up!





Category:  Application (VPN)  >  Openswan Vendors:  openswan.org
Openswan Pluto get_internal_addresses() Remote Buffer Overflow Lets Remote Authenticated Users Execute Arbitrary Code
SecurityTracker Alert ID:  1013014
SecurityTracker URL:  http://securitytracker.com/id?1013014
CVE Reference:  CAN-2005-0162   (Links to External Site)
OSVDB Reference:  13195   (Links to External Site)
Updated:  Jan 30 2005
Original Entry Date:  Jan 27 2005
Impact:  Execution of arbitrary code via network, User access via network
Fix Available:  Yes   Vendor Confirmed:  Yes  
Advisory:  iDEFENSE
Version(s): prior to versions 1.0.9 and 2.3.0
Description:  iDEFENSE reported a buffer overflow vulnerability in Openswan. A remote authenticated user may be able to execute arbitrary code on the target system.

If Openswan is compiled with XAUTH and PAM options enabled (not the default configuration), then a remote user with a valid shared key and client certificate can supply specially crafted input to trigger a buffer overflow in the 'pluto' component. The overflow occurs only after an IKE Phase-1 security association has been negotiated.

The flaw resides in the get_internal_addresses() function in 'programs/pluto/xauth.c', where a 512 byte buffer based on user-supplied data is copied into a 32 byte buffer.

The vendor was notified on January 6, 2005.

The original advisory is available at:

http://www.idefense.com/application/poi/display?id=190&type=vulnerabilities

Impact:  A remote authenticated user can execute arbitrary code on the target system with the privileges of the 'pluto' process.
Solution:  The vendor has released fixed versions (1.0.9 and 2.3.0), available at:

http://www.openswan.org/code/

Vendor URL:  www.openswan.org/ (Links to External Site)
Cause:  Boundary error
Underlying OS:  Linux (Any), UNIX (Any)
Reported By:  idlabs-advisories@idefense.com
Message History:   None.


 Source Message Contents

Date:  Wed, 26 Jan 2005 12:05:30 -0500
From:  idlabs-advisories@idefense.com
Subject:  iDEFENSE Security Advisory 01.26.05: Openswan XAUTH/PAM Buffer

 
 
Openswan XAUTH/PAM Buffer Overflow Vulnerability
 
iDEFENSE Security Advisory 01.26.05
www.idefense.com/application/poi/display?id=190&type=vulnerabilities
January 26, 2005
 
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.
 


Go to the Top of This SecurityTracker Archive Page





Home   |    View Topics   |    Search   |    Contact Us   |    Help

Copyright 2005, SecurityGlobal.net LLC