Score:1

How non root user able to listen on priviledge port

jo flag

I supposed to get a bind exception instead it's binding on privilege port

% docker run --rm -u nobody  alpine  nc -l 0.0.0.0 443
% docker exec -it b2b471d05398 sh
~ $ id
uid=65534(nobody) gid=65534(nobody)
~ $ ps
PID   USER     TIME  COMMAND
    1 nobody    0:00 nc -l 0.0.0.0 443
    8 nobody    0:00 sh
   15 nobody    0:00 ps
~ $ %

Even tried with another approach by building a Dockerfile

FROM python:latest
COPY index.html /
EXPOSE 80
USER nobody
CMD python -m http.server 80
docker build -t test .
docker run --rm -u nobody  test
~ % docker ps
CONTAINER ID   IMAGE     COMMAND                  CREATED          STATUS          PORTS     NAMES
b40c6c33a187   test      "/bin/sh -c 'python …"   28 seconds ago   Up 27 seconds   80/tcp    practical_lumiere

Tried this one too, still it is able to bind port less than 1024

docker run --rm -u nobody --cap-drop=SETUID --cap-drop=NET_BIND_SERVICE --cap-drop=SETFCAP --cap-drop=NET_RAW  alpine  nc -l 0.0.0.0 443
Score:2
de flag

The default kernel tuning parameter net.ipv4.ip_unprivileged_port_start for containers is set to 0 which makes all ports in the docker container unprivileged.

All processes inside the container can bind to any port (of the container) even as an unprivileged user.

With regards to exposing privileged ports as a non-priviliged user on the host OS, see https://docs.docker.com/engine/security/rootless/#exposing-privileged-ports

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.