Conversation
…than it should, causing an index out-of-bounds issue
|
This seems reasonable to me to allow the blacklist to set the number of scanned IPs because it already has to be scanning @phillip-stephens can you make sure that there's a safety check that if you're using |
Hmm, I'm not sure what you mean. The |
Took me longer than it should have to find.
Bug Description
This bug was introduced in commit: d9c0
Prior to this commit, when the user wanted to use a file for a list of IP's (
-I), that'd trigger this code in iterator.c.This commit moved/changed this logic to send.c.
The issue is that by setting
num_addrs=0xFFFFFFFF, we allow the iterator to generate values 0-2^32. However, our radix tree only has values for theblocklist_count_allowed, or all the IP addresses that are NOT black/blocklisted (looks like ~3.7B values based onDec 12 14:53:23.952 [DEBUG] constraint: 3702243328 IPs in radix array, 15104 IPs in tree.). Therefore our iterator can generate values that would be outside our radix tree (>3.7B), and therefore violate the assertion here.Fix
I think we can just remove the setting of the
group_min_sizeand letnum_addrs = blocklist_count_allowed()as it is in the base case.The old logic of setting
group_min_size = 0xFFFFFFFFforzconf.list_of_ips_filenameis retained [here] (https://github.com/zmap/zmap/blob/main/src/iterator.c#L79) for all cases, including-Isince even if we're only scanning 1 port, the value is always >= 2^32. IMO removing this will solve the bug and not have any repercussions.