Bug 1484034 - glibc: Stricter IPv6 address parser
Summary: glibc: Stricter IPv6 address parser
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: glibc
Version: 7.5
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Florian Weimer
QA Contact: Sergey Kolosov
Vladimír Slávik
URL:
Whiteboard:
Depends On:
Blocks: 677316
TreeView+ depends on / blocked
 
Reported: 2017-08-22 13:34 UTC by Florian Weimer
Modified: 2018-05-03 08:57 UTC (History)
7 users (show)

Fixed In Version: glibc-2.17-202.el7
Doc Type: Bug Fix
Doc Text:
Invalid IPv6 scope IDs no longer incorrectly accepted by `getaddrinfo()` Previously, the GNU C Library ( *glibc* ) function `getaddrinfo()` erroneously accepted invalid IPv6 scope IDs. As a consequence, strings such as `::%-1` or `2001:db8::1%037777777777` were incorrectly parsed as valid IPv6 addresses. The `getaddrinfo()` implementation has been changed to reject such invalid IPv6 scope IDs and return a name resolution failure instead. As a result, such invalid IPv6 address strings are no longer accepted by applications using the `getaddrinfo()` function.
Clone Of:
Environment:
Last Closed: 2018-04-10 14:00:52 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Bugzilla 1574405 high CLOSED inet_pton would fail with special ipv4 mapped ipv6 address 2020-10-14 00:28:05 UTC
Red Hat Product Errata RHSA-2018:0805 None None None 2018-04-10 14:01:54 UTC
Sourceware 16637 P2 RESOLVED inet_pton function is accepting IPv6 with bad format 2020-09-11 00:21:47 UTC
Sourceware 20611 P2 RESOLVED getaddrinfo accepts invalid numeric scope IDs 2020-09-11 00:21:46 UTC

Internal Links: 1574405

Description Florian Weimer 2017-08-22 13:34:11 UTC
Currently, glibc accepts invalid IPv6 addresses, such as:

::%
::%-1
2001:db8::1%037777777777
2001:db8::00001

This is because invalid scope IDs and leading zeros in the address are not rejected.

This has been fixed upstream as part of bug 20611 and 16637.

Comment 1 Florian Weimer 2017-09-27 09:55:22 UTC
I think the change in parsing scope IDs carries very little risk and we should implement it.

I'm still undecided about the leading zeros change.  Many implementations reject such officially invalid IPv6 addresses: NSPR, various Perl, JQuery and Apache Commons validators, and the ip4r extension for PostgreSQL.

However, OpenJDK accepts them because their Java implementation is derived from the same inet_pton6 function originally found in BIND 4.9.4 (so it has the same bug).

ip6tables uses the glibc parser as well, so the change could cause ip6tables to reject invalid IPv6 addresses with an error message which would have previously been accepted.

Comment 2 Carlos O'Donell 2017-09-27 20:31:58 UTC
(In reply to Florian Weimer from comment #1)
> I think the change in parsing scope IDs carries very little risk and we
> should implement it.
> 
> I'm still undecided about the leading zeros change.  Many implementations
> reject such officially invalid IPv6 addresses: NSPR, various Perl, JQuery
> and Apache Commons validators, and the ip4r extension for PostgreSQL.
> 
> However, OpenJDK accepts them because their Java implementation is derived
> from the same inet_pton6 function originally found in BIND 4.9.4 (so it has
> the same bug).
> 
> ip6tables uses the glibc parser as well, so the change could cause ip6tables
> to reject invalid IPv6 addresses with an error message which would have
> previously been accepted.

Without enough data I think we should lean towards being liberal in what we accept.

Eventually the upstream parser, as it is, will enter the next major release of RHEL, where expectations can be set more clearly about the strictness of the parser.

Comment 3 Florian Weimer 2017-09-29 16:16:37 UTC
(In reply to Carlos O'Donell from comment #2)
> Without enough data I think we should lean towards being liberal in what we
> accept.

Agreed.  With the version I intend to commit, 2001:db8::00001 is accepted, but 2001:db8::1%037777777777 is rejected.  I think this is a reasonable compromise.

Comment 18 errata-xmlrpc 2018-04-10 14:00:52 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2018:0805


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