
Exploit and test stand for CVE-2025-2945
This is my research on CVE-2025-2945. This repo includes a test stand with postgress and vulnerable pgadmin, and exploit.
Usefull links:
In pgAdmin backend, which is written in python, there are two endpoint with lack of proper sanitization. Endpoints are:
/sqleditor/query_tool/download - query_commited parameter/cloud/deploy - high_availability parameterLet's look at the code of sqleditor:
for key, value in data.items():
if key == 'query':
sql = value
if key == 'query_commited':
query_commited = (
eval(value) if isinstance(value, str) else value
)
What we see here, is the value of query_commited been directly passed to eval() function. You can see the docs for eval.
Also see the code of pgacloud:
def _create_google_postgresql_instance(self, args):
credentials = self._get_credentials(self._scopes)
service = discovery.build('sqladmin', 'v1beta4',
credentials=credentials)
high_availability = \
'REGIONAL' if eval(args.high_availability) else 'ZONAL'
Same problem here.
It still requires a valid creds and access to pgadmin to reach this endpoints. But any attacker, able to access it, is also able to pass any value to eval. Which is equal to executing any python oneliner.
Exploitation is pretty straight-forward. See the exploit/src/main.py. Don't forget to update the config in order to get a reverse shell.
To setup stand run this:
cd stand
docker compose up -d
And that's it. pgAdmin is now accessable at http://localhost:8080. Default creds are:
[email protected]
admin
Feel free to edit the .env file and stand/init-db/01-init.sql.
prod by I3r1h0n.