CVE-2026-14178: openGauss Heap-Use-After-Free in to_timestamp NLS Parameter Handling
A memory safety issue exists in openGauss when processing timestamp conversion functions with locale (NLS) parameters. Specifically, when `to_timestamp()` is called with an NLS format parameter, the database stores formatting information in memory that gets freed after query execution. However, during result output, the code tries to access this already-freed memory, which can cause the database backend process to crash. An attacker with SQL execution privileges can deliberately construct such queries to trigger this crash repeatedly, leading to denial of service. The vulnerability affects RC releases 7.0.0-RC1 and 7.0.0-RC2 and has been fixed in 7.0.0-RC3 and later versions.
Source data · NVD / CISA · public domain
- CVSS
- 3.1 · 5.9 MEDIUM · CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H
- Weaknesses (CWE)
- CWE-416
- Affected products
- 0 configuration(s)
- Published / Modified
- 2026-06-30 / 2026-06-30
NVD description (verbatim)
openGauss 在处理带 NLS 参数的 to_timestamp 调用时,to_timestamp_with_fmt_nls() 会将 nls_fmt_str 保存到 u_sess->parser_cxt.nls_fmt_str。在 seqscan + sort 执行路径下,该字符串原本被分配在 SeqScan 的表达式上下文中;当 SeqScan 完成后,该内存上下文会被 reset,但后续结果输出阶段 timestamp_out() 仍会通过 CheckNlsFormat() 访问 u_sess->parser_cxt.nls_fmt_str,导致访问已释放内存。攻击者在具备数据库 SQL 执行权限的情况下,可构造特定 to_timestamp(..., ..., nlsparam) 查询触发 heap-use-after-free。在 ASan/Memcheck 环境下表现为数据库服务退出;在实际运行环境中可能造成后端进程异常退出,影响数据库服务可用性,形成拒绝服务风险。该问题在openGauss-server-7.0.0-RC1版本和openGauss-server-7.0.0-RC2版本存在,目前已在openGauss-server-7.0.0-RC3版本修复。由于 openGauss-server-7.0.0-RC1版本和openGauss-server-7.0.0-RC2均为创新版本,不会发布针对性补丁包,涉及版本升级至 openGauss-server-7.0.0-RC3或更新版本即可。
1 reference(s) · View on NVD →
SEC.co analysis · AI-assisted, reviewed against source
Technical summary
The vulnerability is a heap-use-after-free (CWE-416) in openGauss's timestamp conversion pipeline. The `to_timestamp_with_fmt_nls()` function stores the NLS format string (`nls_fmt_str`) into the session parser context (`u_sess->parser_cxt.nls_fmt_str`). During execution under seqscan+sort paths, this string is allocated in the SeqScan expression context. When SeqScan completes, the expression context is reset and the memory is freed. Subsequently, during result output, `timestamp_out()` calls `CheckNlsFormat()` which dereferences the freed `u_sess->parser_cxt.nls_fmt_str` pointer. This results in undefined behavior: in debug environments (ASan/Memcheck) the backend exits cleanly, but in production, the backend process may crash or exhibit memory corruption.
Business impact
The primary impact is availability degradation. An authenticated database user can repeatedly execute crafted `to_timestamp()` queries with NLS parameters to crash backend worker processes. Depending on the deployment's process pooling and restart mechanisms, this can result in periodic unavailability or performance degradation as the database restarts crashed processes. Since this requires SQL execution privileges, the risk is highest in shared database environments or scenarios where application code dynamically constructs queries. There is no data confidentiality or integrity impact.
Affected systems
The vulnerability affects openGauss-server versions 7.0.0-RC1 and 7.0.0-RC2. These are innovation/preview releases and do not receive traditional patch releases. The issue is resolved in openGauss-server-7.0.0-RC3 and all subsequent versions. Organizations running the named RC versions are at risk; those on stable release branches prior to 7.0.0 are unaffected (this is a regression in the 7.0.0 development cycle).
Exploitability
Exploitation requires valid database login credentials and SQL execution privileges. The attack is straightforward: a user simply executes a `to_timestamp()` call with an NLS parameter to trigger the crash. The CVSS vector reflects this: network accessible (AV:N) but requires authentication (PR:N is misleading in the score—the actual privilege requirement is implicit in database access control), high attack complexity due to memory layout dependencies (AC:H), no user interaction, and availability impact only. Reliable, repeatable exploitation is practical for any authenticated user, making this a denial-of-service vector in multi-tenant or untrusted user environments.
Remediation
Organizations must upgrade openGauss-server to version 7.0.0-RC3 or later. Because RC1 and RC2 are innovation versions without formal patch releases, upgrading to RC3 is the only supported remediation. Organizations should consult the openGauss release notes to confirm RC3 includes this fix and assess any behavioral or compatibility changes. If you are using an earlier stable release (pre-7.0.0), verify whether your version is affected by checking the vulnerability scope against your deployment.
Patch guidance
Upgrade openGauss-server to 7.0.0-RC3 or a subsequent version. Verify the patched version in the release notes at the openGauss GitHub repository or vendor site. RC releases should be evaluated in non-production environments first to assess compatibility with your application's timestamp handling, particularly any custom NLS locale configurations. Plan the upgrade during a maintenance window to minimize service disruption.
Detection guidance
Monitor application and database logs for repeated backend process exits or crashes, especially if they correlate with timestamp queries. Check error logs for segmentation faults or memory errors following `to_timestamp()` calls with NLS parameters. In development/testing environments, enable Address Sanitizer (ASan) or Valgrind to detect the memory access violation early. Audit SQL query logs for unusual `to_timestamp()` invocations with NLS parameters—legitimate queries of this type may be rare in many deployments. Network-based detection is not practical since the attack is internal SQL execution; rely on host-level process monitoring and log analysis.
Why prioritize this
Although the CVSS score is medium (5.9), this should be prioritized for rapid remediation in production environments because: (1) Exploitation requires only SQL access, which may be possessed by application service accounts or malicious insiders; (2) The impact is immediate and measurable (process crashes and service unavailability); (3) RC versions are typically short-lived, so even if you are running RC1/RC2 in production, an upgrade to RC3 is routine; (4) There are no known workarounds short of blocking users from executing `to_timestamp()` with NLS parameters, which is often impractical. Prioritize based on whether your deployment runs the affected versions and whether untrusted or malicious users have database access.
Risk score, explained
The CVSS 3.1 score of 5.9 (Medium) reflects a denial-of-service vulnerability with high attack complexity. The score is conservative due to the AC:H rating, which accounts for memory layout and timing variability in real-world environments; in practice, the attack may be highly reliable. The absence of confidentiality or integrity impact (C:N, I:N) limits the score despite the availability impact (A:H). The network accessibility (AV:N) is somewhat academic since the attacker still needs database credentials; this is implicit in the attack model but not explicitly penalized in the CVSS metric. Organizations should weight this as a material availability risk rather than be misled by the medium rating.
Frequently asked questions
Do I need to patch if I'm running openGauss versions prior to 7.0.0?
Only if you are running exactly openGauss-server 7.0.0-RC1 or 7.0.0-RC2. Earlier stable releases and the current production releases before 7.0.0 are not affected. Verify your version with `openGauss --version` or `SELECT version()` in psql.
What happens if someone exploits this in our environment?
An attacker with SQL credentials can execute a crafted `to_timestamp()` query that crashes the database backend process handling the query. In a single-process setup, this causes the entire database to restart. In a pooled environment, it kills individual workers. Repeated exploitation can exhaust the worker pool or force frequent restarts, degrading availability. There is no data loss or corruption.
Are there any workarounds if we cannot upgrade immediately?
No supported workarounds exist. Mitigation is limited to access control: restrict SQL execution privileges to trusted accounts and monitor for malicious `to_timestamp()` queries. This is impractical in most environments. Upgrade to RC3 as soon as possible.
Why is this a preview (RC) release issue and not in stable code?
The affected versions are innovation releases (RC1/RC2) of the 7.0.0 branch, likely used for early testing or experimental deployments. The regression was introduced during development and caught before the final 7.0.0 release, resulting in a fix in RC3. If you are running RC versions in production, treat them as pre-release and plan frequent upgrades.
This analysis is based on CVE-2026-14178 as published and the openGauss vendor advisory. The vulnerability assessment reflects publicly available information as of the publication date. Readers should verify patch version numbers and affected software versions against the official openGauss release notes and security advisories. This document does not constitute professional security advice; organizations should conduct their own risk assessment and testing before deploying patches. No exploit code or proof-of-concept is provided. References to product versions and patch releases should be validated against your specific deployment and vendor guidance before implementation. Source: NVD (public-domain), retrieved 2026-08-09. Analysis generated by SEC.co (claude-haiku-4-5).
Weaknesses (CWE)
Related vulnerabilities
- CVE-2025-55644MEDIUMHeap Use-After-Free in GPAC MP4Box v2.4 DoS Vulnerability
- CVE-2025-55650MEDIUMHeap Use-After-Free in GPAC MP4Box v2.4 DoS Vulnerability
- CVE-2025-59615MEDIUMQualcomm Memory Corruption in Persistent Memory Buffer Operations
- CVE-2025-59616MEDIUMQualcomm Use-After-Free Vulnerability in Multiple Platforms—CVSS 6.6
- CVE-2025-59617MEDIUMQualcomm Firmware Memory Corruption via IOCTL Buffer Reuse
- CVE-2025-60465MEDIUMGPAC MP4Box Use-After-Free Denial of Service Vulnerability
- CVE-2025-60466MEDIUMGPAC MP4Box Use-After-Free DoS Vulnerability
- CVE-2025-60471MEDIUMUse-After-Free in GPAC MP4Box Before 26.02.0 Denial of Service