PostgreSQL fixes serious security flaw that existed since 2014

Published Reading time: 4 minutes Vulnerabilities & Security Updates

PostgreSQL fixed a serious security issue that had existed since 2014. Under certain conditions, an account with the REPLICATION attribute could execute its own code on the computer where the database runs, with the privileges of the system user running it.

PostgreSQL fixes a serious security flaw that existed since 2014 - Image 1

The issue affects versions prior to PostgreSQL 18.6, 17.11, 16.15, 15.19, and 14.24. To perform the attack, an account with the REPLICATION and a setting that allows the database to record and transfer its changes. Such accounts are often used by backup tools, backup systems, services that transfer changes to other databases, and monitoring systems.

PostgreSQL fixes a serious security flaw that existed since 2014 - Image 2

How could the attack have happened?

PostgreSQL allows some tools to read changes from one database and send them elsewhere. Until now, an account REPLICATION he could choose the add-on he would use, without the same restrictions that applied in other cases.

According to Cyera Research, an attacker could then force the database to load a file from a location of their choosing. On Windows computers, this could be done via a network location controlled by the attacker. On Linux and macOS, this required that automatic connection to remote storage be enabled. In other cases, the attacker would have to already have some way of writing a file to the database computer.

In a test, Cyera reported that the uploaded code could change PostgreSQL account credentials and turn the account into a database administrator. The same test also created three ways to persist access across reboots. These are findings by the research team and not a confirmed attack.

Cyera described the property REPLICATION as a privilege that a backup account with limited access might have. However, PostgreSQL assessed the case differently and believes that elevated privileges are already required to perform this action.

PostgreSQL fixes a serious security flaw that existed since 2014 - Image 3

What changed in the new versions?

The fix was released on August 13. It adds the setting output_plugin_libraries, which acts as a list of plugins that the database is allowed to use. By default, only the plugins are listed. pgoutput and test_decoding.

This means that installations that use another additive, such as wal2json and decoderbufs, may stop reading changes after the update. The administrator must add the specific plugins to the new list and reload the configuration. No database restart is required.

Before updating, administrators should check which add-ons are in use and install versions 18.6, 17.11, 16.15, 15.19, or 14.24, or the corresponding packages for their distribution. Fixed packages are also available on Amazon RDS, Debian, SUSE, and Ubuntu.

Debian warned that the fix requires additional configuration changes when using certain extensions. Ubuntu, on the other hand, in its instructions for 22.04, 24.04, and 26.04 LTS only mentions restarting PostgreSQL and makes no reference to the new configuration. As of September 4, its documentation wal2json had been informed of the relevant directive.

What remains open?

There is a known gap in the correction. The tool pg_createsubscriber, used to convert a base, may successfully complete a test check, but the actual conversion may fail if the pgoutput is not allowed in the new regulation. On September 4th there was a correction proposal, but it has not yet been incorporated.

Cyera has dubbed the problem “PostGREShell,” and researchers Vladimir Tokarev and Yu Kunpeng are credited with reporting it. As of September 4, the problem had not appeared on CISA’s list of problems that have been used in real attacks. Nor had any public code been found showing how it could be exploited.

Until the update is installed, Cyera suggests removing the property REPLICATION from accounts that do not need it, restrict replication access to known addresses, and block relevant network connections from computers hosting PostgreSQL databases.

Hacks.gr on Google Set it as a preferred source for cybersecurity updates.
Preferred source

READ ALSO

Recommended readings from Hacks.gr to continue.

Participate in the discussion

Comments should remain on topic. Your email address will not be published.

0 / 2000

0 / 50

Your comments will not be published if:

  • 1. They cause "DoS" to the community with irrelevant or repetitive comments.
  • 2. They try to "phish" other users' information.
  • 3. They contain "zero-day" insults and slurs.
  • 4. Contain "malware" advertisements for products or services.
  • 5. Your comments should be sweet and friendly, not like malicious cookies trying to mislead us!