# TinyOS 2.1.2 printfUART 全局缓冲区溢出漏洞
## 概述
TinyOS 2.1.2 及之前版本在 ZigBee / IEEE 802.15.4 协议栈的 printfUART 格式化输出实现中存在全局缓冲区溢出漏洞。
## 影响版本
TinyOS 2.1.2 及以下版本。
## 细节
printfUART 将输出写入一个固定大小的全局缓冲区,处理 `%s` 格式符时使用 `strcat()` 拼接字符串,未检查缓冲区剩余空间。当传入的用户控制字符串超出缓冲区容量时,`sprintf`/`strcat` 序列会向 `debugbuf` 尾部外写入数据,导致全局缓冲区溢出。
## 影响
可导致全局内存破坏,引发拒绝服务、程序行为异常,或通过污染相邻全局变量及 UART 输出造成信息泄露。
是否为 Web 类漏洞: 未知
判断理由:
| # | POC 描述 | 源链接 | 神龙链接 |
|---|
标题: GitHub - tinyos/tinyos-main: Main development repository for TinyOS (an OS for embedded, wireless devices). -- 🔗来源链接
标签:product
神龙速读:
### 漏洞关键信息
#### 1. 过渡到新仓库
- **关键点**: 本项目正在从`tinyos-main`过渡到`tp-freeforall/prod`。
- **潜在风险**: 使用者需要更新其引用的仓库地址,以免使用过时的代码。
#### 2. 脱离维护的平台
- **关键点**: 某些平台被标记为不活跃状态,将会被废弃。
- **潜在风险**: 使用已废弃平台的开发环境可能存在兼容性问题或安全漏洞。
#### 3. 维护状态变化
- **关键点**: 该主仓库`tinyos-main`的活动减少,新工作集中在`tp-freeforall/prod`。
- **潜在风险**: 如依赖此仓库构建的系统或应用可能面临更新延迟带来的风险。
#### 建议
- **建议开发者和用户**: 转移至新的`tp-freeforall/prod`仓库,以获取最新的功能改进和安全更新。
标题: TinyOS <= 2.1.2 Global Buffer Overflow in printfUART | Advisories | VulnCheck -- 🔗来源链接
标签:third-party-advisory
神龙速读:
## 漏洞概览
### 标题
TinyOS <= 2.1.2 Global Buffer Overflow in printfUART
### 严重性
MEDIUM
### 日期
January 14, 2026
### 影响范围
- TinyOS <= 2.1.2
### CVE
CVE-2026-22211
### CWE
CWE-787 Out-of-bounds Write
### CVSS
CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N
### 参考
- Researcher SecLists Disclosure
- TinyOS GitHub Repository
### 所属者
Ron Edgerson
### 描述
TinyOS versions up to and including 2.1.2 contain a global buffer overflow vulnerability in the printfUART formatted output implementation used within the ZigBee / IEEE 802.15.4 networking stack. The implementation formats output into a fixed-size global buffer and concatenates strings for %s format specifiers using strcat() without verifying remaining buffer capacity. When printfUART is invoked with a caller-controlled string longer than the available space, the unbounded sprintf/strcat sequence writes past the end of debugbuf, resulting in global memory corruption. This can cause denial of service, unintended behavior, or information disclosure via corrupted adjacent global state or UART output.
标题: Full Disclosure: TinyOS 2.1.2 Stack-Based Buffer Overflow in mcp2200gpio -- 🔗来源链接
标签:technical-descriptionexploit
神龙速读:
# 关键漏洞信息
- **漏洞类型**: 栈溢出 (Stack-Based Buffer Overflow)
- **受影响的软件**: TinyOS 2.1.2 中的 mcp2200gpio 工具
- **漏洞原因**: 由于在构造设备路径时使用了不安全的 `strcpy()` 和 `strcat()` 函数。
- **攻击方式**: 攻击者可以创建一个特殊设计的文件名在 `/dev/usb/` 下,触发漏洞导致栈内存损坏和进程崩溃。
- **潜在影响**:
- 栈内存损坏
- 服务中断(应用崩溃)
- 在非加固编译版本中可能导致任意代码执行。
### 根源分析
该漏洞发生在程序扫描 `/dev/usb/` 中的 HID 设备并使用无边界字符串操作构造设备路径时。
```c
char temppath[255];
strcpy(temppath,"/dev/usb/");
strcat(temppath,dir->d_name);
```
`dir->d_name` 是攻击者通过文件系统控制的,可以达到 `NAME_MAX` 字节。与静态前缀 `/dev/usb/` 拼接后,可能超过固定大小的 `temppath` 栈缓冲区,导致栈溢出。
### 漏洞影响
溢出会覆盖相邻栈变量,包括稍后用于 HID `ioctl` 操作的结构体。
### 概念验证 (Proof of Concept)
```bash
sudo mkdir -p /dev/usb
sudo touch /dev/usb/hiddev$(python3 - << 'EOF'
print("A" * 246)
EOF
)
# sudo ./mcp2200gpio -n 1 -m on -v 0x0000
```
### 输出示例:
```
==492273==ERROR: AddressSanitizer: stack-buffer-overflow on address 0xfbfab9c0040f ...
```
```
Summary: AddressSanitizer: stack-buffer-overflow ...
```
Zaproxy alias impedit expedita quisquam pariatur exercitationem. Nemo rerum eveniet dolores rem quia dignissimos.