php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64765 Some IPv6 addresses get interpreted wrong
Submitted: 2013-05-02 22:46 UTC Modified: 2013-09-13 05:45 UTC
From: gmcgraw at udel dot edu Assigned: lytboris (profile)
Status: Closed Package: SNMP related
PHP Version: 5.4.14 OS: Linux
Private report: No CVE-ID: None
 [2013-05-02 22:46 UTC] gmcgraw at udel dot edu
Description:
------------
PHP sends the following string to Net-SNMP to parse as an address:

"udp6:fc00::23:250:56ff:fe82:3177"

Net-SNMP understands the final part of the IP address to be a port number, since 
it has no hexadecimal characters in it.  There was an earlier bug filed and 
fixed in PHP 5.4 that involved IPv6 but that fix only partially addressed the 
issue (bug #42918).  It made PHP correctly parse IPv6 address but it didn't 
ensure that PHP sent Net-SNMP a form of address that it will always correctly 
interpret.

My patch causes square brackets to always surround the IPv6 address, so that 
Net-SNMP cannot possibly interpret the last part of the Ipv6 address as a port 
number.  The port number will be placed outside the square brackets.  Here is an 
example of how it will now send the IPV6 address to Net-SNMP:

"udp6:[fc00::23:250:56ff:fe82:3177]"

Or if there is a custom port number 1234:

"udp6:[fc00::23:250:56ff:fe82:3177]:1234"

Net-SNMP will correctly parse that and use the default SNMP port number (161) if 
none is specified or the provided port number otherwise.

I have reproduced this in 5.4.1 and 5.4.14.

Test script:
---------------
$s=new SNMP(SNMP::VERSION_2C, '[fc00::23:250:56ff:fe82:3177]', 'public');
print_r($s->get('.1.3.6.1.2.1.1.1.0'));



Expected result:
----------------
STRING: "Linux mykernel12345 #5 SMP Fri Jun 1 19:44:50 GMT 2012 x86_64"

Actual result:
--------------
Warning: SNMP::get(): No response from udp6:fc00::23:250:56ff:fe82:3177 in php 
shell code on line 1

Patches

snmp-ipv6-patch (last revision 2013-05-03 00:53 UTC by gmcgraw at udel dot edu)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-05-03 08:41 UTC] lytboris@php.net
-Status: Open +Status: Closed
 [2013-05-03 08:41 UTC] lytboris@php.net
Automatic comment on behalf of lytboris
Revision: http://git.php.net/?p=php-src.git;a=commit;h=3828f6227b188bd0c8d829a375ebf51faf67c448
Log: Fix bug #64765 (enclose IPv6 address into square brackets)
 [2013-05-03 08:45 UTC] lytboris@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.4-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2013-05-03 08:45 UTC] lytboris@php.net
-Status: Closed +Status: Feedback
 [2013-05-03 11:16 UTC] lytboris@php.net
-Assigned To: +Assigned To: lytboris
 [2013-09-13 05:45 UTC] lytboris@php.net
-Status: Feedback +Status: No Feedback
 [2013-09-13 05:45 UTC] lytboris@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.


 [2014-10-07 23:19 UTC] stas@php.net
Automatic comment on behalf of lytboris
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=3828f6227b188bd0c8d829a375ebf51faf67c448
Log: Fix bug #64765 (enclose IPv6 address into square brackets)
 [2014-10-07 23:19 UTC] stas@php.net
-Status: No Feedback +Status: Closed
 [2014-10-07 23:30 UTC] stas@php.net
Automatic comment on behalf of lytboris
Revision: http://git.php.net/?p=php-src-security.git;a=commit;h=3828f6227b188bd0c8d829a375ebf51faf67c448
Log: Fix bug #64765 (enclose IPv6 address into square brackets)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Oct 13 05:01:27 2024 UTC