PostgreSQL วิเคราะห์ช่องโหว่ท
The PL/Perl extension in PostgreSQL allowed a database user without special privileges to modify environment variables such as PATH. An attacker could then cause the server to run a malicious executable named psql, leading to code execution with the database server's privileges.
Published on chanwit.medium.com
CVE-2024–10979 เป็นช่องโหว่ความรุนแรงสูง (คะแนน CVSS = 8.8) ใน PostgreSQL PL/Perl extension ที่อนุญาตให้ผู้ใช้ฐานข้อมูลที่ไม่มีสิทธิ์พิเศษสามารถแก้ไข environment variables ที่สำคัญได้ และสามารถนำไปสู่การรันโค้ดที่อันตราย (malicious code) ในระดับสิทธิ์ของ database server
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the PL/Perl extension did not restrict changes to environment variables, so a low-privileged database user could alter PATH and influence which executable the server runs.
Impact
An attacker could run arbitrary code with the privileges of the database server, though the text notes this is only one example and more complex variants may exist.
What the attacker needed
PL/Perl extension enabled; a database user account; ability to write a file to a server-accessible directory
How it was found
- Create an executable file containing malicious code and name it psql.
- Upload the fake psql file to a directory the PostgreSQL server can access, for example /opt/malicious.
- Create a PL/Perl function.
- Call the function to modify PATH.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
PostgreSQL is a database server. Its PL/Perl extension lets you write small programs in the Perl language inside the database. The flaw let an ordinary database user change a setting called PATH, which tells the computer where to look for programs. By putting a fake program in a folder the server trusts, the attacker could make the server run their code.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.