Skip to content

[MEDIUM] M6: SQL table name constructed from unvalidated IAppConfig values — injection defense-in-depth gap #346

Description

@rubenvdlinde

Severity: MEDIUM

Location: lib/Service/OrganizationSyncService.php lines 375, 490

Description:
The database table name is constructed by interpolating IAppConfig values directly into a QueryBuilder::from() call:

$contactTableName = 'openregister_table_' . $register . '_' . $contactSchema;
$qb->from($contactTableName);

$register and $contactSchema are read from admin-configurable IAppConfig keys with no type or format validation. Although only administrators can set these values, a compromised admin account or a misconfiguration could inject arbitrary SQL fragments into the table name. This is a defense-in-depth gap.

Suggested fix:
Cast $register and $contactSchema to integer with (int), assert each is > 0, and reject/log if not. Table names should only ever be constructed from validated integer IDs.


Source: deep team-reviewer pass 2026-05-27

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions