Critical SQL Injection Vulnerability in PostgreSQL: CVE-2020-25695
Summary
ALPINE-CVE-2020-25695: A flaw was found in PostgreSQL versions before 13.1, before 12.5, before 11.10, before 10.15, before 9.6.20 and before 9.5.24. Affects postgresql versions < 11.10-r0. Fixed in 11.10-r0. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
PostgreSQL is a powerful, open-source object-relational database system known for its robustness, extensibility, and standards compliance. It supports a wide range of data types and offers advanced features such as multi-version concurrency control, complex queries, and full-text search. However, a critical vulnerability (CVE-2020-25695) has been identified, affecting various versions of PostgreSQL, which could allow attackers to execute arbitrary SQL functions with superuser privileges if they have permission to create non-temporary objects in a schema.
Vulnerability Detail
CVE-2020-25695 is a significant security flaw found in PostgreSQL versions prior to 13.1, 12.5, 11.10, 10.15, 9.6.20, and 9.5.24. The vulnerability arises from improper permission handling, allowing an attacker with the ability to create non-temporary objects in a schema to execute arbitrary SQL functions as a superuser. This can lead to severe consequences, including unauthorized access to sensitive data, data integrity issues, and potential system downtime. The CVSS score for this vulnerability is 8.8, indicating a high level of risk.
How To Fix
Minimum fixed version
11.10-r0
This is the first release that contains the fix.
sudo apk add --upgrade postgresql
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
If immediate upgrading is not feasible, consider restricting permissions for users who can create non-temporary objects in schemas. This can help mitigate the risk until the package is updated. Additionally, review and monitor database access logs for any suspicious activities.
Conclusion
CVE-2020-25695 represents a serious security risk for PostgreSQL users, allowing unauthorized access to superuser privileges under certain conditions. It is essential to upgrade to the latest patched versions to mitigate this vulnerability and ensure the integrity and confidentiality of your data.
See every vulnerability recorded for postgresql →
FAQ
CVE-2020-25695 is a critical vulnerability in PostgreSQL that allows attackers to execute arbitrary SQL functions as a superuser if they have permission to create non-temporary objects in a schema.
The vulnerability affects PostgreSQL versions before 13.1, 12.5, 11.10, 10.15, 9.6.20, and 9.5.24.
You can use Vulert, a tool that monitors open-source vulnerabilities in your software. By simply uploading your manifest file, you can check for vulnerabilities without needing to access the code.
As a temporary measure, restrict permissions for users who can create non-temporary objects in schemas and monitor database access logs for suspicious activities.
The CVSS score for CVE-2020-25695 is 8.8, indicating a high level of risk associated with this vulnerability.
References
Related vulnerabilities
Recent vulnerabilities recorded for postgresql.