Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CVE-2021-3625 PoC — Zephyr 缓冲区错误漏洞

Source
Associated Vulnerability
Title:Zephyr 缓冲区错误漏洞 (CVE-2021-3625)
Description:Zephyr是美国Linux基金会的一套开源的小型的可缩放的实时操作系统。 Zephyr 存在缓冲区错误漏洞,该漏洞源于Zephyr USB DFU DNLOAD 的缓冲区溢出。
Description
CVE-2021-3625 - Sample exploits for Zephyr
Readme
# CVE-2021-3625

This repository contains a few example exploits for CVE-2021-3625.

All Zephyr-based usb devices up to (and including) version 2.5.0 suffer from
a buffer overflow allowing readout of up to 65kB. Depending on the actual device
this may result of leakage of sensitive data like encryption keys or credentials.

The issue may be triggered by issuing crafted usb control transfer requests
with IN direction (reads, to host) and a write specific request - in example
set address (0x05). In such cases write to host is not expected thus response
length is not updated resulting in a initially set value of request->wLength.
Since wLength is user controlled it can be set to an arbitrary two byte value like
0xffff resulting in readout of 65 kilobytes microcontroller memory. Since size of
buffer is significantly smaller a overflow takes place allowing an attacker
to extract memory contents past the buffer boundary.

Besides application layer also MCUBoot builds with Zephyr USB device stack enabled
are affected. Furthermore along memory readout past buffer bounaries the DFU class
may also be exloited to achive buffer overflow write.

For best results it is recommended to use a libusb build with MAX_CTRL_BUFFER_LENGTH
size increased from default 4096 bytes to 0xFFFF (libusb/os/linux_usbfs.h).

Security Advisory: https://github.com/zephyrproject-rtos/zephyr/security/advisories/GHSA-c3gr-hgvr-f363
File Snapshot

[4.0K] /data/pocs/0234bc665730e100d9abd30e899f78d651be4ca4 ├── [ 472] cdc_set_control_line_state.py ├── [ 457] cdc_set_line_coding.py ├── [ 444] clear_feature.py ├── [1.0K] dfu_overflow.py ├── [ 34K] LICENSE ├── [1.4K] README.md ├── [ 441] set_address.py └── [ 472] set_configuration.py 0 directories, 8 files
Shenlong Bot has cached this for you
Remarks
    1. It is advised to access via the original source first.
    2. If the original source is unavailable, please email f.jinxu#gmail.com for a local snapshot (replace # with @).
    3. Shenlong has snapshotted the POC code for you. To support long-term maintenance, please consider donating. Thank you for your support.