File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Copyright 2020 Google LLC
2+ #
3+ # Licensed under the Apache License, Version 2.0 (the "License");
4+ # you may not use this file except in compliance with the License.
5+ # You may obtain a copy of the License at
6+ #
7+ # https://www.apache.org/licenses/LICENSE-2.0
8+ #
9+ # Unless required by applicable law or agreed to in writing, software
10+ # distributed under the License is distributed on an "AS IS" BASIS,
11+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+ # See the License for the specific language governing permissions and
13+ # limitations under the License.
14+ FROM ubuntu:20.04 as chroot
15+
16+ RUN /usr/sbin/useradd --no-create-home -u 1000 user
17+
18+ COPY flag /
19+ COPY buffer_overflow /home/user/
20+
21+ FROM gcr.io/kctf-docker/challenge@sha256:d884e54146b71baf91603d5b73e563eaffc5a42d494b1e32341a5f76363060fb
22+
23+ COPY --from=chroot / /chroot
24+
25+ COPY nsjail.cfg /home/user/
26+
27+ CMD kctf_setup && \
28+ kctf_drop_privs \
29+ socat \
30+ TCP-LISTEN:1337,reuseaddr,fork \
31+ EXEC:"kctf_pow nsjail --config /home/user/nsjail.cfg -- /home/user/chal"
Original file line number Diff line number Diff line change 1+ wctf{buffer_overflow_example}
Original file line number Diff line number Diff line change 1+ # Copyright 2020 Google LLC
2+ #
3+ # Licensed under the Apache License, Version 2.0 (the "License");
4+ # you may not use this file except in compliance with the License.
5+ # You may obtain a copy of the License at
6+ #
7+ # https://www.apache.org/licenses/LICENSE-2.0
8+ #
9+ # Unless required by applicable law or agreed to in writing, software
10+ # distributed under the License is distributed on an "AS IS" BASIS,
11+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+ # See the License for the specific language governing permissions and
13+ # limitations under the License.
14+
15+ # See options available at https://github.com/google/nsjail/blob/master/config.proto
16+
17+ name: " default-nsjail-configuration"
18+ description: " Default nsjail configuration for pwnable-style CTF task."
19+
20+ mode: ONCE
21+ uidmap {inside_id: " 1000" }
22+ gidmap {inside_id: " 1000" }
23+ rlimit_as_type: HARD
24+ rlimit_cpu_type: HARD
25+ rlimit_nofile_type: HARD
26+ rlimit_nproc_type: HARD
27+
28+ cwd: " /home/user"
29+
30+ mount: [
31+ {
32+ src: " /chroot"
33+ dst: " /"
34+ is_bind: true
35+ },
36+ {
37+ dst: " /tmp"
38+ fstype: " tmpfs"
39+ rw: true
40+ },
41+ {
42+ dst: " /proc"
43+ fstype: " proc"
44+ rw: true
45+ },
46+ {
47+ src: " /etc/resolv.conf"
48+ dst: " /etc/resolv.conf"
49+ is_bind: true
50+ }
51+ ]
You can’t perform that action at this time.
0 commit comments