Report information
The Basics
Id:
28038
Status:
resolved
Priority:
Low/Low
Queue:

BugTracker
Version Fixed:
4.4.0 4.3.6
Version Found:
(no value)
Versions Affected:
(no value)
Versions Planned:
4.4.0 4.3.6
Priority:
P2 Normal
Severity:
S2 Normal
CVSS Score:
(no value)
CVE ID:
(no value)
Component:
(no value)
Area:
(no value)

Dates
Created:Tue, 21 Feb 2012 19:31:43 -0500
Updated:Mon, 15 Jan 2018 14:52:20 -0500
Closed:Wed, 26 Apr 2017 16:10:11 -0400



This bug tracker is no longer active.

Please go to our Gitlab to submit issues (both feature requests and bug reports) for active projects maintained by Internet Systems Consortium (ISC).

Due to security and confidentiality requirements, full access is limited to the primary maintainers.

Subject: But in timer code using infinite lease time on 64 bit system
 From: Jiri Popelka <jpopelka@redhat.com>
Subject: dhcpd 4.2 DoS via dhcp client in Android HTC phone
Date: 21 February 2012 13:42:11 CE
To: security-officer@isc.org
Cc: security-response-team@redhat.comlevon@movementarian.org
Hi,
John Levon a Fedora user running dhcpd 4.2.3-P2 (see attached dhcpd.conf) had discovered that his dhcpd server exits very soon after one of the clients (Android HTC phone) obtains an address with:
dhcpd: Timeout requested too large reducing to 2^^32-1
dhcpd: Unable to set up timer: out of range
We have a packed dump (see attached dhcp.pcap) but I haven't been able to find anything strange in it.
I set up a server/client to be as much as possible to John's server/client and tried to reproduce the problem here but with no luck.
So I added some debug messages into the affected code (common/dispatch.c:330) and figured out that the when->tv_sec variable was having value 5624983148 (i.e. over 4G).
This value I think is the reason for the exit but I have no idea where it came from (as I don't see anything like that in the packed dump).
The whole debug output from John's machine is attached as debug_output.txt.
I'm attaching a patch that John confirmed as fixing the problem.
This comment from the patch should explain the problem and the fix:
/*
 * We need to reduce (to 2^^32-1) the absolute time from an epoch
 * (i.e. value of when->tv_sec) and not the relative time (value of
 * sec variable).
 * In other words, we have to make sure that once the
 * isc_time_nowplusinterval() adds current time to the given relativ
 * time the result will be less than 2^^32-1.
 */
This part of code was already "fixed" in 4.2.1b1, changelog comment says:
- Limit the timeout period allowed in the dispatch code to 2^^32-1 seconds.
Thanks to a report from Jiri Popelka at Red Hat.
[ISC-Bugs #22033], [Red Hat Bug #628258]
I remember helping you to test *your* fix then, but unfortunately the test values were probably not huge enough.
Once you have a patch (cause there's one "hack" in mine patch) you can send it to me and I'll build a package/binary for John to test it (if you want).
With regards,
Jiri Popelka
Red Hat, inc.

Subject: Bug in timer code using infinite lease time on 64 bit system
 Hi Jiri,

Thank you for your report.  We've looked it over and there does
seem to be a problem in the timer code.  We're trying to figure
out how it got triggered and how serious it is.  Currently we think
it is most likely a configuration issue and so wouldn't be a good
DOS vector.

While we look into this we were hoping you might be able to
do some tests and gather some information as well.

Do you know if John tried this with other versions of the code?
Specifically any of the 4.1x versions?

Can the test be run with at least two more values for the lease times
instead of "infinite"?  The two sets of values that would be interesting
to us are a large number but less than 2^^31 - 1 and a number between
2^^31 and 2^^32 - 1. 

In the pcap you sent us the client is receiving a lease time value of
80000, but I don't see anything in the configuration file that would
lead to that value.  Does that value ring any bells for you or John
(perhaps an older config file? or something leftover from the client?)

While I wouldn't expect it to show much it would be interesting to get
a copy of the lease file to see what the server was trying to record at
the time of failure.

As normal the fix looks like a good start, we may need to modify it
for other compilers (as I recall that's why we included the & DHCP_SEC_MAX
in the previous patch and after we review it some more.



Added Vincent who also asked for an update.
Let's keep responses on this ticket rather than via personal  mail to Shawn so the rest of the teams can see it.
THanks,
Sue


On Wed Feb 22 00:49:14 2012, sar wrote:
> Hi Jiri,
>
> Thank you for your report. We've looked it over and there does
> seem to be a problem in the timer code. We're trying to figure
> out how it got triggered and how serious it is. Currently we think
> it is most likely a configuration issue and so wouldn't be a good
> DOS vector.
>
> While we look into this we were hoping you might be able to
> do some tests and gather some information as well.
>
> Do you know if John tried this with other versions of the code?
> Specifically any of the 4.1x versions?
>
> Can the test be run with at least two more values for the lease times
> instead of "infinite"? The two sets of values that would be interesting
> to us are a large number but less than 2^^31 - 1 and a number between
> 2^^31 and 2^^32 - 1.
>
> In the pcap you sent us the client is receiving a lease time value of
> 80000, but I don't see anything in the configuration file that would
> lead to that value. Does that value ring any bells for you or John
> (perhaps an older config file? or something leftover from the client?)
>
> While I wouldn't expect it to show much it would be interesting to get
> a copy of the lease file to see what the server was trying to record at
> the time of failure.
>
> As normal the fix looks like a good start, we may need to modify it
> for other compilers (as I recall that's why we included the & DHCP_SEC_MAX
> in the previous patch and after we review it some more.



Subject: [ISC-Bugs #28038] Bug in timer code using infinite lease time on 64 bit system
Date: Thu, 23 Feb 2012 11:35:44 +0100
To: dhcp-bugs@isc.org, Vincent Danen <vdanen@redhat.com>
From: Jiri Popelka <jpopelka@redhat.com>
On 02/22/2012 08:32 PM, Shawn Routhier wrote:
Thank you for your report.  We've looked it over and there does
seem to be a problem in the timer code.  We're trying to figure
out how it got triggered and how serious it is.  Currently we think
it is most likely a configuration issue and so wouldn't be a good
DOS vector.

Yes, nor I've thought it's a security problem since I managed to reproduce it.

While we look into this we were hoping you might be able to
do some tests and gather some information as well.

Do you know if John tried this with other versions of the code?
Specifically any of the 4.1x versions?

I'll ask but I don't think so as we haven't 4.1 in any supported Fedora version and
he wrote that ha was using dnsmasq as a workaround.
But I tried to reproduce it with dhcp-4.1.1-P1 and it seems OK
(well, it should be as the problematic code was added in 4.2.0).

Can the test be run with at least two more values for the lease times
instead of "infinite"?  The two sets of values that would be interesting
to us are a large number but less than 2^^31 - 1 and a number between
2^^31 and 2^^32 - 1. 

I tried it with several values and the result depends on whether
the (number + cur_tv.tv_sec) is less or more than 2^32-1

results when cur_tv.tv_sec = 1329992027
-------------------
2000000000                :  ok
2147483647 (2^31-1) :  ok
2700000000                :  ok (2700000000 + cur_tv.tv_sec = 4029992027 < 2^32-1)
3000000000                :  not ok (3000000000 + cur_tv.tv_sec = 4329992027 > 2^32-1)
4294967295 (2^32-1) :  not ok

In the pcap you sent us the client is receiving a lease time value of
80000, but I don't see anything in the configuration file that would
lead to that value.  Does that value ring any bells for you or John
(perhaps an older config file? or something leftover from the client?)

Yes, I had noted that too but forgot to ask John. I'll do that.

While I wouldn't expect it to show much it would be interesting to get
a copy of the lease file to see what the server was trying to record at
the time of failure.
I'm attaching mine and will ask John for his.


As normal the fix looks like a good start, we may need to modify it
for other compilers (as I recall that's why we included the & DHCP_SEC_MAX
in the previous patch and after we review it some more.

Thanks.

--
Jiri

Message body is not shown because sender requested not to inline it.

CC: dhcp-bugs@isc.org
Subject: Re: [ISC-Bugs #28038] Bug in timer code using infinite lease time on 64 bit system
Date: Thu, 23 Feb 2012 11:51:49 +0000
To: Jiri Popelka <jpopelka@redhat.com>
From: John Levon <levon@movementarian.org>
On Thu, Feb 23, 2012 at 12:40:23PM +0100, Jiri Popelka wrote: > On 02/22/2012 08:32 PM, Shawn Routhier wrote: > >Thank you for your report. We've looked it over and there does > >seem to be a problem in the timer code. We're trying to figure > >out how it got triggered and how serious it is. Currently we think > >it is most likely a configuration issue and so wouldn't be a good > >DOS vector. > > > Yes, nor I've thought it's a security problem since I managed to > reproduce it. What kind of configuration issue? Is there something "wrong" in my dhcpd.conf? > >While we look into this we were hoping you might be able to > >do some tests and gather some information as well. > > > >Do you know if John tried this with other versions of the code? > >Specifically any of the 4.1x versions? > > > I'll ask but I don't think so as we haven't 4.1 in any supported Fedora > version and > he wrote that ha was using dnsmasq as a workaround. > But I tried to reproduce it with dhcp-4.1.1-P1 and it seems OK > (well, it should be as the problematic code was added in 4.2.0). No, the last working version I tried was whatever was in Fedora 15. > >In the pcap you sent us the client is receiving a lease time value of > >80000, but I don't see anything in the configuration file that would > >lead to that value. Does that value ring any bells for you or John > >(perhaps an older config file? or something leftover from the client?) > > > Yes, I had noted that too but forgot to ask John. I'll do that. I'd experimented with other lease times, so at the time I was using: default-lease-time 80000; max-lease-time 80000; The bug was still present. > >While I wouldn't expect it to show much it would be interesting to get > >a copy of the lease file to see what the server was trying to record at > >the time of failure. > I'm attaching mine and will ask John for his. I'll have to get back to you if you still need it. regards john
RT-Send-CC: levon@movementarian.org, vdanen@redhat.com
On Thu Feb 23 11:51:58 2012, levon@movementarian.org wrote:
> On Thu, Feb 23, 2012 at 12:40:23PM +0100, Jiri Popelka wrote:
>
> > On 02/22/2012 08:32 PM, Shawn Routhier wrote:
> > >Thank you for your report. We've looked it over and there does
> > >seem to be a problem in the timer code. We're trying to figure
> > >out how it got triggered and how serious it is. Currently we think
> > >it is most likely a configuration issue and so wouldn't be a good
> > >DOS vector.
> > >
> > Yes, nor I've thought it's a security problem since I managed to
> > reproduce it.
>
> What kind of configuration issue? Is there something "wrong" in my
> dhcpd.conf?

Our current theory is that using "infinite" as the lease time is causing
problems as the value gets passed around and eventually gets to
the timer code (when compiled and using a 64 bit OS).  Other numbers
of the appropriate size wold also be an issue.

If so then this would mean that an outside attacker
wouldn't be able to damage the server.

>
> > >While we look into this we were hoping you might be able to
> > >do some tests and gather some information as well.
> > >
> > >Do you know if John tried this with other versions of the code?
> > >Specifically any of the 4.1x versions?
> > >
> > I'll ask but I don't think so as we haven't 4.1 in any supported Fedora
> > version and
> > he wrote that ha was using dnsmasq as a workaround.
> > But I tried to reproduce it with dhcp-4.1.1-P1 and it seems OK
> > (well, it should be as the problematic code was added in 4.2.0).
>
> No, the last working version I tried was whatever was in Fedora 15.
>
> > >In the pcap you sent us the client is receiving a lease time value of
> > >80000, but I don't see anything in the configuration file that would
> > >lead to that value. Does that value ring any bells for you or John
> > >(perhaps an older config file? or something leftover from the client?)
> > >
> > Yes, I had noted that too but forgot to ask John. I'll do that.
>
> I'd experimented with other lease times, so at the time I was using:
>
> default-lease-time 80000;
> max-lease-time 80000;
>
> The bug was still present.

That's curious, I wouldn't expect that to trigger a timer with
a value greater than 4G.

>
> > >While I wouldn't expect it to show much it would be interesting to get
> > >a copy of the lease file to see what the server was trying to record at
> > >the time of failure.
> > I'm attaching mine and will ask John for his.
>
> I'll have to get back to you if you still need it.

What would be best, given your information about the 80000
value would be to try and get a complete set of information from
one example - the config file, the lease file and the error messages
we may eventually want to look at a core dump but I don't
currently have a place to read it so getting it isn't a priority.

>
> regards
> john
>



Subject: [ISC-Bugs #28038] Bug in timer code using infinite lease time on 64 bit system
Date: Tue, 13 Mar 2012 12:22:46 +0100
To: dhcp-bugs@isc.org
From: Jiri Popelka <jpopelka@redhat.com>
Hi, Red Hat's Security Response Team would like to know whether you consider this to be a security related flaw or just an ordinal bug so we could possibly close our security-related tickets. Thank you -- Jiri
On Tue Mar 13 11:26:00 2012, jpopelka@redhat.com wrote:
> Hi,
>
> Red Hat's Security Response Team would like to know
> whether you consider this to be a security related flaw
> or just an ordinal bug so we could possibly close our
> security-related tickets.
>
> Thank you
>
> --
> Jiri
>
I apologize for the delay in responding.  

Currently we do not consider this to be a security related flaw, as
it appears to be mostly a configuration issue.  However the user
seeing this with a value of 80 000 is a concern.  We never
received additional information for that case though.



Subject: [ISC-Bugs #28038] Bug in timer code using infinite lease time on 64 bit system
Date: Tue, 03 Apr 2012 14:37:58 +0200
To: dhcp-bugs@isc.org
From: Jiri Popelka <jpopelka@redhat.com>
On 04/03/2012 01:15 AM, Shawn Routhier via RT wrote: > Currently we do not consider this to be a security related flaw, as > it appears to be mostly a configuration issue. However the user > seeing this with a value of 80 000 is a concern. We never > received additional information for that case though. Thanks, you never received additional information for that case because the original reporter (John Levon, levon@movementarian.org) is not added to this ticket and I had forgot to forward the request to him, sorry. I've sent him the request now, hopefully he will still be able to confirm/disprove that he can reproduce it with that value. -- Jiri
CC: dcbw@redhat.com, psimerda@redhat.com
Subject: Re: [ISC-Bugs #28038] Bug in timer code using infinite lease time on 64 bit system
Date: Wed, 01 Aug 2012 12:59:09 +0200
To: dhcp-bugs@isc.org
From: Jiri Popelka <jpopelka@redhat.com>
Hi, I haven't heard anything from John since then, but some other users went into this problem too. I won't duplicate the info here, all you need is in https://bugzilla.redhat.com/show_bug.cgi?id=662254 (from comment #6) see especially Dan Williams' outstanding comments and his patch in comment #32. Also his blog: http://blogs.gnome.org/dcbw/2012/07/25/guadec-psa-wifi-fails-due-to-dhclient-lease-miscalculation/ http://blogs.gnome.org/dcbw/2012/07/26/dhclient-infinite-lease-follow-up/ The original John Levon's bug is now public here https://bugzilla.redhat.com/show_bug.cgi?id=789601 -- Jiri On 04/03/2012 02:38 PM, Jiri Popelka via RT wrote: > On 04/03/2012 01:15 AM, Shawn Routhier via RT wrote: >> Currently we do not consider this to be a security related flaw, as >> it appears to be mostly a configuration issue. However the user >> seeing this with a value of 80 000 is a concern. We never >> received additional information for that case though. > Thanks, > > you never received additional information for that case because the > original reporter (John Levon, levon@movementarian.org) is not added > to this ticket and I had forgot to forward the request to him, sorry. > > I've sent him the request now, hopefully he will still be able to > confirm/disprove that he can reproduce it with that value.
Hello Jiri: This issue popped up on my radar while looking at a dhclient ticket. After digging into it I was able to readily reproduce it which seemed to be the a sticking point prior to this. All one need to do is configure large lease times and then run clients which do not issue DHCPDISCOVERs but rather go straight to DHCPREQUESTs. You'll be pleased to learn that this issue will be fixed in 4.4.0 and 4.3.6, the latter should be available late June '17. Our fix is slightly different the yours but it works well enough. As always, thanks for your continued efforts and patience. Sincerely, Thomas Markwalder ISC Software Engineering