In reading the answer to question I came across a paragraph that indicated that some PostgreSQL PL languages and/or contrib modules can be used to compromise the security of the system.

  1. Is this only an issue if they get postgres db user or superuser access?
  2. Is this because they could in essence create any PL/Python (or other PL/*) function script to run against the system? Example?
  3. Is there any way to mitigate this, other than not installing PL/*?
  4. The paragraph mentions other contrib modules. What other contrib modules could be a postgres/system security risk?

Note that if PL/Python, PL/Perl, etc are installed, or some contrib modules are present, then it might be fairly easy to escalate access from the postgres database user (or other superuser) to the postgres shell user. From there you can reconfigure the database to enable logging, install extensions, inject C code, etc. There is no guarantee you would detect such an exploit, so they might be logging activity for some time.

  • Of course it's a threat. You're installing executable code on your server from another party. If you don't trust the source, pay a security expert to evaluate the code and then compile it yourself. – Neil McGuigan Apr 22 '15 at 5:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.