mobile wallpaper 1mobile wallpaper 2mobile wallpaper 3
203 字
1 分鐘
[OverTheWire] Bandit Level 21 → Level 22
2025-01-24

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.

Commands you may need to solve this level#

  • cron
  • crontab
  • crontab(5) (use “man 5 crontab” to access this)

My Answer (Step by step)#

  1. 連線到伺服器並登入
ssh bandit21@bandit.labs.overthewire.org -p 2220
  1. 透過 cd 與 ls 指令前往 /etc/cron.d 目錄查看有哪些排程工作
cd /etc/cron.d
ls -al

{{< alert info >}} 根據指令結果,發現有一個檔案 cronjob_bandit22 名稱跟下一等級相關 {{< /alert >}}

  1. 透過 cat 指令將檔案 cronjob_bandit22 內容呈現出來
cat cronjob_bandit22
# @reboot bandit22 /usr/bin/cronjob_bandit22.sh &> /dev/null
# * * * * * bandit22 /usr/bin/cronjob_bandit22.sh &> /dev/null

{{< alert info >}} 根據指令結果,發現此工作會執行 /usr/bin/cronjob_bandit22.sh {{< /alert >}}

  1. 透過 cat 指令將 sh script 呈現出來
cat /usr/bin/cronjob_bandit22.sh
# #!/bin/bash
# chmod 644 /tmp/t7O6lds9S0RqQh9aMcz6ShpAoZKF7fgv
# cat /etc/bandit_pass/bandit22 > /tmp/t7O6lds9S0RqQh9aMcz6ShpAoZKF7fgv

{{< alert info >}} 根據指令結果,發現密碼被複製到 /tmp/t7O6lds9S0RqQh9aMcz6ShpAoZKF7fgv {{< /alert >}}

  1. 透過 cat 指令將 Level 22 密碼呈現出來!
cat /tmp/t7O6lds9S0RqQh9aMcz6ShpAoZKF7fgv
分享

如果這篇文章對你有幫助,歡迎分享給更多人!

[OverTheWire] Bandit Level 21 → Level 22
https://m21248074.github.io/blog/posts/2025-01-24-post102815/
作者
Cavey (凱維)
發布於
2025-01-24
許可協議
CC BY-NC-SA 4.0

部分資訊可能已經過時

目錄