问题描述
install_from_registry 的完整性校验仅读取 plugin.toml 的内容进行哈希,实际被执行的 Python/Node/binary 钩子脚本(hooks/*.py 等)完全没有哈希校验。
受影响文件
crates/librefang-runtime/src/plugin_manager.rs 第 831–849 行
// 只校验 plugin.toml,不校验实际执行的脚本
let manifest_bytes = std::fs::read(target_dir.join("plugin.toml")).unwrap_or_default();
verify_checksum(&manifest_bytes, &expected)?;
安全影响
High — 攻击者可篡改 GitHub 上的钩子脚本,只要不修改 plugin.toml,校验就会通过,恶意代码得以执行。
另外,load_plugin_manifest 中的 [integrity] 哈希声明是可选的——未声明时直接跳过检查(if !manifest.integrity.is_empty()),不强制要求。
建议修复
- 在
plugin.toml 中强制要求声明所有可执行文件的 SHA256 哈希
- 安装时逐一校验每个钩子脚本文件的哈希
[integrity] 字段应为必填,不声明时拒绝安装
问题描述
install_from_registry的完整性校验仅读取plugin.toml的内容进行哈希,实际被执行的 Python/Node/binary 钩子脚本(hooks/*.py等)完全没有哈希校验。受影响文件
crates/librefang-runtime/src/plugin_manager.rs第 831–849 行安全影响
High — 攻击者可篡改 GitHub 上的钩子脚本,只要不修改
plugin.toml,校验就会通过,恶意代码得以执行。另外,
load_plugin_manifest中的[integrity]哈希声明是可选的——未声明时直接跳过检查(if !manifest.integrity.is_empty()),不强制要求。建议修复
plugin.toml中强制要求声明所有可执行文件的 SHA256 哈希[integrity]字段应为必填,不声明时拒绝安装