[Bandit] Level 22 → Level 23
Bandit Level 22 풀이 과정을 설명합니다.
문제
Level Goal
A program is running automatically at regular intervals from cron, the time-based job scheduler. Look in /etc/cron.d/ for the configuration and see what command is being executed.
NOTE: Looking at shell scripts written by other people is a very useful skill. The script for this level is intentionally made easy to read. If you are having problems understanding what it does, try executing it to see the debug information it prints.
해결
문제에서 주어진
/etc/cron.d파일로 이동해 bandit23 계정에 대한cronjob을 확인할 수 있습니다.
확인해보면,
/usr/bin/cronjob_bandit23.sh파일을/dev/null로 리다이렉션하고 있습니다.
해당 파일을 읽어보니 쉘 스크립트 코드가 포함되어 있었고, 쉘 스크립트는 컴파일 없이 바로 실행할 수 있습니다.
스크립트를 실행해보면
/tmp/8169b67bd894ddbb4412f91573b38db3파일에 password가 있다는 것을 알 수 있습니다.
/tmp/8169b67bd894ddbb4412f91573b38db3파일을 읽어보면 패스워드가 출력됩니다.그런데 이것은 bandit22 계정에 대한 패스워드를 구한 것이므로
echo I am user bandit23 | md5sum | cut -d ' ' -f 1에 bandit23을$myname위치에 대입해 구해보면$mytarget이 출력됩니다.출력된 값을
/tmp/에 대입해 파일을 읽어보면 패스워드를 구할 수 있습니다.
댓글
이 글이 마음에 드셨다면 반응이나 댓글을 남겨주세요!
댓글을 작성하려면 로그인하세요

뉴스레터 구독하기
새로운 포스트가 올라오면 이메일로 알려드려요!