It was found that PostgreSQL versions before 12.4, before 11.9 and before 10.14 did not properly sanitize the search_path during logical replication. An authenticated attacker could use this flaw in an attack similar to CVE-2018-1058, in order to execute arbitrary SQL command in the context of the user used for replication.
The product uses a fixed or controlled search path to find resources, but one or more locations in that path can be under the control of unintended actors.
Name | Vendor | Start Version | End Version |
---|---|---|---|
Postgresql | Postgresql | 10.0 (including) | 10.14 (excluding) |
Postgresql | Postgresql | 11.0 (including) | 11.9 (excluding) |
Postgresql | Postgresql | 12.0 (including) | 12.4 (excluding) |
Red Hat Enterprise Linux 8 | RedHat | postgresql:10-8020020200825115746.4cda2c84 | * |
Red Hat Enterprise Linux 8 | RedHat | postgresql:12-8030020201207110000.229f0a1c | * |
Red Hat Enterprise Linux 8.0 Update Services for SAP Solutions | RedHat | postgresql:10-8000020201214113918.f8e95b4e | * |
Red Hat Enterprise Linux 8.1 Extended Update Support | RedHat | postgresql:10-8010020201214112129.c27ad7f8 | * |
Red Hat Enterprise Linux 8.2 Extended Update Support | RedHat | postgresql:12-8020020201207110224.4cda2c84 | * |
Red Hat Software Collections for Red Hat Enterprise Linux 7 | RedHat | rh-postgresql10-postgresql-0:10.14-1.el7 | * |
Red Hat Software Collections for Red Hat Enterprise Linux 7 | RedHat | rh-postgresql12-postgresql-0:12.4-1.el7 | * |
Red Hat Software Collections for Red Hat Enterprise Linux 7.6 EUS | RedHat | rh-postgresql10-postgresql-0:10.14-1.el7 | * |
Red Hat Software Collections for Red Hat Enterprise Linux 7.6 EUS | RedHat | rh-postgresql12-postgresql-0:12.4-1.el7 | * |
Red Hat Software Collections for Red Hat Enterprise Linux 7.7 EUS | RedHat | rh-postgresql10-postgresql-0:10.14-1.el7 | * |
Red Hat Software Collections for Red Hat Enterprise Linux 7.7 EUS | RedHat | rh-postgresql12-postgresql-0:12.4-1.el7 | * |
Red Hat Virtualization 4 for Red Hat Enterprise Linux 8 | RedHat | rhvm-appliance-0:4.4-20210310.0.el8ev | * |
Postgresql-10 | Ubuntu | bionic | * |
Postgresql-10 | Ubuntu | upstream | * |
Postgresql-12 | Ubuntu | devel | * |
Postgresql-12 | Ubuntu | focal | * |
Postgresql-12 | Ubuntu | trusty | * |
Postgresql-12 | Ubuntu | upstream | * |
Postgresql-9.1 | Ubuntu | trusty | * |
Postgresql-9.3 | Ubuntu | trusty | * |
Postgresql-9.5 | Ubuntu | upstream | * |
Although this weakness can occur with any type of resource, it is frequently introduced when a product uses a directory search path to find executables or code libraries, but the path contains a directory that can be modified by an attacker, such as “/tmp” or the current working directory. In Windows-based systems, when the LoadLibrary or LoadLibraryEx function is called with a DLL name that does not contain a fully qualified path, the function follows a search order that includes two path elements that might be uncontrolled:
In some cases, the attack can be conducted remotely, such as when SMB or WebDAV network shares are used. One or more locations in that path could include the Windows drive root or its subdirectories. This often exists in Linux-based code assuming the controlled nature of the root directory (/) or its subdirectories (/etc, etc), or a code that recursively accesses the parent directory. In Windows, the drive root and some of its subdirectories have weak permissions by default, which makes them uncontrolled. In some Unix-based systems, a PATH might be created that contains an empty element, e.g. by splicing an empty variable into the PATH. This empty element can be interpreted as equivalent to the current working directory, which might be an untrusted search element. In software package management frameworks (e.g., npm, RubyGems, or PyPi), the framework may identify dependencies on third-party libraries or other packages, then consult a repository that contains the desired package. The framework may search a public repository before a private repository. This could be exploited by attackers by placing a malicious package in the public repository that has the same name as a package from the private repository. The search path might not be directly under control of the developer relying on the framework, but this search order effectively contains an untrusted element.