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.
hint : cron, crontab, crontab(5) (use “man 5 crontab” to access this)
우선 crontab은 cron과 table을 합쳐놓은 말이죠 스케쥴 설정이 가능한 명령어
- crontab -l : 작업표 내용 확인
- crontab -e : 작업표 편집
- crontab 주기
- 분 | 시 | 일 | 월 | 요일 | 사용자 | 실행 명령
- ex) * * * * * bandit22 /usr/bin/cronjob_bandit22.sh &> /dev/null
- 매일 매 분마다 사용자(bandit22)가 cronjob_bandit22파일 실행, 에러는 /dev/null로.
/home/bandit21에는 뭐 아무것도 없길래 문제에서처럼 /etc/cron.d 위치로 이동해서 파일을 확인해봤습니다.
bandit21@bandit:~$ cd /etc/cron.d
bandit21@bandit:/etc/cron.d$ ls -al
total 60
drwxr-xr-x 2 root root 4096 Oct 14 09:29 .
drwxr-xr-x 128 root root 12288 Oct 27 05:55 ..
-r--r----- 1 root root 47 Oct 14 09:26 behemoth4_cleanup
-rw-r--r-- 1 root root 123 Oct 14 09:19 clean_tmp
-rw-r--r-- 1 root root 120 Oct 14 09:26 cronjob_bandit22
-rw-r--r-- 1 root root 122 Oct 14 09:26 cronjob_bandit23
-rw-r--r-- 1 root root 120 Oct 14 09:26 cronjob_bandit24
-rw-r--r-- 1 root root 201 Apr 8 2024 e2scrub_all
-r--r----- 1 root root 48 Oct 14 09:27 leviathan5_cleanup
-rw------- 1 root root 138 Oct 14 09:28 manpage3_resetpw_job
-rwx------ 1 root root 52 Oct 14 09:29 otw-tmp-dir
-rw-r--r-- 1 root root 102 Mar 31 2024 .placeholder
-rw-r--r-- 1 root root 396 Jan 9 2024 sysstat
제가 가야할 곳은 bandit 22를 향해야하고, 마침 cronjob_bandit22가 읽을 수는 있게 해놨네요
그래서 한 번 읽어봤습니다
bandit21@bandit:/etc/cron.d$ cat cronjob_bandit22
@reboot bandit22 /usr/bin/cronjob_bandit22.sh &> /dev/null
* * * * * bandit22 /usr/bin/cronjob_bandit22.sh &> /dev/null
매 분마다 bandit22가 "cronjob_bandit22.sh"파일을 실행시키고 에러는 쓰레기통(/dev/null)에 보낸다고 하네요
그럼 cronjob_bandit22.sh의 내용을 확인하러 가볼까요
bandit21@bandit:/etc/cron.d$ cd /usr/bin
bandit21@bandit:/usr/bin$ cat cronjob_bandit22.sh
#!/bin/bash
chmod 644 /tmp/t7O6lds9S0RqQh9aMcz6ShpAoZKF7fgv
cat /etc/bandit_pass/bandit22 > /tmp/t7O6lds9S0RqQh9aMcz6ShpAoZKF7fgv
사용자 권한이 644로 지정된 /t7O6lds9S0RqQh9aMcz6ShpAoZKF7fgv파일에 bandit22의 password가 들어간다고 하네용
읽어봐야겠죵?
bandit21@bandit:/usr/bin$ cd /tmp
bandit21@bandit:/tmp$ cat t7O6lds9S0RqQh9aMcz6ShpAoZKF7fgv
tRae0UfB9v0UzbCdn9cY0gQnds9GF58Q <-- bandit22 password
이 기분은 오예 입니다 오 우 예 ~
'bandit' 카테고리의 다른 글
| [OverTheWire] bandit 23 -> 24 (0) | 2025.11.28 |
|---|---|
| [OverTheWire] bandit 22 -> 23 (0) | 2025.11.27 |
| [OverTheWire] bandit 17 -> 19 (0) | 2025.11.23 |
| [OverTheWire] bandit 16 -> 17 (0) | 2025.11.23 |
| [OverTheWire] bandit 15 -> 16 (0) | 2025.11.23 |