Background
psqlODBC is the PostgreSQL ODBC driver used by applications on Windows and Unix-like systems to connect to PostgreSQL databases. The driver supports two diagnostic logging features, Debug and CommLog, which record SQL statements, returned data and connection parameters. Both flags are off by default and are normally switched on only by administrators for troubleshooting.
Two coordinated CVE records describe weaknesses in the way the driver creates and opens those diagnostic log files:
- CVE-2026-138404 — issues with log file creation and re-use on Unix-like and Windows hosts, addressed in a partial earlier fix shipped in 18.00.0006 for CVE-2026-120066, but with remaining cases.
- CVE-2026-136513 — a related fallback-path issue that lands when the configured log directory cannot be used.
The Microsoft advisory for CVE-2026-138404 was published 2026-12-02, with the NVD record available at https://nvd.nist.gov/vuln/detail/CVE-2026-138404. The NVD record for CVE-2026-136513 is at https://nvd.nist.gov/vuln/detail/CVE-2026-136513.
CVE-2026-138404: incomplete protection of diagnostic log files
Description
When Debug or CommLog is enabled, psqlODBC writes its log files to a shared directory under a predictable name that incorporates the process identifier. The default locations are /tmp on Unix-like systems and C:\ on Windows. The files can contain SQL text, returned data and database connection details.
Behaviour on Unix-like systems
The 18.00.0006 release introduced checks for the case previously tracked as CVE-2026-120066. The driver refuses a symbolic link at the log path and accepts an existing file only when it is a regular file owned by the user running the application. The advisory states that the hard-link count is not inspected: another local user can create a hard link at the predictable log path that points to a file the victim owns. The driver accepts the link and appends log content to that arbitrary file. The driver does not have separate handling for a FIFO at the same path; opening it blocks the application until another process reads from it.
Behaviour on Windows
The protections introduced for CVE-2026-120066 are described as not applying on Windows. The driver opens the log file without the equivalent checks. If a service or an elevated process creates a log under C:\, the file inherits that directory's permissions, allowing other local users to read it. A log directory created under C:\ with default permissions can also be modified by other users, and any pre-existing file at the log path is used as is. The same handling applies to the MSDTC log under C:\ or C:\pgdtclog.
Affected systems
- psqlODBC versions up to and including 18.00.0007.
- Hosts where Debug or CommLog has been enabled by an administrator or a deployment script.
- Multi-user or shared-host environments where untrusted local users share the same machine.
- Windows deployments that create the log under
C:\orC:\pgdtclog.
CVE-2026-136513: unexpanded home-directory fallback path
When the configured log directory is unavailable, psqlODBC falls back to a path written with an unexpanded ~. The resulting string is resolved relative to the process's current working directory rather than to the user's true home directory. The NVD record states that a local user who controls a directory component of that path can redirect creation of the victim's mylog_.log and psqlodbc_.log files into any directory writable by the victim, or leave the victim blocking inside open(). The advisory describes this as a completion of the earlier fix. Affected versions are listed as up to and including psqlODBC 18.00.0006.
Root cause
The two issues are variations on the same underlying fault: the driver opens and creates security-relevant files at predictable paths without performing the full set of checks needed for a hostile local environment. On Unix-like systems, the existing checks omit hard-link inspection and FIFO handling. On Windows, the equivalent checks are absent in the relevant code paths. The fallback path correction completes a previous fix that did not address all reload scenarios.
Threat model
Both vulnerabilities require:
- A local account on the same host as the target process.
- The ability to place an object at the predictable log path, or to influence a directory along the relative fallback path.
- Debug or CommLog to be enabled on the target.
The relevant attack primitives are creating a hard link to a file owned by the target user, creating a FIFO at the predictable log path, pre-creating a file at the expected path on Windows, influencing the process's current working-directory path, or relying on weak directory permissions on shared Windows hosts. The supplied sources do not assert any active exploitation in the wild and do not name a specific threat actor or malware sample using these primitives.
Mitigation
The vendor fix path is the primary mitigation. The supplied context identifies 18.00.0007 as the upper bound for CVE-2026-138404 and does not name a release that resolves it, so administrators should consult the Microsoft advisory at https://msrc.microsoft.com/update-guide/vulnerability/CVE-2026-138404 and the NVD records to identify the fixed version before upgrading. CVE-2026-136513 should be addressed by an upgrade that supersedes 18.00.0006.
Operational hardening in parallel with an upgrade includes:
- Leaving Debug and CommLog disabled in production unless a specific troubleshooting need is documented.
- Pointing psqlODBC at a dedicated log directory rather than
/tmp,C:\, orC:\pgdtclog. On Unix-like systems, restrict this directory to the service account (for example permissions0700). On Windows, apply an ACL that excludes unprivileged local users.
- Running services from a working directory that other local users cannot modify, so the unexpanded-tilde fallback cannot be steered.
- Auditing existing log files under
C:\,C:\pgdtclog, and any configured psqlODBC log location on Windows; correcting file ACLs; and reviewing content for SQL text, returned data or connection details that may now be accessible to other local users.
- Watching service logs for psqlODBC processes blocked inside
open(), unusual FIFO objects at predictable log paths, and unexpected hard-link counts on log-sized files.
- Treating any connection parameters that could have been read from a shared log as potentially exposed; rotating credentials and reviewing database audit logs where appropriate.
Severity perspective
The NVD entries carry CVSS base scores of 6.3 (CVE-2026-138404) and 3.6 (CVE-2026-136513). From a practical perspective, the worst-case impact — disclosure of SQL text and connection parameters to other local users, integrity effects on files the victim owns, and a local denial-of-service through a blocked open() — is meaningful but constrained by the requirement that logging be active, that the attacker have local access, and that no evidence of active exploitation is included in the supplied material. The vendor-and-context framing classifies this as informational for the publication scope, although the underlying record for CVE-2026-138404 is rated medium and CVE-2026-136513 low.
Affected systems
- psqlODBC versions up to and including 18.00.0007 for CVE-2026-138404.
- psqlODBC versions up to and including 18.00.0006 for CVE-2026-136513.
- Hosts where Debug or CommLog is enabled and the default
/tmp,C:\, orC:\pgdtcloglocations are in use.
- Multi-user Unix-like hosts that can place hard links or FIFOs at predictable paths inside
/tmp.
- Windows hosts running psqlODBC under a service or elevated process that creates logs in
C:\orC:\pgdtclog.
Mitigation
- Upgrade psqlODBC to a release that addresses CVE-2026-138404 and CVE-2026-136513, after verifying the fixed version against the official advisories.
- Leave Debug and CommLog disabled by default and restrict their use to short, documented troubleshooting windows.
- Configure psqlODBC to a dedicated, access-controlled log directory rather than the platform default.
- Restrict the service's working directory so relative path resolution cannot be steered by an unrelated local user.
- Audit existing log files and directory ACLs, and rotate any credentials that could have been read from a shared log.