AI Security AI安全 2h ago Updated 1h ago 更新于 1小时前 45

12-Year-Old PostgreSQL Vulnerability Enables Database, Server Takeover 12年PostgreSQL漏洞可导致数据库和服务器被接管

PostgreSQL versions 9.4 through 18 contain CVE-2026-6471 (CVSS 7.2), a critical vulnerability allowing remote code execution and privilege escalation via the logical decoding plugin system Attackers with Replication privileges can inject arbitrary filesystem paths into plugin names, bypassing directory restrictions and loading malicious shared libraries through dlopen() Exploitation grants permanent superuser access by directly modifying pg_authid, enabling OS command execution, data exfiltratio PostgreSQL存在严重安全漏洞CVE-2026-6471(代号PostGREShell),影响9.4至18版本,CVSS评分7.2 攻击者仅需低权限的Replication账户即可实现远程代码执行和权限提升 漏洞源于逻辑解码插件加载时缺乏路径验证,允许通过dlopen()加载并执行任意文件 已修复版本:18.6、17.11、16.15、15.19、14.24,建议立即更新并审计Replication账户

65
Hot 热度
60
Quality 质量
65
Impact 影响力

Analysis 深度分析

TL;DR

  • PostgreSQL versions 9.4 through 18 contain CVE-2026-6471 (CVSS 7.2), a critical vulnerability allowing remote code execution and privilege escalation via the logical decoding plugin system
  • Attackers with Replication privileges can inject arbitrary filesystem paths into plugin names, bypassing directory restrictions and loading malicious shared libraries through dlopen()
  • Exploitation grants permanent superuser access by directly modifying pg_authid, enabling OS command execution, data exfiltration, and persistent backdoor deployment
  • The vulnerability stems from missing input validation on double-quoted plugin names in the replication protocol parser, which accepts slashes, backslashes, path traversal sequences, and Windows UNC paths
  • Patches are available in PostgreSQL 18.6, 17.11, 16.15, 15.19, and 14.24

Why It Matters

This vulnerability fundamentally undermines the security boundary between low-privileged database accounts and full system compromise, affecting one of the most widely deployed open-source databases globally. The Replication privilege is routinely granted to backup tools, monitoring systems, and CI/CD pipelines, making the attack surface extremely broad across enterprise infrastructure.

Technical Details

  • Vulnerability Mechanism: The logical replication slot creation process passes the plugin name directly to dlopen() without sanitization, bypassing the admin-controlled directory restriction intended for non-superusers
  • Attack Chain: An attacker with Replication privileges creates a logical replication slot with a crafted plugin path containing path traversal sequences, triggering execution of arbitrary shared libraries as the postgres system user
  • Privilege Escalation: The malicious plugin calls internal PostgreSQL functions to become bootstrap superuser, then directly writes to pg_authid to flip all privilege flags to true for the attacker's session
  • Persistence Mechanisms: The exploit can deploy backdoors by enabling passwordless connections, copying itself to stable filesystem locations, registering for auto-loading on every new backend, and re-applying superuser changes if reverted
  • Affected Scope: All PostgreSQL versions from 9.4 through 18 are vulnerable, with confirmed impact on version 18.2; patches released in versions 14.24, 15.19, 16.15, 17.11, and 18.6

Industry Insight

  • Organizations should immediately audit all PostgreSQL deployments for Replication-privileged accounts and revoke this attribute from any service or user that does not actively require it, as this credential is often granted broadly to backup and monitoring tools
  • The widespread adoption of logical replication as standard production infrastructure means this vulnerability likely exists in thousands of environments, making rapid patching and credential hygiene critical priorities
  • Database security teams should treat Replication privileges with the same severity as superuser access, implementing principle-of-least-privilege policies and monitoring for anomalous logical replication slot creation patterns

TL;DR

  • PostgreSQL存在严重安全漏洞CVE-2026-6471(代号PostGREShell),影响9.4至18版本,CVSS评分7.2
  • 攻击者仅需低权限的Replication账户即可实现远程代码执行和权限提升
  • 漏洞源于逻辑解码插件加载时缺乏路径验证,允许通过dlopen()加载并执行任意文件
  • 已修复版本:18.6、17.11、16.15、15.19、14.24,建议立即更新并审计Replication账户

为什么值得看

PostGREShell漏洞揭示了数据库安全中一个长期被忽视的风险点——Replication权限的滥用可导致完整的系统沦陷。对于依赖PostgreSQL的企业和开发者而言,此漏洞直接影响数据安全架构,需立即采取行动。

技术解析

  • 漏洞机制:PostgreSQL逻辑解码插件名称未经过验证或 sanitization 直接传递给加载器,攻击者可通过双引号内的插件名称传入包含斜杠、反斜杠、点号、../遍历甚至Windows UNC路径的完整文件系统路径,最终传递给dlopen()函数。
  • 权限提升路径:插件在postgres系统用户权限下运行且无沙箱保护,攻击者可调用内部函数成为bootstrap superuser,直接写入pg_authid表将所有权限标志设为true,获得永久超级用户权限。
  • 持久化后门:攻击者可通过插件启用无密码连接、将自身复制到稳定位置并注册到每个新后端,即使权限被撤销也能重新应用。
  • 影响范围:PostgreSQL 9.4至18版本均受影响(已在18.2确认),逻辑复制已成为生产环境标准配置,漏洞路径几乎存在于所有PostgreSQL部署中。

行业启示

  • 权限最小化原则:企业应严格审计Replication账户权限,移除任何不需要Replication属性的账户,避免低权限账户成为攻击入口。
  • 供应链安全关注:此漏洞揭示了开源数据库内部组件(逻辑解码插件机制)的安全隐患,建议建立定期的安全审计和漏洞扫描机制。
  • 应急响应优先级:PostgreSQL作为全球广泛使用的数据库,此漏洞影响范围极广,组织应将更新到修复版本列为最高优先级安全任务。

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

Security 安全 Open Source 开源