> ## Content Index
> Fetch the complete content index at: https://taiwanding.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# crackmes.one - babyrev  writeup (zh-TW)
- URL: https://taiwanding.com/crackmes-one-babyrev-writeup-zh-tw/
- Published: 2025-09-22T08:09:44.000Z
- Updated: 2026-07-15T02:49:52.000Z
- Author: Kevin Chen
- Tags: reverse

## 題目概覽

- 目標：輸入正確 **password** 與 **secret code**，印出 flag
- 題目連結: [https://crackmes.one/crackme/6784f8a84d850ac5f7dc5173](https://crackmes.one/crackme/6784f8a84d850ac5f7dc5173?ref=taiwanding.com)

## 偵查與定位

在 `main`看到固定流程：

1. 讀字串

```c
fgets(s, 32, stdin);            // 會保留結尾的 '\n'

```

1. 讀整數

```c
__isoc99_scanf("%d", &code);    // 存到 local_40 / v4

```

1. 雙重檢查

```c
if (code == 1337)                     // 0x539
  if (!strcmp(s, "Sup3rS3cr3tP455W0rd\n"))
    // 印旗子

```

1. 旗子輸出（XOR 迴圈）
- Hex-Rays：

```c
for (i = 0; i <= 0x1A; ++i)
  putchar((char)(flag[i] ^ (i + 105)));

```

- Ghidra（語意相同）：

```c
for (i = 0; i < 0x1b; i++)
  putchar( (flag[i] ^ (i + 0x69)) );

```

> `0x69 = 105`，長度 27（`i=0..26`）。

## 通關輸入

- **secret code**：`1337`
- **password**：`Sup3rS3cr3tP455W0rd`，然後按 Enter  
（因為 `fgets` 比對的是含 `\n` 的字串 `"Sup3rS3cr3tP455W0rd\n"`）

```bash
└─$ ./babyrev
Welcome to baby rev challenge
Input the password:

Sup3rS3cr3tP455W0rd
Input the secret code now:

1337
Correct!
Here is your flag

CTFlearn{Redacted}
```

## 經驗分享

這一題之所以收錄，是因為題目作者介紹了一個好用的工具:

[Decompiler ExplorerDecompiler Explorer is an interactive online decompiler which shows equivalent C-like output of decompiled programs from many popular decompilers.![](https://taiwanding.com/content/images/icon/apple-touch-icon.png)Decompiler Explorer![](https://taiwanding.com/content/images/thumbnail/dogbolt.0138e8c3255b.png)](https://dogbolt.org/?ref=taiwanding.com)

這個工具其實就是整合了市面上的反編譯工具，好比作者常用的ghidra也是其中之一，在沒有機密問題的情況下，只要上傳檔案就可以快速得到反編譯的結果。

![](https://taiwanding.com/content/images/2025/09/image-15.png)