Creating a C language function is not allowed to regular users by default because "language C" is an untrusted language only superusers can create functions using that. Additionally, regular users don't have the privileges to insert into pg_proc. So unless the attacked application uses a superuser for database access (which is a big security hole to begin with) or uses a superuser account with a weak password and all…
A picture got my PostgreSQL database to start mining Monero
51–60 of 99 posts
Re: A picture got my PostgreSQL database to start mining Monero
#52The short story of this is: - Gain access to the database itself - And the Postgres database should be vulnerable to various remote code execution - Once they're able to execute code remotely, they then download an image which has binary data tacked onto it - They then parse out the executable part of the image using dd - Then they're able to execute and mine away While an interesting read the shortest takeaway is: 1…
Actually, the takeaway is not about updates. Because the problem is actual intended functionality, that is "misused" for other purposes: indirect function calls. So, the takeaway would be to control, which functionality is needed and which not, then to take action accordingly.
Re: A picture got my PostgreSQL database to start mining Monero
#53Re: A picture got my PostgreSQL database to start mining Monero
#54The short story of this is: - Gain access to the database itself - And the Postgres database should be vulnerable to various remote code execution - Once they're able to execute code remotely, they then download an image which has binary data tacked onto it - They then parse out the executable part of the image using dd - Then they're able to execute and mine away While an interesting read the shortest takeaway is: 1…
Actually, the takeaway is not about updates. Because the problem is actual intended functionality, that is "misused" for other purposes: indirect function calls. So, the takeaway would be to control, which functionality is needed and which not, then to take action accordingly.
Secondly, things like lo_export() should be disabled by default.
Re: A picture got my PostgreSQL database to start mining Monero
#55The short story of this is: - Gain access to the database itself - And the Postgres database should be vulnerable to various remote code execution - Once they're able to execute code remotely, they then download an image which has binary data tacked onto it - They then parse out the executable part of the image using dd - Then they're able to execute and mine away While an interesting read the shortest takeaway is: 1…
Re: A picture got my PostgreSQL database to start mining Monero
#56The short story of this is: - Gain access to the database itself - And the Postgres database should be vulnerable to various remote code execution - Once they're able to execute code remotely, they then download an image which has binary data tacked onto it - They then parse out the executable part of the image using dd - Then they're able to execute and mine away While an interesting read the shortest takeaway is: 1…
Your databases should have multiple users configured with limited roles. Nothing web-facing should have a user with the ability to create a function. A SELECT-only user is a good start.
Re: A picture got my PostgreSQL database to start mining Monero
#57The short story of this is: - Gain access to the database itself - And the Postgres database should be vulnerable to various remote code execution - Once they're able to execute code remotely, they then download an image which has binary data tacked onto it - They then parse out the executable part of the image using dd - Then they're able to execute and mine away While an interesting read the shortest takeaway is: 1…
RDS supports some random PL stuff, specifically PL/Perl and PL/v8 it seems.
Re: A picture got my PostgreSQL database to start mining Monero
#58Re: A picture got my PostgreSQL database to start mining Monero
#59So how can one protect against an image with a payload? Would the payload still be there if the image was rebuilt with Imagemagick?
Don't access your database with a superuser account from your application. Don't allow superuser connections from outside of your network.
Run Postgres in a limited user. Something that can't access any file or execute any command (like wget) it doesn't need, can't do chmod +x. Can't run a shell. Don't know if postgres needs that.
Re: A picture got my PostgreSQL database to start mining Monero
#60I'm going to train a model to detect pictures of Scarlett Johansson to prevent this type of attack in the future.