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.com, levon@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.