Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Tue, 22 Sep 2015 16:40:30 +0200
From: Julien Ramseier <j.ramseier@...il.com>
To: musl@...ts.openwall.com
Subject: getaddrinfo usage with wrong ip family

Hello,

I discovered a potential problem in getaddrinfo/__lookup_name.
When calling getaddrinfo  with an IP string not matching the specified family,
name_from_numeric() in __lookup_name() will not recognize it and the 
external dns resolver will be used.

So the following code:

const struct addrinfo hints = {
    .ai_flags = AI_ADDRCONFIG,
    .ai_family = AF_INET,
    .ai_socktype = SOCK_STREAM,
};

getaddrinfo("::1", NULL, &hints, &result);

will actually succeed instead of returning EAI_NONAME,
and perform a "A ::1" query.
Some misbehaving dns servers will then answer with 0.0.0.1.

I don’t know if this behavior is desirable. If not, I’m still not sure
where this should be fixed. Maybe should we prevent sending
A and AAAA dns queries with IP as hostname in __res_mkquery() ?

—
Julien


Content of type "text/html" skipped

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.