pwncat
pwncat copied to clipboard
Network enumeration broken on docker containers that return non-0 return codes
Bug Description
When enumerating network interfaces, if it's on a docker container, the "ip" command will return a non 0 return code, which will cause no output.
Suggested fix is to remove the check=True
from the ip addr command (and also recommend adding an ifconfig
option as well :) ), so that the module continues without checking the error code
pwncat version
pwncat-cs --version
0.5.4
Target System (aka "victim")
Ubuntu docker image:
amd64/ubuntu:20.04
Steps to Reproduce
Steps to reproduce the behavior:
- Run
docker run --network host -it --rm amd64/ubuntu:20.04 bash
- set up pwncat listener:
pwncat-cs -lp 4444
- catch reverse shell from docker container
- try and run
run enumerate.system.network
in pwncat - on docker container:
5.1. run
ip addr
5.2 runecho $?
to see non zero return code
Expected Behavior
Expect networking info to be printed
Screenshots


There is actually an error in the execution of the ip addr
command. It appears there is some weird edge case for the interface where ip
can't get the address information for eth0@if12
. It's possible the ip -json
output could still be readable in that case, but I'm not sure if that switch is widely available across ip
versions. We can't reliably parse the output of ip
if there's an error, though.
I can't reproduce this on a local instance of amd64/ubuntu:20.04
though. It looks like you have some odd network configuration. Can you post the output of ip -json addr
to see if there is usable output with that switch enabled.