C0deH4cker / PwnableHarness

Manage building and deploying exploitation challenges with ease
MIT License
57 stars 4 forks source link

Cannot listen on port 55555 with Docker for Mac #28

Closed C0deH4cker closed 1 month ago

C0deH4cker commented 1 month ago

When using pwnmake docker-start, you can't then do nc localhost <port> and connect to the challenge. I'm 99% sure this used to work, but it seems like it doesn't anymore.

I assume that this is due to pwnmake using a Linux docker CLI with the Docker VM's internal docker.sock to start the container instead of the docker CLI command on macOS (which likely has some extra code for exposing a port from the Docker VM to the macOS host).

I don't know how to fix this currently, it will require some thinking.

C0deH4cker commented 1 month ago

Okay it's weirder than I thought. When I do pwnmake docker-start from the examples/FlagCharity directory, I can see it with docker ps and then successfully connect to it with nc localhost 19891 from my Mac. However, if I try to do the same thing with the examples/BaseImage directory (from the change-base-image dev branch), I can see it in docker ps but can't nc localhost 55555. I can connect to it from another Docker container though, so it's definitely listening externally from the container itself.

C0deH4cker commented 1 month ago

Changing the port from 55555 to 19891 makes it work again. Is macOS somehow preventing this connection on port 55555???

C0deH4cker commented 1 month ago

https://stackoverflow.com/a/66471464