Skip to content

Commit e740425

Browse files
authored
enumerate all capabilities in setpriv (#295)
* enumerate all capabilities * Fix nsjail version * Automated commit: update images.
1 parent 44280af commit e740425

File tree

9 files changed

+20
-9
lines changed

9 files changed

+20
-9
lines changed

dist/challenge-templates/pwn/challenge/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ RUN /usr/sbin/useradd --no-create-home -u 1000 user
1818
COPY flag /
1919
COPY chal /home/user/
2020

21-
FROM gcr.io/kctf-docker/challenge@sha256:6dd60da626bc43bf3175d9d7436006db5acc7710d5d1b7006ab53e718fe51e40
21+
FROM gcr.io/kctf-docker/challenge@sha256:53499279053b1dace64197f0376b972793f1131c6b0fa317edf23fe1b0933b61
2222

2323
COPY --from=chroot / /chroot
2424

dist/challenge-templates/pwn/healthcheck/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
FROM gcr.io/kctf-docker/healthcheck@sha256:06c6f051583b84d8dc4d77962256b7d1f1f247f405972e0649c821837b66c894
14+
FROM gcr.io/kctf-docker/healthcheck@sha256:60267abf2e5a081f3f26692ebecac29a8a315a413f69cb1bfcd2e9148dda116e
1515

1616
COPY healthcheck_loop.sh healthcheck.py healthz_webserver.py /home/user/
1717

dist/challenge-templates/web/challenge/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ COPY web-servers /web-servers
4040

4141
COPY flag /
4242

43-
FROM gcr.io/kctf-docker/challenge@sha256:6dd60da626bc43bf3175d9d7436006db5acc7710d5d1b7006ab53e718fe51e40
43+
FROM gcr.io/kctf-docker/challenge@sha256:53499279053b1dace64197f0376b972793f1131c6b0fa317edf23fe1b0933b61
4444

4545
RUN apt-get update \
4646
&& DEBIAN_FRONTEND=noninteractive apt-get install -yq --no-install-recommends tzdata apache2 \

dist/challenge-templates/web/healthcheck/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
FROM gcr.io/kctf-docker/healthcheck@sha256:06c6f051583b84d8dc4d77962256b7d1f1f247f405972e0649c821837b66c894
14+
FROM gcr.io/kctf-docker/healthcheck@sha256:60267abf2e5a081f3f26692ebecac29a8a315a413f69cb1bfcd2e9148dda116e
1515

1616
COPY healthcheck_loop.sh healthcheck.py healthz_webserver.py /home/user/
1717

dist/challenge-templates/xss-bot/challenge/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
FROM gcr.io/kctf-docker/challenge@sha256:6dd60da626bc43bf3175d9d7436006db5acc7710d5d1b7006ab53e718fe51e40
14+
FROM gcr.io/kctf-docker/challenge@sha256:53499279053b1dace64197f0376b972793f1131c6b0fa317edf23fe1b0933b61
1515

1616
RUN apt-get update && apt-get install -y gnupg2
1717

dist/challenge-templates/xss-bot/healthcheck/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
FROM gcr.io/kctf-docker/healthcheck@sha256:06c6f051583b84d8dc4d77962256b7d1f1f247f405972e0649c821837b66c894
14+
FROM gcr.io/kctf-docker/healthcheck@sha256:60267abf2e5a081f3f26692ebecac29a8a315a413f69cb1bfcd2e9148dda116e
1515

1616
COPY healthcheck_loop.sh healthcheck.py healthz_webserver.py /home/user/
1717

docker-images/challenge/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@
1616
FROM ubuntu:20.04 as nsjail
1717

1818
ENV BUILD_PACKAGES build-essential git protobuf-compiler libprotobuf-dev bison flex pkg-config libnl-route-3-dev ca-certificates
19+
ENV NSJAIL_COMMIT 4be95952340bd1339889174d3a9158d636985813
1920

2021
RUN apt-get update \
2122
&& apt-get install -yq --no-install-recommends $BUILD_PACKAGES \
2223
&& rm -rf /var/lib/apt/lists/* \
2324
&& git clone https://github.com/google/nsjail.git \
24-
&& cd /nsjail && make -j && cp nsjail /usr/bin/ \
25+
&& cd /nsjail && git checkout $NSJAIL_COMMIT && make -j && cp nsjail /usr/bin/ \
2526
&& rm -R /nsjail && apt-get remove --purge -y $BUILD_PACKAGES $(apt-mark showauto)
2627

2728
# challenge image

docker-images/challenge/kctf_drop_privs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,9 @@
22

33
# There are two copies of this file in the nsjail and healthcheck base images.
44

5-
exec setpriv --init-groups --reset-env --reuid user --regid user --inh-caps=-all -- "$@"
5+
all_caps="-cap_0"
6+
for i in $(seq 1 $(cat /proc/sys/kernel/cap_last_cap)); do
7+
all_caps+=",-cap_${i}"
8+
done
9+
10+
exec setpriv --init-groups --reset-env --reuid user --regid user --inh-caps=${all_caps} -- "$@"

docker-images/healthcheck/kctf_drop_privs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,9 @@
22

33
# There are two copies of this file in the nsjail and healthcheck base images.
44

5-
exec setpriv --init-groups --reset-env --reuid user --regid user --inh-caps=-all -- $@
5+
all_caps="-cap_0"
6+
for i in $(seq 1 $(cat /proc/sys/kernel/cap_last_cap)); do
7+
all_caps+=",-cap_${i}"
8+
done
9+
10+
exec setpriv --init-groups --reset-env --reuid user --regid user --inh-caps=${all_caps} -- $@

0 commit comments

Comments
 (0)