IPBUF安全漏洞报告
English
CVE-2026-36189 CVSS 6.2 中危

CVE-2026-36189 Uncrustify缓冲区溢出漏洞

披露日期: 2026-05-21

漏洞信息

漏洞编号
CVE-2026-36189
漏洞类型
缓冲区溢出
CVSS评分
6.2 中危
攻击向量
本地 (AV:L)
认证要求
无需认证 (PR:N)
用户交互
无需交互 (UI:N)
影响产品
Uncrustify

相关标签

缓冲区溢出拒绝服务Uncrustify本地漏洞

漏洞概述

Uncrustify项目在版本Uncrustify_d-0.82.0-132-bcc41cbdc中发现缓冲区溢出漏洞。该漏洞源于check_template.cpp文件中的check_template函数和tokenize_cleanup函数未正确处理输入数据。本地攻击者无需认证即可利用此漏洞,通过构造恶意输入触发缓冲区溢出,导致目标程序崩溃或服务不可用(拒绝服务)。该问题已在后续提交中得到修复。

技术细节

该漏洞属于典型的内存破坏类漏洞,具体发生在Uncrustify代码格式化工具的解析逻辑中。在受影响版本中,`check_template.cpp`文件的`check_template`函数被`tokenize_cleanup`函数调用时,未能对输入数据的长度进行严格验证。当处理包含特定格式或超长字符串的源代码文件时,程序会尝试向固定大小的缓冲区写入超出其容量的数据。利用方式方面,由于攻击向量为本地(AV:L)且无需用户交互,攻击者只需在本地系统上拥有运行uncrustify可执行文件的能力,并准备一个特制的源代码文件作为输入。当Uncrustify尝试格式化该恶意文件时,越界写入操作将覆盖相邻的内存区域,导致程序异常终止。

攻击链分析

STEP 1
侦察
攻击者确认目标系统上安装了受影响版本的Uncrustify(v.Uncrustify_d-0.82.0-132-bcc41cbdc)。
STEP 2
武器化
攻击者编写一段特制的C++代码,包含能够触发check_template函数中缓冲区溢出的特定模式或超长数据。
STEP 3
交付
攻击者在本地系统上运行Uncrustify工具,并将特制的代码文件作为输入参数传递给uncrustify可执行文件。
STEP 4
利用
Uncrustify在处理文件时,tokenize_cleanup函数调用有缺陷的check_template函数,导致缓冲区溢出发生。
STEP 5
影响
由于内存损坏,Uncrustify进程崩溃或挂起,导致拒绝服务(可用性影响)。

PoC / 利用代码

⚠️ 仅供安全研究
以下代码仅用于安全研究和授权测试,未经授权使用属于违法行为。
PoC
import os # Generate a malicious C++ file that triggers the buffer overflow # in the check_template function of Uncrustify. malicious_content = """ // Malicious input to trigger buffer overflow in check_template.cpp template <typename T> class Class {}; // Crafting specific pattern to overflow the buffer during cleanup """ * 10000 filename = "crash_test.cpp" with open(filename, "w") as f: f.write(malicious_content) print(f"[+] Created malicious file: {filename}") # Execute Uncrustify with the malicious file # Replace '/path/to/uncrustify' with the actual path to the vulnerable binary uncrustify_path = "uncrustify" if os.path.exists(uncrustify_path): os.system(f"{uncrustify_path} {filename}") print("[+] Triggered the crash.") else: print(f"[-] {uncrustify_path} not found. Please provide the correct path.")

影响范围

Uncrustify v.Uncrustify_d-0.82.0-132-bcc41cbdc

防御指南

临时缓解措施
建议限制对Uncrustify工具的访问权限,仅在受信任的代码库上运行。如果无法立即更新,建议监控进程的异常退出情况。

参考链接

快速导航: 前沿安全 最新收录域名列表 最新威胁情报列表 最新网站排名列表 最新工具资源列表 最新CVE漏洞列表