🌱초급

[Bandit] Level 23 → Level 24

Bandit Level 23 풀이 과정을 설명합니다.

2분 읽기

문제

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: This level requires you to create your own first shell-script. This is a very big step and you should be proud of yourself when you beat this level!

NOTE 2: Keep in mind that your shell script is removed once executed, so you may want to keep a copy around…


해결

image.png
  • 문제에서 주어진 /etc/cron.d 아래의 cronjob_bandit24 파일을 읽어보면 /usr/bin/cronjob_bandit24.sh/dev/null로 리다이렉션하고 있다는 것을 알 수 있습니다.

image.png
  • 해당 파일을 읽어 보니 쉘 스크립트가 존재했는데, /vat/spool/bandit24의 모든 스크립트를 실행한 후 60초 뒤에 삭제하도록 되어 있습니다.

  • 그렇기 때문에 쉘스크립트를 실행하면 bandit24에 대한 패스워드를 구할 수 없습니다.

  • 또한, 이전과 달리 cat /tmp/~ 에 대한 내용이 없는데, 이에 대한 코드를 직접 작성해줘야 합니다.

image.png
  • /tmp 아래에 sik 이라는 디렉토리를 만들어 dump.sh 에 스크립트를 작성하고, bandit24 의 패스워드를 sik 폴더 아래에 bandit_pass 라는 파일에 작성합니다.

  • 권한을 부여한 후 dump.sh에 작성한 내용을 /var/spool/bandit24에 복사하면 bandit_pass 파일에 bandit24의 패스워드가 복사됩니다.

  • 이를 읽으면 패스워드가 출력됩니다.


댓글

이 글이 마음에 드셨다면 반응이나 댓글을 남겨주세요!

댓글을 작성하려면 로그인하세요

로딩 중...
공유
sikk

sikk

Author

보안을 공부하는 개발자입니다. Web2/Web3 보안과 시스템 해킹에 관심이 많습니다.

뉴스레터 구독하기

새로운 포스트가 올라오면 이메일로 알려드려요!