Cybersecurity researchers have discovered a serious security flaw in the open-source PostgreSQL database system that could allow unprivileged users to modify environment variables and potentially lead to code execution or information disclosure.
Vulnerability, tracked as CVE-2024-10979has a CVSS score of 8.8.
Environment variables are user-defined values that can allow a program to dynamically retrieve various kinds of information, such as access keys and software installation paths, at runtime without having to hardcode them. In some operating systems, they are initialized at startup.
“Improper handling of environment variables in PostgreSQL PL/Perl allows an unprivileged database user to modify sensitive process environment variables (e.g. THE WAY),” PostgreSQL said in an advisory issued Thursday.
“This is often enough to allow the execution of arbitrary code even if the attacker does not have a user on the database server’s operating system.”
The flaw was fixed in PostgreSQL versions 17.1, 16.5, 15.9, 14.14, 13.17, and 12.21. Varonis researchers Tal Peleg and Coby Abrams, who discovered the problem, said this could lead to “serious security issues” depending on the attack scenario.
This includes, but is not limited to, executing arbitrary code by changing environment variables such as PATH, or extracting valuable information on a machine by executing malicious requests.
Additional information about the vulnerability is not being disclosed at this time to allow users enough time to apply patches. Users are also advised to limit the allowed extensions.
“For example, restricting the CREATE EXTENSIONS permission to certain extensions and optionally setting the shared_preload_libraries configuration parameter to load only required extensions, restricting roles from creating least-privilege functions by restricting the CREATE FUNCTION permission,” Varonis said.