# Firmware

> Router firmware is a nice target to start your bug hunting journey. But you have to first understand how the firmware is loaded.
>
> There is always a file in the firmware image that tells the router what services to start. Find this file.
>
> MD5 (firmware.img.gz) = 488d36e3855f16972adec9067ca6deb2
>
> **Author:** daniellimws

There are **TWO** ways to solve this challenge, and we will show both!

### Solution 1

For this challenge, we were given an `.img` file, so the first this we did was open it with [7zip](https://www.7-zip.org/download.html), and took a look inside. We noticed there was a bunch of folders inside and so we extracted it.

![](/files/k1u2DFGPJZTssZNmJBu5)

Given the challenge description, it gave us a hint on where to look for! In this case, it is the `/etc/inittab`. The [inittab](https://docs.oracle.com/cd/E19683-01/806-4073/6jd67r96e/index.html) tells the router what processes to start, and what actions to take when it starts!&#x20;

Looking inside that folder, we found the flag!!&#x20;

![flag!!](/files/Y644hhgLJkacFPVPD6oD)

Flag: `grey{inittab_1s_4n_1mp0rt4nt_p14c3_t0_100k_4t_wh3n_r3v3rs1ng_f1rmw4r3}`

### Solution 2

After extracting the folders out, we can run a [PowerShell](https://docs.microsoft.com/en-us/powershell/scripting/overview?view=powershell-7.2) command that recursively search/find a string it directories, subdirectories and files!&#x20;

```powershell
Get-ChildItem -Path PATH_TO_YOUR_DIRECTORY -recurse 
| Select-String -Pattern "grey"
```

![PowerShell command](/files/iq4LJne3hHB8P6MEC33a)

Flag: `grey{inittab_1s_4n_1mp0rt4nt_p14c3_t0_100k_4t_wh3n_r3v3rs1ng_f1rmw4r3}`

Who updates their firmware anyway? Ain't nobody got time for that! :penguin:&#x20;

![](/files/2wMRWgMqU6LYTXDsXSjq)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://nitrozeus.gitbook.io/ctfs/2022/grey-cat-the-flag-2022/firmware.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
