Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Network enumeration broken on docker containers that return non-0 return codes #264

Open
AnubisSec opened this issue Sep 28, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@AnubisSec
Copy link

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:

  1. Run docker run --network host -it --rm amd64/ubuntu:20.04 bash
  2. set up pwncat listener: pwncat-cs -lp 4444
  3. catch reverse shell from docker container
  4. try and run run enumerate.system.network in pwncat
  5. on docker container:
    5.1. run ip addr
    5.2 run echo $? to see non zero return code

Expected Behavior

Expect networking info to be printed

Screenshots

image

image

@AnubisSec AnubisSec added the bug Something isn't working label Sep 28, 2022
@calebstewart
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants