-
-
Notifications
You must be signed in to change notification settings - Fork 73
Description
The function PGStore.prototype.quotedTable is vulnerable to SQL-injection, if the input has double quotes. If schemaName is set to 'web".session WHERE $1=$1;--' it will wipe the web.session table every time the prune process runs.
/**
* Get the quoted table.
*
* @return {String} the quoted schema + table for use in queries
* @access private
*/
PGStore.prototype.quotedTable = function () {
let result = '"' + this.tableName + '"';
if (this.schemaName) {
result = '"' + this.schemaName + '".' + result;
}
return result;
};
There is a function quote_ident that could be used:
Return the given string suitably quoted to be used as an identifier in an SQL statement string. Quotes are added only if necessary (i.e., if the string contains non-identifier characters or would be case-folded). Embedded quotes are properly doubled.
Calling this function will require a call to the server and requires that the server is available before the table name can be resolved. This call could also get the version of the server, and warn the user if the server version is too old.