logo
Go to the homepage of the Vrije Universiteit. Go to the homepage of the faculty of sciences.

SQL Virus Using Self-Referential Queries for PostgreSQL


Under PostgreSQL, the currently executing queries can be obtained using the following query:

SELECT current_query FROM pg_stat_activity
Query  1 - Self-referential query for PostgreSQL
However, this feature must be enabled explicitly in the server configuration. There is also a configurable reporting delay, which means that it may return a string containing '<IDLE>' rather than the current query, unless the query executes for a long time.

It also seems that the process that retrieves the queries from the pg_stat_activity is never included in the results, only in other processes' results, which makes it impossible to use it for a virus.

To access the pg_stat_activity table, the user must be an administrator or be retrieving information on a process owned by the same user, which means that any user can obtain its own queries.


Previous SQL Virus Using Self-Referential Queries for Oracle (iSQL*Plus)
Up SQL Virus Using Self-Referential Queries
SQL Virus Using Self-Referential Queries for MySQL Next

Last modified: Thursday, 02 March 2006 21:33, CET
If you spot a mistake, please e-mail the maintainer of this page.
Your browser does not fully support CSS. This may result in visual artifacts.