Advisory

GHSA-p853-83gj-wjj3

Details, part 2 of 2. The advisory

Details

Impact
A user with backup restore privileges can execute arbitrary shell commands as the NocoBase server OS user. In a typical server or container deployment, this can read application configuration and environment secrets, modify application files or database backups, run network clients from the server, and disrupt service availability.

The required application privilege is high because backup restore is an administrative operation. However, backup-management permission is still an application-level role boundary; it should not imply arbitrary operating-system command execution.

Suggested remediation
Do not execute database tools through shell-interpreted command strings. Use spawn() or execFile() with an argument array for pg_restore, psql, pg_dump, mysql, and related tools. Validate PostgreSQL schema identifiers from backup metadata against PostgreSQL identifier rules or quote them using the database driver's identifier-quoting facilities before using them in SQL.

For this specific path:

  • Pass pg_restore arguments as an array, for example ['-U', username, '-h', host, '-p', String(port), '-n', srcSchema, '-d', database, ...].
  • Reject schema names containing shell metacharacters, quotes, whitespace, comments, or characters outside accepted PostgreSQL identifier syntax unless they are safely handled as identifiers.
  • Replace dynamic SQL string interpolation in #restoreSchema() with identifier-safe quoting (format('%I', ...) in PostgreSQL or equivalent server-side parameters) and string-literal escaping where literals are required.
  • Add regression tests that restore a backup whose metadata schema contains ; touch /tmp/should-not-exist # and assert no marker file is created and the request is rejected.

Sources & licences