AI Security AI安全 7h ago Updated 3h ago 更新于 3小时前 43

PostgreSQL Fixes 12-Year-Old Logical Decoding Flaw Enabling Replication-Role Code Execution PostgreSQL修复12年历史的逻辑解码漏洞,该漏洞可导致复制角色代码执行

PostgreSQL fixed CVE-2026-6471, a 12-year-old logical decoding vulnerability allowing REPLICATION-role accounts to execute arbitrary code as the OS user running the database server The flaw exists because replication users could bypass LOAD-time protections and supply arbitrary library paths via the CREATE_REPLICATION_SLOT command, including path traversal sequences The fix introduces a new `output_plugin_libraries` whitelist parameter (defaulting to 'pgoutput, test_decoding'), shipped in versio PostgreSQL修复了CVE-2026-6471漏洞,该漏洞允许具有REPLICATION属性的账户以操作系统用户权限执行任意代码 漏洞存在于自2014年引入逻辑解码功能以来的PostgreSQL版本中,影响版本14-18 修复方案引入了output_plugin_libraries白名单参数,默认仅允许pgoutput和test_decoding插件 漏洞利用需要REPLICATION属性和wal_level=logical配置,攻击者可通过逻辑解码输出插件加载恶意库 受影响用户需更新至指定版本并配置output_plugin_libraries参数,部分第三方插件需额外配置

62
Hot 热度
65
Quality 质量
55
Impact 影响力

Analysis 深度分析

TL;DR

  • PostgreSQL fixed CVE-2026-6471, a 12-year-old logical decoding vulnerability allowing REPLICATION-role accounts to execute arbitrary code as the OS user running the database server
  • The flaw exists because replication users could bypass LOAD-time protections and supply arbitrary library paths via the CREATE_REPLICATION_SLOT command, including path traversal sequences
  • The fix introduces a new output_plugin_libraries whitelist parameter (defaulting to 'pgoutput, test_decoding'), shipped in versions 18.6, 17.11, 16.15, 15.19, and 14.24
  • Exploitation requires a REPLICATION attribute account and wal_level = logical, conditions common in backup tools, standby servers, and CDC pipelines
  • A remaining gap exists in pg_createsubscriber, which creates replication slots without checking the new parameter, causing dry-run success but actual conversion failure

Why It Matters

This vulnerability demonstrates how a long-standing architectural oversight in a core database feature can cascade into full OS-level compromise, affecting organizations relying on replication, CDC, and backup infrastructure. It underscores the importance of principle-of-least-privilege enforcement across database roles and the risks of legacy code paths escaping modern security restrictions.

Technical Details

  • Vulnerability mechanism: The replication protocol parser accepts nearly any character inside a double-quoted plugin name, including path separators and ../ traversal, passing the full filesystem path directly to the library loader without invoking standard LOAD restrictions
  • Platform-specific exploitation: On Windows, attackers can resolve network paths over SMB to fetch malicious libraries without writing to disk; on Linux/macOS, NFS automounting enables similar remote loading
  • Fix implementation: The output_plugin_libraries GUC parameter restricts loadable output plugins to a whitelist, with backward compatibility preserved by defaulting to built-in plugins only
  • Persistence techniques demonstrated: Cyera's test plugin modified the role catalog to escalate to superuser and established three restart-surviving persistence mechanisms
  • Affected scope: PostgreSQL versions 14 through 18; version 14 reaches end-of-life on November 12, 2026

Industry Insight

  • Organizations using CDC pipelines, standby servers, or backup tools with REPLICATION attributes should immediately audit and update PostgreSQL installations, as these roles are routinely granted and often overlooked in privilege reviews
  • Database security architectures should enforce consistent access controls across all code paths, as legacy protocol handlers may escape modern security restrictions designed for different entry points
  • The partial fix gap in pg_createsubscriber highlights the need for comprehensive regression testing of security patches, especially for tools that interact with modified subsystems

TL;DR

  • PostgreSQL修复了CVE-2026-6471漏洞,该漏洞允许具有REPLICATION属性的账户以操作系统用户权限执行任意代码
  • 漏洞存在于自2014年引入逻辑解码功能以来的PostgreSQL版本中,影响版本14-18
  • 修复方案引入了output_plugin_libraries白名单参数,默认仅允许pgoutput和test_decoding插件
  • 漏洞利用需要REPLICATION属性和wal_level=logical配置,攻击者可通过逻辑解码输出插件加载恶意库
  • 受影响用户需更新至指定版本并配置output_plugin_libraries参数,部分第三方插件需额外配置

为什么值得看

该漏洞涉及PostgreSQL核心安全机制的长期缺陷,影响广泛使用的数据库系统,对数据库管理员和运维人员具有重要参考价值。修复方案体现了安全补丁设计的权衡考量,为类似系统的安全加固提供了实践案例。

技术解析

  • 漏洞机制:REPLICATION用户可通过CREATE_REPLICATION_SLOT命令指定任意可加载库作为逻辑解码输出插件,绕过现有的LOAD限制,导致任意代码执行
  • 影响范围:PostgreSQL 14-18版本(18.6、17.11、16.15、15.19、14.24之前),CVSS评分7.2,需要高权限账户
  • 修复方案:新增output_plugin_libraries服务器参数,默认值为'pgoutput, test_decoding',需手动添加其他插件并重新加载配置
  • 利用条件:需要REPLICATION属性和wal_level=logical配置,Windows可通过SMB网络路径加载库,Linux/macOS需启用NFS自动挂载
  • 已知缺陷:pg_createsubscriber命令未检查新参数,导致--dry-run成功但实际转换失败,补丁正在审查中

行业启示

  • 数据库安全修复需平衡向后兼容性,PostgreSQL选择白名单机制而非直接应用现有LOAD限制,避免破坏现有第三方插件部署
  • 长期存在的逻辑解码功能漏洞提醒开发者,核心组件的安全审查应覆盖所有使用路径,包括非预期的权限提升场景
  • 第三方插件生态的安全管理需纳入整体安全策略,建议数据库管理员定期审查output_plugin_libraries配置和REPLICATION权限分配

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

Security 安全 Open Source 开源