failed miserably at hack.lu
This commit is contained in:
21
2025/hack.lu/misc/SKAL/public/Dockerfile
Normal file
21
2025/hack.lu/misc/SKAL/public/Dockerfile
Normal file
@@ -0,0 +1,21 @@
|
||||
FROM debian:bookworm-slim@sha256:b1a741487078b369e78119849663d7f1a5341ef2768798f7b7406c4240f86aef
|
||||
|
||||
COPY docker-stuff/ynetd /sbin/ynetd
|
||||
COPY docker-stuff/readflag /readflag
|
||||
COPY flag.txt /flag.txt
|
||||
|
||||
RUN chown root:root /readflag /flag.txt && \
|
||||
chmod 500 /sbin/ynetd && \
|
||||
chmod 2555 /readflag && \
|
||||
chmod 040 /flag.txt
|
||||
|
||||
WORKDIR /app
|
||||
COPY skal.sh /app/skal.sh
|
||||
|
||||
RUN useradd --no-create-home --shell /bin/bash ctf
|
||||
USER ctf
|
||||
RUN ! find / -writable -or -user "$(id -un)" -or -group $(id -Gn | sed -e 's/ / -or -group /g') 2> /dev/null | grep -Ev -m 1 '^(/dev/|/proc/|/sys/|/tmp|/var/tmp|/run/lock|/var/lock)'
|
||||
USER root
|
||||
RUN find / -ignore_readdir_race -type f \( -perm -4000 -o -perm -2000 \) -not -wholename /readflag -delete
|
||||
|
||||
CMD ynetd -lt 240 -d /app -sh y -se y -np y '/app/skal.sh'
|
||||
10
2025/hack.lu/misc/SKAL/public/docker-compose.yml
Normal file
10
2025/hack.lu/misc/SKAL/public/docker-compose.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
services:
|
||||
skal:
|
||||
build: .
|
||||
ports:
|
||||
- "1024:1024"
|
||||
cap_add:
|
||||
- SYS_ADMIN
|
||||
security_opt:
|
||||
- apparmor=unconfined
|
||||
restart: unless-stopped
|
||||
BIN
2025/hack.lu/misc/SKAL/public/docker-stuff/readflag
Executable file
BIN
2025/hack.lu/misc/SKAL/public/docker-stuff/readflag
Executable file
Binary file not shown.
BIN
2025/hack.lu/misc/SKAL/public/docker-stuff/ynetd
Normal file
BIN
2025/hack.lu/misc/SKAL/public/docker-stuff/ynetd
Normal file
Binary file not shown.
1
2025/hack.lu/misc/SKAL/public/flag.txt
Normal file
1
2025/hack.lu/misc/SKAL/public/flag.txt
Normal file
@@ -0,0 +1 @@
|
||||
flag{fakeflag}
|
||||
40
2025/hack.lu/misc/SKAL/public/skal.sh
Executable file
40
2025/hack.lu/misc/SKAL/public/skal.sh
Executable file
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
RED="\e[31m"
|
||||
GREEN="\e[32m"
|
||||
BROWN="\e[33m"
|
||||
RESET="\e[0m"
|
||||
ALLOWED_CHARS='^[${}![:space:]:_=()]+$'
|
||||
|
||||
echo -e "\e[1;34m
|
||||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣀⠀⠀⣀⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⡴⠦⣤⣴⡟⠉⠉⡗⠚⡇⠀⠈⡷⢤⠖⠒⠲⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
⠀⠀⠀⠀⠀⠀⠀⢀⣀⡇⠀⠀⢸⠀⡇⠀⠀⠇⠀⡇⠀⠀⡇⢸⠀⠀⢠⠋⡝⠉⠓⢦⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
⠀⠀⠀⠀⠀⢠⠊⠁⢣⢰⠀⠀⠈⡆⢳⠀⠀⠀⠀⡇⠀⢸⠀⡇⠀⠀⡜⢰⠃⠀⠀⡜⢦⢤⣀⠀⠀⠀⠀⠀
|
||||
⠀⠀⠀⡠⢴⠻⡀⠀⠈⡎⡇⠀⠀⢃⢸⠀⠀⢸⠀⡇⠀⢸⢀⡇⠀⢠⠃⡎⠀⠀⡼⢡⠃⠀⠙⡆⠀⠀⠀⠀
|
||||
⠀⠀⢸⠁⠀⢣⢱⡀⠀⢸⣸⡀⠀⢸⠈⡄⠀⢸⠀⡇⠀⠘⢸⠀⠀⡸⢰⠁⠀⢰⢡⠏⠀⠀⡜⡿⢤⡀⠀⠀
|
||||
⠀⣠⠞⣷⡄⠀⢣⢣⠀⠀⢧⢇⠀⠈⡆⡇⠀⢸⠀⡇⠀⡇⡼⠀⢀⠇⡏⠀⢠⢇⠎⠀⢀⡜⡜⠁⠀⢳⠀⠀
|
||||
⢸⡁⠀⠈⢻⣦⠀⢫⢧⠀⠘⡾⡄⠀⣇⢡⠀⢸⠀⡇⠀⡇⡇⠀⣸⢸⠀⢀⠏⡜⠀⢀⢎⠞⠀⢀⡴⡻⡄⠀
|
||||
⣰⠻⣆⠀⠀⠻⣷⡀⢻⣇⠀⢹⢧⠀⢸⢸⠀⢸⠀⡇⢠⢿⠃⠀⡇⡇⠀⡜⡾⠀⢠⢾⠎⠀⡰⢫⠞⠀⡟⠀
|
||||
⢹⣅⠙⢷⣄⠀⠙⣷⡀⢻⡄⠈⣿⡄⠘⡞⡆⢸⠀⡇⢸⢸⠀⢸⣸⠀⡸⡽⠁⢠⣯⠋⣠⣾⡖⢁⡠⠚⣿⡄
|
||||
⠘⣏⠳⣄⠙⣦⡀⠘⢧⠀⢻⡄⠸⣧⠀⠇⡇⢸⠀⡇⢸⡌⠀⣇⠇⢰⣱⠁⣠⡻⢃⡴⡷⢋⡴⢋⡤⣺⠇⠀
|
||||
⠀⢹⡕⢄⠑⢌⠛⢦⠈⢣⡀⢻⡀⢳⠀⢸⢳⢸⠀⡇⣎⡇⢸⠽⢠⠇⠁⣰⡿⢡⣾⢞⣴⣯⡔⣫⢴⠟⠀⠀
|
||||
⠀⠀⠙⢦⣝⢦⡑⢄⠳⣌⠳⡈⢧⠈⡆⠸⣼⠸⡀⡇⡏⠁⡏⢀⠎⠀⡰⠉⡱⠋⡡⣫⣞⣽⣋⣴⠟⠀⠀⠀
|
||||
⠀⠀⠀⠀⠉⠻⢿⣮⡳⣌⢦⡱⡌⣆⢸⠀⡟⡆⡇⡇⡇⢸⠁⡜⠀⡼⠁⡜⠁⣪⠞⣿⡵⠟⠉⠀⠀⠀⠀⠀
|
||||
⠀⠀⠀⠀⠀⠀⠀⠙⡾⣾⣷⣵⡜⡜⡄⠇⢣⡇⡇⢳⠁⡎⠀⠀⡼⢁⠞⠠⢾⡵⠟⠉⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
⠀⠀⠀⠀⠀⠀⠀⠀⣷⠈⠛⢿⣾⣾⣾⠘⠈⠁⠇⠀⠀⠁⠀⠾⠁⢀⣤⠞⢫⡗⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
⠀⠀⠀⠀⠀⠀⠀⠀⠘⢧⣄⠀⠙⠿⣟⠀⠀⠀⠀⠀⠀⠀⠀⢀⡴⠛⣡⡴⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠙⠒⠦⠬⠷⢄⡀⠀⠀⠀⣠⠴⠟⠚⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
|
||||
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠒⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\n"
|
||||
|
||||
echo -e "${BROWN}\n[*] Tillåtna tecken: $ALLOWED_CHARS\n${RESET}"
|
||||
|
||||
while true; do
|
||||
echo -e "${GREEN}$$@skal${BROWN}$ ${RESET}\c"
|
||||
read -rs command
|
||||
if [[ $command =~ $ALLOWED_CHARS ]]; then
|
||||
eval "$command"
|
||||
else
|
||||
echo -e "${RED}[-] Fel: Kommandot innehåller otillåtna tecken.${RESET}\n"
|
||||
fi
|
||||
done
|
||||
Reference in New Issue
Block a user