Link
Notice
Recent Posts
Recent Comments
«   2026/07   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
Archives
Today
Total
관리 메뉴

hiariz 님의 블로그

[BYUCTF] enable 본문

CTF, Wargame

[BYUCTF] enable

hiariz 2025. 9. 11. 17:33

문제 코드는 다음과 같습니다.

#!/bin/bash

unset PATH
enable -n exec
enable -n command
enable -n type
enable -n hash
enable -n cd
enable -n enable
set +x

echo "Welcome to my new bash, sbash, the Safe Bourne Again Shell! There's no exploiting this system"

while true; do
    read -p "safe_bash> " user_input
    
    # Check if input is empty
    [[ -z "$user_input" ]] && continue

    case "$user_input" in 
        *">"*|*"<"*|*"/"*|*";"*|*"&"*|*"$"*|*"("*|*"\`"*) echo "No special characters, those are unsafe!" && continue;;
    esac

    # Execute only if it's a Bash builtin
    eval "$user_input"
donehheh

 

코드를 살펴보면 쉘 환경이 제한되어 있는 sbash라는 커스템 쉘에서 flag를 얻는 문제입니다.

 

문제를 처음 접속하면 일반적인 명령어들이 제한되어 있으며, 대부분의 경로 탐색 기능이 비활성화되어 있습니다.

 

여기서 pushd 라는 명령어를 사용하면 다음과 같이 flag를 얻을 수 있습니다.

pushd ..
/ /app

pushd flag
/flag / /app

. flag.txt
flag.txt: line 1: byuctf{enable_can_do_some_funky_stuff_huh?_488h33d}:

'CTF, Wargame' 카테고리의 다른 글

[hacktheon CTF] Nothing is essential  (0) 2025.09.11
[hacktheon CTF] cat  (0) 2025.09.11
[Dreamhack] Amo in the Middle  (0) 2025.09.11
[Dreamhack] WasMazed  (0) 2025.09.11
[Dreamhack] Crossing  (0) 2025.09.01