Honeypot
I’ve just bought this property in a very priviledged part of the system. But there seem to be(e) awfully many bees around. I just hope I can find a way out of this thing the developer has constructed here before I get stung… Category: rev Solver: computerdores, sohn123 Flag: GPNCTF{on_a_scale_from_1_to_10_h0w_WOULd_yOU_r4t3_yOUr_t00lIN6?} Writeup Run Script The first thing we can look at is the running.md and the run.sh: #!/bin/bash set +m pgid=$(ps -o pgid= $$ | xargs) sleep infinity & sleeppid=$! trap "kill $sleeppid" SIGUSR1 run_governor() { java --enable-native-access=ALL-UNNAMED -jar $1 "$sleeppid" "-$pgid" } run_governor "$1" & waitpid $sleeppid echo "Enter your favourite way of printing your flag" TARGET=flag while :; do read -n 1 direction echo case $direction in h) head $TARGET & ;; t) tail $TARGET & ;; c) cat $TARGET & ;; b) base64 $TARGET | base64 -d & ;; *) echo "Invalid" kill -9 -- "-$pgid" ;; esac done From the running.md we know that the run.sh is supposed to be invoked with honeypot.jar as its first parameter. Looking at the run.sh we can see that it first invokes the honeypot.jar as a background process and then waits for another process to be killed. After the process has been killed, the script then repeatedly asks the user to select one out of four programs to be executed on the flag file (head, tail, cat, or base64). ...