티스토리 뷰

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으로 실행되어 자동으로 일정한 간격에 동작한다. `/etc/cron.d/`에서 어떤 명령이 실행되고 있는지 설정을 확인해라.
Commands you may need to solve this level
`cron`, `crontab`, `crontab(5)`(use “man 5 crontab” to access this)
Write Up
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
```
`cronjob_bandit22` 파일의 내용을 확인해보면 부팅 시 bandit22 계정 권한으로 `cronjob_bandit22.sh`를 `* * * * *` 주기로 실행하고 있음을 확인할 수 있다.
```shell
bandit21@bandit:/etc/cron.d$ ls -al /usr/bin/ | grep bandit22
-rwxr-x--- 1 bandit22 bandit21 130 Oct 5 2023 cronjob_bandit22.sh
해당 실행 파일은 bandit21 계정 권한으로 읽을 수 있다. 파일의 내용은 다음과 같다.
bandit21@bandit:/etc/cron.d$ cat /usr/bin/cronjob_bandit22.sh
#!/bin/bash
chmod 644 /tmp/t7O6lds9S0RqQh9aMcz6ShpAoZKF7fgv
cat /etc/bandit_pass/bandit22 > /tmp/t7O6lds9S0RqQh9aMcz6ShpAoZKF7fgv
bash shell로 `/tmp` 하위의 파일 권한을 644로 변환하고, `/etc/bandit_pass/bandit22` 파일의 내용을 `/tmp` 하위의 해당 파일에 저장한다. 부팅 이후 매분 실행하는 것으로 스케줄링 되어 있기 때문에 해당 파일을 확인하면 bandit22의 패스워드를 알 수 있을 것이다.
'Wargame > Bandit' 카테고리의 다른 글
| Bandit Level 23 → Level 24 (0) | 2024.05.16 |
|---|---|
| Bandit Level 22 → Level 23 (0) | 2024.05.16 |
| Bandit Level 20 → Level 21 (0) | 2024.05.16 |
| Bandit Level 19 → Level 20 (0) | 2024.05.16 |
| Bandit Level 18 → Level 19 (0) | 2024.05.16 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- React
- Spring Security
- askers
- JPA
- webgoat
- linux
- Spring
- Misc
- Database
- 회고
- sql injection
- opengraph
- math
- CSRF
- java
- Framework
- DP
- oauth2
- Dreamhack
- WEB
- PS
- sqli
- Transaction
- SEO
- Bandit
- test
- XSS
- WarGame
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | |
| 7 | 8 | 9 | 10 | 11 | 12 | 13 |
| 14 | 15 | 16 | 17 | 18 | 19 | 20 |
| 21 | 22 | 23 | 24 | 25 | 26 | 27 |
| 28 | 29 | 30 |
글 보관함