Skip to content

Instantly share code, notes, and snippets.

@ormaaj
Last active December 18, 2015 07:19
Show Gist options
  • Select an option

  • Save ormaaj/5746174 to your computer and use it in GitHub Desktop.

Select an option

Save ormaaj/5746174 to your computer and use it in GitHub Desktop.
Puzzle. Moderately easy difficulty.
# Exploit this vulnerable program to run an arbitrary command without renaming or adding any files.
k# ksh -c 'touch printf "you fail\n"; printf "%s: " "give me a value"; read -r b; a=(~(N)*); "${a[@]}" "$b" "$@"' _ args...; code...
# My solution. There may be others.
k# ksh -c 'rm *; touch printf "you fail\n"; printf "%s\n" "give me a value"; read -r b; a=(~(N)*); "${a[@]}" "$b" "$@"' \
_ I win. |& { sleep .2; rm -- ~(N)*; print -p echo; cat <&p; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment