To comply with the rule, in this write-up, I just deal with some hints related to this challenge. Here is no correct answer and no solution.
룰을 준수하기 위해, 이 문서에서는 이 챌린지와과 관련된 몇 가지 힌트만을 다룹니다. 여기에 정답과 솔루션은 없습니다.
I couldn't write the (Level 21 → Level 22) write-up to Steemit due to lack of RC. If you need the write-up, please refer to the bottom link.
(Level 21 → Level 22) write-up은 RC가 부족해서 스팀잇에 작성하지 못했습니다. 확인이 필요하신분은 맨 하단 링크를 참조해주세요.
Bandit Level 22 → Level 23
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.
레벨 목표
한 프로그램이 cron에 의해 자동으로 그리고 주기적으로 실행되고 있다. 참고로 cron은 시간 기반의 스케줄러 프로그램이다. "/etc/cron.d/" 디렉토리에 가보면 어떤 프로그램이 실행하도록 설정되어있는지 확인할 수 있다.
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.
참고: 다른 사람들이 작성한 쉘 스크립트를 볼 수 있는 능력은 유용하다. 현재 레벨의 스크립트는 읽기 쉽게 작성되었다. 만약 이해하는데 어려움을 겪는다면, 그것이 출력하는 디버그 정보를 확인하라.
Commands you may need to solve this level
이 레벨을 클리어하기 위해 필요할 것으로 예상되는 명령어.
cron, crontab, crontab(5) (use “man 5 crontab” to access this)
This challenge requires the ability to read a shell script. If you have experience of some shell script, it will be easier.
이 챌린지는 setuid를 다루는 능력을 요구합니다. 만약 당신이 setuid를 가진 소프트웨어 경험이 있다면 보다 수월할 것입니다.
The below is some part of the resolution procedures. I could find the flag as follow.
아래는 풀이 과정중 일부입니다. 아래와 같이 플래그를 찾을 수 있었습니다.
bandit22@bandit:/etc/cron.d$ cat /usr/bin/cronjob_bandit23.sh
#!/bin/bash
myname=$(whoami)
mytarget=$(echo I am user $myname | md5sum | cut -d ' ' -f 1)
echo "Copying passwordfile /etc/bandit_pass/$myname to /tmp/$mytarget"
cat /etc/bandit_pass/$myname > /tmp/$mytarget
- Omission 중략 -
Combining all the information so far, I can anticipate that once "bandit23" logs in, the password file will be created with the hash value of "bandit23". This happens because this shell program runs every minute.
지금까지 확보된 정보들을 종합하면, "bandit23"이 로그인 한다면 이 계정의 해시 값으로 패스워드 파일이 생성됨을 생각해볼 수 있다. 이는 매 분마다 이 쉘 프로그램이 실행되기 때문.
- Omission 중략 -
bandit22@bandit:/usr/bin$ echo I am user bandit23 | md5sum | ■■■■■■■■■ -f 1
8ca■■■■■■86bf■■■■■■■■0fbe8■■■■■■6349
bandit22@bandit:/usr/bin$ cat /tmp/8ca■■■■■■86bf■■■■■■■■0fbe8■■■■■■6349
jc■■■1tiHqj■■■pX5■■■n
If you need the full write-up PDF, please refer to the following page.
풀 write-up PDF가 필요하신 분은 아래 페이지를 참고하시기 바랍니다.
https://cysecguide.blogspot.com/2017/10/wargame-write-up-list.html