已开启
[安全问题]: 【白细胞AI辅助分析】【安全】【IPC反序列化边界检查缺失】crypto_syscall_common.c存在IPC反序列化边界检查缺失 #28
King of Harmony创建于 6月1日
6月1日 添加了label:SIG_Security
openharmony_ci
6月1日 评论:
6月1日 评论:
感谢提交Issue!关于Issue的交互操作,请访问OpenHarmony社区支持命令清单。如果有问题,请联系 [@peterli](https://gitcode.com/peterli) [@heyanhong](https://gitcode.com/heyanhong) [@sjtugjy](https://gitcode.com/sjtugjy) 。如果需要调整订阅PR、Issue的变更状态,请访问链接。
Thanks for submitting the issue. For more commands, please visit OpenHarmony Command List. If you have any questions, please refer to committer gitcode for help. If you need to change the subscription of a Pull Request or Issue, please visit the link.


6月1日 添加了label:waiting_for_assign
6月24日 关联了pull request:fix(crypto): add overflow checks for restored attributes
7月27日 关联了pull request:修复框架组件中的安全漏洞
感谢对OpenHarmony社区的支持与关注,欢迎反馈安全问题。
漏洞编号:
漏洞归属组件
漏洞归属版本
CVSS V3.0分值
Attack Vector(AV): Local(L) Attack Complexity(AC): Low(L) Privileges Required(PR): Low(L) User Interaction(UI): Not Required(N) Scope(S): Unchanged(U) Confidentiality Impact(C): Medium(M) Integrity Impact(I): Medium(M) Availability Impact(A): Medium(M) CVSS Base Score: 5.5
漏洞简述
【攻击链分析】
利用难度: medium
Prover验证: CONFIRMED (置信度: 0.95)
攻击场景:
恶意可信应用(TA)通过IPC向TEE OS加密驱动发送精心构造的加密参数,利用restore_attrs函数中attr_count与attr_total_len缺乏一致性校验的缺陷,在buffer首部写入超大attr_count值。这会绕过仅校验物理边界的check_attrs_size检查,导致malloc分配时发生整数溢出(分配极小堆块)或触发超大内存请求,最终通过后续的memset_s或循环赋值造成TEE OS内核态堆溢出破坏或OOM拒绝服务。
攻击步骤:
PoC 概念验证:
构造一个crypto_arg结构,设置其size(attr_total_len)为8(合法物理长度,包含4字节count+4字节id),设置其buffer指向的共享内存首4字节(*attr_count)为0x40000000。假设sizeof(crypto_attribute_t)为12,0x40000000 * 12将发生整数溢出,导致malloc分配远小于预期大小的堆块,随后memset_s触发堆溢出。
前置条件:
入口点: driver — ecc_verify_digest_call() @ /home/treffen/OpenHarmony_code/base/tee/tee_os_framework/drivers/crypto_mgr/src/crypto_ioctl/crypto_syscall_ec.c:431
影响类型: uaf (high) — malloc() @ /home/treffen/OpenHarmony_code/applications/standard/photos/imageEditor/common/src/main/cpp/sdk/libs/AiModelRef/include/opencv2/core/utility.hpp:79
影响性分析说明
原理分析
受影响版本
规避方案或消减措施
修改建议: 在restore_attrs函数的check_attrs_size校验中,增加严格的逻辑一致性检查:验证 (*attr_count * sizeof(struct crypto_attribute_t) + sizeof(uint32_t)) <= attr_total_len,并在malloc前对 *attr_count * sizeof(struct crypto_attribute_t) 乘法运算进行显式的整数溢出检查(如检查结果是否小于原值或超过系统限制)。