views:

50

answers:

2

If I was to obtain a database (in this case for postgresql) from an untrusted source, is there any risk in activating it and querying it?

+3  A: 

There are plenty of possible attack vectors there, if that's what you're asking. Here are a few that I can think of off the top of my head:

  1. Maybe the link to the database is actually a link to a hacked PDF file that will exploits some vulnerability in your Acrobat plugin (your PDF plugins are patched, right? this is a really popular attack vector lately).

  2. If it's zipped, maybe it's really a zip bomb.

  3. If it's a binary dump, maybe it's trying to exploit some bug in the restore process.

  4. Maybe it contains malicious stored procedures that will drop your databases or scramble your passwords.

  5. Maybe it's just a text dump that has a bunch of drop statements in it.

Practically speaking, It's not exactly low hanging fruit. Postgres is a niche product with a limited audience (developers who like postgres). I find it pretty unlikely that it a database dump would be used to deliver some kind of malware.

Whether it's "safe" depends on what "untrusted" means in this case. If you're really concerned, load it up in a virtual machine with networking turned off to limit the possible damage.

Seth
+1 for good attack vectors.
rfusca
Point 1 is a bit silly (easy to spot, lots of potentially nasty stuff.
HoboBen
Point 1 might sound silly, but it's only easy to spot if you're looking for it! (But yes, if you're accessing it programmatically you probably wouldn't be affected).
Seth
+1  A: 

Seth makes good points, but I think the biggest big, bad, security risk would be an procedures written in the untrusted languages like PL/PythonU. They'll have full access to do anything in the underlying system that the language supports and that the system user running Postgres has access to.

As Seth points out, this is very very unlikely and loading it up in a VM is a good idea.

rfusca