BugKu IOT刷题日志

reboot

https://github.com/BYU-CSA/BYUCTF-2024

题目把flag放在一个随机目录下

然后题目的server存在一个命令拼接漏洞,直接第一次set hostname的时候,把hostname设置成;/bin/bash;第二次即可拿到shell

有shell了想要找到一个flag路径就不多说了

Sal

https://github.com/BYU-CSA/BYUCTF-2024

external flash memory chip(外部存储芯片) 一般用来存数据(文件系统),需要分析Saleae逻辑分析仪捕获的信号,来还原这个文件系统

需要从官网下载一个分析sal文件的工具

Download Logic 2 – Saleae

网上搜索一下,可以得知Winbond 25Q128JVSQ使用的是spi通信协议

SPI 有四条信号线,这里主设备是指控制者,从设备是指flash存储芯片

  • 片选(CS):片选信号,低电平有效
  • 时钟(SPI CLK, SCLK):时钟信号由主机产生
  • MOSI:主机输出,从机输入
  • MISO主机输入,从机输出

主机和从机之间的SPI连接

这里要注意一下,主机和从机的MOSI和MISO的接线,这个跟串口TX,RX不一样,很多人容易搞错,主机的MISO接从机的MISO,主机的MOSI接从机的MOSI,直连不交叉。

分析并且导出数据,得先区分这四个通道分别对应哪四个信号线,读取数据的时候,CS的电平会被拉低,然后通过DI依次输入0x3h以及一个24位的地址,地址被接收后,从设备准备好输出数据时,时钟信号会从高电平变成低电平触发数据输出

很明显channel1是CLK,channel2是符合CS的波形的,channel3对应DI,先发指令再发地址,那么channel4对应的就是DO了

选择分析工具里的SPI

根据刚才的分析选择通道

分析完后导出数据

导出之后,输入命令

python saleae_parser.py -z spi --binary --device W25Q128JVSQ ~/iot/byuctf/sal/data.csv

binwalk解压一下

最终成功提取出固件,到etc目录下找到passwd

最终答案:byuctf{c8ef3ad94c6eb97f4fa94a0f0ed33980}

UPnP

题目描述(已翻译):

我发现我的路由器在 52881 端口上暴露了 UPnP 服务,并开始与其交互。使用一些基本的枚举工具,我获取了 UPnP 操作的列表。唯一一个我能从中得到实际回应的是 GetDeviceInfo ,但我完全无法理解它……你能解释一下吗?

nonce 的 base64 编码值是什么?

检查一下文件类型,是data

actions.txt的内容如下

这里有对于actions的一些数据格式的描述

简单来说,就是一条数据由ID(2字节):Length(2字节):value(Length字节)组成,ID定义在android.googlesource.com

根据定义可以得到solve脚本

import sys
import base64
import struct

info = open('./msg.bin', 'rb').read()
print("Device Info:")
while info:
    try:
        type, length = struct.unpack('!HH', info[:4])
        value = struct.unpack('!%is'%length, info[4:4+length])[0]
        info = info[4+length:]

        if type == 0x1023:
            print('\tModel Name: %s' % value)
        elif type == 0x1021:
            print('\tManufacturer: %s' % value)
        elif type == 0x1011:
            print('\tDevice Name: %s' % value)
        elif type == 0x1020:
            pretty_mac = ':'.join('%02x' % v for v in value)
            print('\tMAC Address: %s' % pretty_mac)
        elif type == 0x1032:
            encoded_pk = base64.b64encode(value)
            print('\tPublic Key: %s' % encoded_pk)
        elif type == 0x101a:
            encoded_nonce = base64.b64encode(value)
            print('\tNonce: %s' % encoded_nonce)
        elif type == 0x104a:
            print('\tVersion: %s' % value)
        elif type == 0x1022:
            print('\tMessage Type: %s' % value)
        elif type == 0x1047:
            print('\tUUID_E: %s' % value)
        elif type == 0x1004:
            print('\tAuth Type Flags: %s' % value)
        elif type == 0x1010:
            print('\tEncr Type Flags: %s' % value)
        elif type == 0x100d:
            print('\tConn Type Flags: %s' % value)
        elif type == 0x1008:
            print('\tConfig Methods: %s' % value)
        elif type == 0x1044:
            print('\tSC State: %s' % value)
        elif type == 0x1024:
            print('\tModel Number: %s' % value)
        elif type == 0x1042:
            print('\tSerial Number: %s' % value)
        elif type == 0x1054:
            print('\tPrim Dev Type: %s' % value)
        elif type == 0x103c:
            print('\tRF Band: %s' % value)
        elif type == 0x1002:
            print('\tAssoc State: %s' % value)
        elif type == 0x1012:
            print('\tDevice Pwd ID: %s' % value)
        elif type == 0x1009:
            print('\tConfig Error: %s' % value)
        elif type == 0x102d:
            print('\tOS Version: %s' % value)
        elif type == 0x1049:
            print('\tVendor Ext: %s' % value)
        else:
            print(hex(type),value)
    except Exception as e:
        print("Failed TLV parsing",e)
        print(info[:20])
        sys.exit(1)

外星人的音游掌机

描述:一块带着四个开关、一个 LED、一个串口、和一块 iCE40-HX1K-TQ144 FPGA 芯片的电路板。以纳秒量级的速度正确地按动开关,LED 会亮起,同时串口会输出 flag。

你记下了存储在 Flash 中 FPGA 的比特流(bitstream.bin)和电路板的接线(constraint.pcf)。

完成本题并不需要任何硬件设备。

照着official/外星人的音游掌机/README.md · Scripter_doge/hackergame2021-writeups – Gitee.com复现的,过了~

用到的命令:

构建工具

git clone https://github.com/YosysHQ/icestorm.git icestorm
cd icestorm
make -j$(nproc)
sudo make install

反编译FPGA

iceunpack bitstream.bin bitstream.asc
icebox_vlog -p constraint.pcf -n top bitstream.asc > recovered.v

暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇