Bug 920517 (CVE-2006-4023) - CVE-2006-4023 php: Improper validation of strings in ip2long function (remote attackers able to obtain network information and facilitate other attacks)
Summary: CVE-2006-4023 php: Improper validation of strings in ip2long function (remote...
Keywords:
Status: CLOSED WONTFIX
Alias: CVE-2006-4023
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
URL:
Whiteboard:
Depends On: 920519
Blocks: 920533
TreeView+ depends on / blocked
 
Reported: 2013-03-12 10:02 UTC by Jan Lieskovsky
Modified: 2021-02-17 07:56 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2015-04-09 08:19:35 UTC
Embargoed:


Attachments (Terms of Use)

Description Jan Lieskovsky 2013-03-12 10:02:16 UTC
Common Vulnerabilities and Exposures assigned an identifier CVE-2006-4023 to the following vulnerability:

The ip2long function in PHP 5.1.4 and earlier may incorrectly validate an arbitrary string and return a valid network IP address, which allows remote attackers to obtain network information and facilitate other attacks, as demonstrated using SQL injection in the X-FORWARDED-FOR Header in index.php in MiniBB 2.0. NOTE: it could be argued that the ip2long behavior represents a risk for security-relevant issues in a way that is similar to strcpy's role in buffer overflows, in which case this would be a class of implementation bugs that would require separate CVE items for each PHP application that uses ip2long in a security-relevant manner.

References:
[1] http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2006-4023
[2] http://www.securityfocus.com/archive/1/archive/1/441529/100/100/threaded
[3] http://www.securityfocus.com/archive/1/archive/1/441708/100/100/threaded
[4] http://retrogod.altervista.org/php_ip2long.htm
[5] http://securitytracker.com/id?1016609

Comment 1 Jan Lieskovsky 2013-03-12 10:05:00 UTC
Public reproducer details (from [4]):
-------------------------------------
.. the php ip2long() function can be tricked to return a valid IPv4 Internet
network address instead of "-1" even if the ip address argument is not a valid
one, through the injection of some chars, ex:

<?php
 for ($i=0; $i<=255; $i++)
 {
  echo $i.":".ip2long("1.1.1.1".chr($i)."'or'a'='a'/*")."\r\n";
 }
?>

when chr($i) is chr(0), chr(9), chr(10), chr(11), chr(12), chr(13) or chr(32)

it gives the following (valid) result:

16843009

..

Comment 2 Jan Lieskovsky 2013-03-12 10:06:42 UTC
This issue affects the versions of the php and php53 packages, as shipped with Red Hat Enterprise Linux 5.

--

This issue affects the version of the php package, as shipped with Red Hat Enterprise Linux 6.

--

This issue affects the versions of the php package, as shipped with Fedora release of 17 and 18. Please schedule an update (once there is upstream patch available).

Comment 3 Jan Lieskovsky 2013-03-12 10:07:19 UTC
Created php tracking bugs for this issue

Affects: fedora-all [bug 920519]

Comment 4 Jan Lieskovsky 2013-03-12 10:09:50 UTC
Statement:

(none)

Comment 5 Remi Collet 2013-03-12 15:47:19 UTC
Since PHP 5.2.10, ip2long use "inet_pton" system function
(when available, which is the case in RHEL/Fedora).

So, with php >= 5.3, only when chr(0) returns a valid result.


Note You need to log in before you can comment on or make changes to this bug.