Summary
baserCMS before 5.3.0 contains SQL injection weaknesses in database service operations that accept administrator-controlled table names and configuration values. An authenticated administrator, or an attacker who first compromises an administrative workflow, may be able to retrieve database metadata and application data from the PostgreSQL backend.
Affected context
The vulnerability occurs in baserCMS database operations for sequence updates, CSV exports, and table management when user-influenced table names or configuration values are incorporated into SQL statements without adequate parameterization or identifier validation. The risk is greater where authenticated administrators can use backup restoration or schema-loading functionality, because unsafe PHP execution during schema loading may allow database-related values to be planted before the vulnerable operations are triggered.
Exploit preconditions
- Attack surface: Authenticated baserCMS administrative database, export, and backup-management functionality
- Required access: Administrator-level access, or another path that permits modification of schema, backup, or configuration inputs
- Trigger point: Sequence updates, CSV export, or table-management operations that construct SQL using attacker-influenced values
- Why exploitation is possible: Table identifiers and configuration-derived values can reach SQL statements without sufficient parameterization or allowlisting; unsafe schema loading may also execute PHP code outside class definitions
- Backend condition: A PostgreSQL database must be reachable through the affected baserCMS deployment for database disclosure effects
Why this happens
The primary flaw is SQL injection, mapped to CWE-89. The application treats attacker-controlled table names or configuration values as trusted SQL components rather than separating data from executable query structure and validating identifiers against an allowed set.
A related weakness maps to CWE-94: Improper Control of Generation of Code, because PHP code placed outside class definitions in restored schema files may execute when those files are loaded. Chaining these behaviors can let an attacker influence values later consumed by unsafe SQL construction.
Potential impact
- An attacker may retrieve database version information and schema details.
- Sensitive application or business data could be disclosed from PostgreSQL.
- Database records or structures could be modified or disrupted.
- Administrative workflows may be abused to establish persistence or affect application integrity.
- The code-execution chain could compromise the application process, depending on deployment privileges and execution context.
General mitigation guidance
Mitigation generally focuses on separating SQL structure from data, reducing trust in administrative inputs, and removing executable behavior from restored configuration artifacts.
Common defensive patterns include:
- Use parameterized queries for values and strict allowlists for dynamic identifiers such as table names.
- Map approved logical names to fixed database identifiers instead of accepting raw names from requests or configuration.
- Validate and normalize backup, schema, and export inputs before they are loaded or used in database operations.
- Use a data-only schema format or restricted parser that cannot execute PHP or instantiate executable behavior.
- Restrict backup restoration and table-management capabilities to narrowly scoped administrative roles.
- Run the application database account with only the privileges required for normal operations.
- Apply database network, filesystem, and secret-access controls to limit consequences of application compromise.
How teams detect issues like this
Organizations commonly look for this class of issue through:
- Static analysis rules identifying string concatenation or interpolation of request, configuration, or schema values into SQL statements.
- Code review checks for dynamic table or column identifiers that lack allowlists or controlled mappings.
- Review of backup and schema loaders for executable statements outside intended declarations.
- Database monitoring for unusual metadata queries, schema enumeration, unexpected exports, or access to unrelated tables.
- Administrative audit logging for backup restoration, table management, sequence updates, and CSV export activity.
- Policy enforcement requiring parameterized database APIs and restricted parsers for configuration and backup formats.
Automated code-scanning and security review tools can help identify unsafe query construction and executable configuration handling.

