AI Security AI安全 8h ago Updated 2h ago 更新于 2小时前 57

Critical Rails Flaw Could Let Unauthenticated Attackers Read Server Files via Image Uploads 关键Rails漏洞可能允许未认证攻击者通过图像上传读取服务器文件

A critical vulnerability (CVE-2026-66066, CVSS 9.5) in Ruby on Rails' Active Storage allows unauthenticated attackers to read arbitrary server files via crafted image uploads when using libvips for processing. The flaw exposes sensitive secrets like `secret_key_base`, database passwords, and API tokens by bypassing trust boundaries between Active Storage and unsafe libvips operations. Affected versions include Rails 7.0.0–7.2.3.1, 8.0.0–8.0.5, and 8.1.0–8.1.3; Rails 6.x is affected only if expli Ruby on Rails 发布修复补丁,解决 Active Storage 中一个严重漏洞(CVE-2026-66066),CVSS 评分为 9.5。 该漏洞允许未认证攻击者通过构造图像上传读取服务器上的任意文件,可能泄露敏感信息如密钥、数据库密码等。 受影响的应用程序使用 libvips 处理 Active Storage 的图像,并接受来自不可信用户的图像上传。 建议立即升级到 Rails 7.2.3.2、8.0.5.1 或 8.1.3.1,并旋转所有可能被应用程序进程读取的秘密。 补丁要求 libvips 版本至少为 8.13,如果安装了 ruby-vips,则其版本需至少为 2.2.

85
Hot 热度
70
Quality 质量
90
Impact 影响力

Analysis 深度分析

TL;DR

  • A critical vulnerability (CVE-2026-66066, CVSS 9.5) in Ruby on Rails' Active Storage allows unauthenticated attackers to read arbitrary server files via crafted image uploads when using libvips for processing.
  • The flaw exposes sensitive secrets like secret_key_base, database passwords, and API tokens by bypassing trust boundaries between Active Storage and unsafe libvips operations.
  • Affected versions include Rails 7.0.0–7.2.3.1, 8.0.0–8.0.5, and 8.1.0–8.1.3; Rails 6.x is affected only if explicitly configured with Vips.
  • Mitigation requires upgrading to patched Rails versions (7.2.3.2+, 8.0.5.1+, 8.1.3.1), enforcing libvips ≥8.13/ruby-vips ≥2.2.1, rotating all exposed secrets, and setting VIPS_BLOCK_UNTRUSTED or calling Vips.block_untrusted(true) as interim measures.
  • No public PoC or in-the-wild exploitation was reported at publication, but further technical details are scheduled for release by August 28, 2026.

Why It Matters

This vulnerability represents a high-severity supply-chain-like risk where a trusted image-processing library (libvips) introduces an insecure path into web applications through Active Storage’s default configuration. For AI practitioners and security teams, it underscores the importance of validating third-party library behaviors in file-handling pipelines—even seemingly benign operations like image uploads can become attack vectors if input sanitization and privilege isolation are not rigorously enforced across component boundaries.

Technical Details

  • Vulnerability Mechanism: Active Storage passes untrusted image attachments directly to libvips’ “unfuzzed” or “untrusted” loaders/savers (e.g., those backed by external libraries without proper input validation), enabling arbitrary file reads from the server filesystem accessible to the Rails process.
  • Affected Components: The issue resides in the integration layer between Active Storage and libvips; specifically, both the Vips analyzer and transformer components failed to filter out unsafe operations during variant generation—even without explicit resize/thumbnail endpoints being exposed.
  • Scope & Conditions: Exploitation requires three conditions: (1) use of libvips as the image processor (not MiniMagick), (2) acceptance of untrusted user-uploaded images, and (3) inclusion of an exploitable operation in the libvips build. Applications using Rails 7.0/7.1 cannot patch via upgrade alone since those branches are end-of-life.
  • Patch Implementation: The fix injects Vips.block_untrusted(true) at Active Storage startup to disable unsafe libvips operations. Alternatively, environment variable VIPS_BLOCK_UNTRUSTED can be set for libvips ≥8.13, or direct invocation used for ruby-vips ≥2.2.1. Older libvips versions lack this capability entirely.
  • Credential Exposure Risk: Successful exploitation grants access to any file readable by the Rails worker, potentially revealing cryptographic keys, database credentials, cloud storage tokens, and API secrets—enabling lateral movement or remote code execution depending on downstream system access.

Industry Insight

Organizations relying on Ruby on Rails with Active Storage and libvips must prioritize immediate patching and secret rotation, especially given that stolen credentials remain valid post-patch. This incident highlights the need for deeper scrutiny of dependency trust models in web frameworks—particularly around media processing modules—and suggests that future security audits should include fuzz testing of file-input handlers against known unsafe operations in underlying libraries. Additionally, the delayed disclosure of full exploit details (until August 28) indicates a coordinated responsible-release strategy, which may encourage similar practices in open-source security advisories to balance urgency with preparedness.

TL;DR

  • Ruby on Rails 发布修复补丁,解决 Active Storage 中一个严重漏洞(CVE-2026-66066),CVSS 评分为 9.5。
  • 该漏洞允许未认证攻击者通过构造图像上传读取服务器上的任意文件,可能泄露敏感信息如密钥、数据库密码等。
  • 受影响的应用程序使用 libvips 处理 Active Storage 的图像,并接受来自不可信用户的图像上传。
  • 建议立即升级到 Rails 7.2.3.2、8.0.5.1 或 8.1.3.1,并旋转所有可能被应用程序进程读取的秘密。
  • 补丁要求 libvips 版本至少为 8.13,如果安装了 ruby-vips,则其版本需至少为 2.2.1。

为什么值得看

此漏洞涉及广泛使用的 Ruby on Rails 框架及其 Active Storage 组件,对依赖这些技术栈的企业和开发者构成重大安全威胁。及时了解和修复此漏洞对于保护应用免受潜在的数据泄露和远程代码执行攻击至关重要。

技术解析

  • 漏洞描述:漏洞位于 Active Storage 与 libvips 的信任边界上。libvips 支持加载器、保存器和其他操作,其中一些由第三方库支持,并被标记为“unfuzzed”或“untrusted”,因为它们对敌意输入不安全。Active Storage 没有阻止这些操作,导致可以通过构造的上传调用其中一个并披露 Rails 工作进程可读的文件。
  • 影响范围:受影响的 Rails 版本包括 7.0.0 至 7.2.3.1、8.0.0 至 8.0.5 以及 8.1.0 至 8.1.3。Rails 6.0.0 至 6.1.7.10 只有在 Active Storage 配置为使用 Vips 时才受影响,而在 Rails 6 中这不是默认处理器。
  • 修复措施:官方补丁在 Active Storage 启动时调用 Vips.block_untrusted(true)。无法立即更新 Rails 的应用可以在运行 libvips 8.13 或更高版本时设置 VIPS_BLOCK_UNTRUSTED,或者在使用 ruby-vips 2.2.1 或更高版本时调用 Vips.block_untrusted(true)
  • 依赖要求:补丁后的安装需要 libvips 8.13 或更高版本,并且如果安装了 ruby-vips,则需要其版本为 2.2.1 或更高版本。

行业启示

  • 快速响应的重要性:此类高危漏洞的快速发现和修复突显了开源社区和厂商在维护软件安全性方面的重要作用。企业和开发者应密切关注相关安全公告并及时更新依赖项。
  • 最小权限原则:在处理用户上传的文件时,应遵循最小权限原则,确保应用程序仅具有完成任务所需的最小权限,以减少潜在的安全风险。
  • 持续监控与审计:定期进行安全审计和监控可以帮助早期发现类似的问题,从而采取预防措施避免数据泄露或其他安全事故的发生。

Disclaimer: The above content is generated by AI and is for reference only. 免责声明:以上内容由 AI 生成,仅供参考。

Security 安全 Open Source 开源