zmap/zmap

Latest ZMap seems to break with the `-I` flag

Closed this issue · 2 comments

Notice: Please don't file a bug report for questions on how to use ZMap, etc. Check out our Resources section for FAQ and feel free to chime in on Github Discussions if you're still unclear and we'll be happy to assist!

Describe the bug
Using the -I flag seems to always lead to a fatal error:

zmap: /home/pstephens/zmap/lib/constraint.c:253: constraint_lookup_index: Assertion `index < con->root->count' failed.
Aborted

CLI Arguments
Please paste your ZMap invocation below

sudo zmap -p 80 -I large_ip_set.txt -o "output.csv" -B 500M
sudo zmap -p 80 -I small_set_ips.txt -o "output.csv" -B 500M

Example Target IP

See attached IP list files
large_ip_set.txt
small_set_ips.txt

Expected behavior
I'd expect the command to scan the given IP file without erroring, unless there's a formatting issue with the text file.

Environment:

  • OS: Ubuntu 18.04 and MacOS when compiled from source
  • Version: Github HEAD

Additional context
Full output of using command

pstephens@scratch-04-a:~$ cat small_set_ips.txt
57.34.30.22
107.237.157.122
94.231.62.61
102.159.87.118
236.130.238.137
84.231.23.216
209.161.244.186
213.62.11.23
230.0.255.180
40.230.12.94
pstephens@scratch-04-a:~$ sudo zmap -p 80 -I small_set_ips.txt -o "output.csv" -B 500M
Nov 30 21:14:39.825 [INFO] zmap: By default, ZMap will output the unique IP addresses of hosts that respond successfully (e.g., SYN-ACK packet). This is equivalent to running ZMap with the following flags: --output-module=csv --output-fields=saddr --output-filter='success=1 && repeat=0' --no-header-row. If you want all responses, explicitly set an output module or set --output-filter="".
Nov 30 21:14:39.825 [INFO] dedup: Response deduplication method is full
Nov 30 21:14:39.856 [WARN] zmap: list of IPs is small compared to address space. Performance will suffer, consider using an allowlist instead
Nov 30 21:14:39.901 [INFO] recv: duplicate responses will be excluded from output
Nov 30 21:14:39.901 [INFO] recv: unsuccessful responses will be excluded from output
 0:00 0%; send: 0 0 p/s (0 p/s avg); recv: 0 0 p/s (0 p/s avg); drops: 0 p/s (0 p/s avg); hitrate: 0.00%
zmap: /home/pstephens/zmap/lib/constraint.c:253: constraint_lookup_index: Assertion `index < con->root->count' failed.
Aborted

When run on ZMap v3.0.0 this assertion isn't broken and the command runs fine, albeit a bit slowly but the user is warned of that by ZMap 😄. I'll look at what changed between these two versions around the radix tree/assertions.

I'm seeing this issue as well but for a single IP. (I use a for loop so I can add the hostname back into the output)

zmap-4.0.0-RC1/lib/constraint.c:253: constraint_lookup_index: Assertion `index < con->root->count' failed.

  while read -r line; do
    echo "zmap scanning $line"
    zmap "$line" -O json | jq --arg line "$line" '.saddr |= $line' >> zmap_output_temp.json
  done < subdomains.txt