Home / vulnerabilities WLB-2008080064.txt
Posted on 24 August 2008
Source : packetstormsecurity.org Link
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
[WLB-2008080064: inet_net_pton() integer overflow ]
Author: Maksymilian Arciemowicz (cxib)
SecurityReason.com
Date:
- - Written: 02.08.2008
- - Public: 22.08.2008
SecurityRisk: Low
It is a bug, without a high security risk. We are going informing all vendors, about this problem.
Affected Software:
libc inet_net_pton.c
ver ISC Bind
- - OpenBSD fixed
Original URL WLB-2008080064 :
http://securityreason.com/wlb_show/WLB-2008080064
Vendor: http://www.isc.org/index.pl?/sw/bind/index.php
- --- 0.Description ---
inet_net_pton - Internet network number manipulation routines
SYNOPSIS:
int
inet_net_pton(int af, const char *src, void *dst, size_t size);
The inet_net_pton() function converts a presentation format Internet network number (that is, printable form as held in a character string) to network format (usually a struct in_addr or some other internal binary representation, in network byte order). It returns the number of bits (either computed based on the class, or specified with /CIDR), or -1 if a failure occurred (in which case errno will have been set. It will be set to ENOENT if the Internet network number was not valid).
Caution: The dst field should be zeroed before calling inet_net_pton() as the function will only fill the number of bytes necessary to encode the network number in network byte order.
The only value for af currently supported is AF_INET. size is the size of the result buffer dst.
NETWORK NUMBERS (IP VERSION 4)
The external representation of Internet network numbers may be specified in one of the following forms:
a
a.b
a.b.c
a.b.c.d
Any of the above four forms may have ``/bits'' appended where ``bits'' is in the range 0-32 and is used to explicitly specify the number of bits in the network address. When ``/bits'' is not specified the number of bits
- --- 1. libc/net inet_net_pton() integer overflow ---
The main problem exist in inet_net_pton() function. Let's see to this function
inet_net_pton.c
- ---
int
inet_net_pton(int af, const char *src, void *dst, size_t size)
{
switch (af) {
case AF_INET:
return (inet_net_pton_ipv4(src, dst, size));
default:
errno = EAFNOSUPPORT;
return (-1);
}
}
- ---
call to inet_net_pton_ipv4(). So let's see it..
- -START--
static int
inet_net_pton_ipv4(const char *src, u_char *dst, size_t size)
{
static const char
xdigits[] = "0123456789abcdef",
digits[] = "0123456789";
int n, ch, tmp, dirty, bits;
const u_char *odst = dst;
ch = *src++;
if (ch == '0' && (src[0] == 'x' || src[0] == 'X')
&& isascii(src[1]) && isxdigit(src[1])) {
/* Hexadecimal: Eat nybble string. */
if (size <= 0)
goto emsgsize;
*dst = 0, dirty = 0;
src++; /* skip x or X. */
while ((ch = *src++) != '