picoCTF2019 vault-door-training [Reverse Engineering]

Your mission is to enter Dr. Evil's laboratory and retrieve the blueprints for his Doomsday Project. The laboratory is protected by a series of locked vault doors. Each door is controlled by a computer and requires a password to open. Unfortunately, our undercover agents have not been able to obtain the secret passwords for the vault doors, but one of our junior agents obtained the source code for each vault's computer! You will need to read the source code for each level to figure out what the password is for that vault door. As a warmup, we have created a replica vault in our training facility. The source code for the training vault is here: VaultDoorTraining.java
(適当な訳)あなたのミッションはDr.Evilの研究室に入り、世界滅亡計画の青写真を入手することです。研究室は一連の施錠された金庫のドアによって保護されています。各ドアはコンピュータで制御されおり、開くにはパスワードが必要です。残念なことに、潜入捜査官は金庫のドアの暗号を入手することができませんでしたが、若手の一人が各金庫のソースコードを入手しました!金庫のドアのパスワードが何であるかは各レベルのソースコードを読む必要があります。準備運動として、訓練施設に複製の金庫を作りました。訓練用金庫のソースコードはここにあります:VaultDoorTraining.java
Hints: The password is revealed in the program's source code.
(適当な訳)パスワードはプログラムのソースコード内で明らかにされます。

今後のvault-door-1, vault-door-2, vault-door-3, vault-door-4, vault-door-5へと続くチャレンジの最初の訓練用問題となっている。ダウンロードできるソースコードを見るとパスワードがそのまま書かれている。

import java.util.*;

class VaultDoorTraining {
   public static void main(String args[]) {
       VaultDoorTraining vaultDoor = new VaultDoorTraining();
       Scanner scanner = new Scanner(System.in); 
       System.out.print("Enter vault password: ");
       String userInput = scanner.next();
       String input = userInput.substring("picoCTF{".length(),userInput.length()-1);
       if (vaultDoor.checkPassword(input)) {
           System.out.println("Access granted.");
       } else {
           System.out.println("Access denied!");
       }
  }

   // The password is below. Is it safe to put the password in the source code?
   // What if somebody stole our source code? Then they would know what our
   // password is. Hmm... I will think of some ways to improve the security
   // on the other doors.
   //
   // -Minion #9567
   public boolean checkPassword(String password) {
       return password.equals("w4rm1ng_Up_w1tH_jAv4_ca5ae7fcc95");
   }
}

checkPasswordの前のコメントを適当に訳してみると、

パスワードは以下である。パスワードをソースコードに書いても安全だろうか?誰かがソースコードを盗んだとしたら?パスワードが何であるかわかってしまう。んー、他のドアのセキュリティを改善する方法を考えます。

とあり、ソースコードにパスワードを直書きすることを心配しているようです。直書きはハードコーディングといって、セキュリティ的に危険なのでやってはいけません。

答え:picoCTF{w4rm1ng_Up_w1tH_jAv4_ca5ae7fcc95}

picoCTF write-upまとめ

この記事が気に入ったらサポートをしてみませんか?