/

CVE-2026-33643

Severity:

HIGH RISK

(7.4)

SQL Injection in SchemaHero MySQL Column Handling

CVE-2026-33643

Analyzed

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Arbitrary SQL Execution in Database

Severity:

HIGH RISK

(7.4)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A SQL injection vulnerability in SchemaHero 0.23.0 affects the mysqlColumnAsInsert function, where the column parameter is incorporated into SQL statements without sufficient sanitization.

If an attacker can influence the column definition data processed by this function, they may be able to inject arbitrary SQL into MySQL operations performed by SchemaHero, potentially leading to data exposure, modification, or disruption of database operations.

Affected context

This vulnerability arises in environments where SchemaHero 0.23.0 is used to manage MySQL schemas and migrations.

The issue is localized to the MySQL plugin (plugins/mysql/lib/column.go), specifically when mysqlColumnAsInsert is invoked to generate SQL for column-related operations.

The risk manifests when untrusted or loosely validated input can shape the column parameter (for example, through configuration, manifests, or higher-level automation that accepts external data) and is then translated directly into SQL statements executed against the MySQL database.

Exploit preconditions

  • Attack surface: Schema/migration operations targeting MySQL via SchemaHero.
  • Required access: Ability to supply or modify data that becomes the column parameter for mysqlColumnAsInsert (e.g., manipulating schema definitions, manifests, or configuration feeding into SchemaHero).
  • Trigger point: Execution of SchemaHero workflows that call mysqlColumnAsInsert to construct and run MySQL queries.
  • Why exploitation is possible: The column parameter is incorporated into SQL without robust parameterization or strict validation, allowing crafted values to break out of expected syntax and inject arbitrary SQL.

Why this happens

The core problem is that user-controllable or externally sourced column metadata is treated as trusted and embedded directly into SQL text.

Instead of using parameterized queries or a constrained, encoded representation of identifiers and expressions, the implementation in mysqlColumnAsInsert assembles SQL strings from the column parameter.

This pattern maps to CWE-89: SQL Injection, where untrusted input is concatenated into SQL commands, enabling attackers to modify the structure or intent of database queries.

Potential impact

  • Execution of attacker-controlled SQL statements within the MySQL database context
  • Unauthorized reading of sensitive tables, including configuration or application data
  • Unauthorized modification or deletion of schema objects or data rows
  • Disruption of migration processes, leading to failed deployments or corrupted schemas
  • Potential pivoting through database-level privileges to impact other applications sharing the same database

General mitigation guidance

Effective mitigation centers on treating all schema and column metadata as untrusted unless explicitly constrained:

  • Prefer parameterized query construction for any dynamic values that can be represented as parameters.
  • Where parameters are not possible (e.g., identifiers), enforce strict allowlists and canonical validation of column names and types, rejecting unexpected characters or patterns.
  • Use dedicated escaping/quoting routines for SQL identifiers and literals provided by the database driver or a trusted library, instead of manual string concatenation.
  • Introduce a clear separation between internal code-driven schema definitions and any definitions that may come from users or external sources; keep untrusted input out of low-level SQL construction layers.
  • Apply least privilege to the MySQL account used by SchemaHero so that, even if injection occurs, the range of destructive operations is reduced.

How teams detect issues like this

Detection efforts can combine code-level and behavior-level approaches:

  • Static analysis: Search for string concatenation or fmt.Sprintf patterns that build SQL fragments using column-related fields, especially in plugins/mysql/lib/column.go and similar modules.
  • Code review: Flag any call paths where external configuration, manifests, or user-defined schema elements flow into SQL-building functions without validation or escaping.
  • Policy enforcement: Adopt coding standards that require parameterized queries or vetted identifier-escaping functions, and enforce them via pre-commit hooks or CI checks.
  • Runtime monitoring: Enable database logging for schema changes and unusual SQL structures, and analyze for anomalous or overly complex statements that might indicate injection attempts.
  • Automated security scanners or SAST tools can be configured with rules targeting CWE-89 patterns, focusing on dynamic SQL assembly in database integration layers.

Sources

SourceLink
gist.github.comgist.github.com/b0b0haha/fb59199fb1fdf9414e76442e0599bfed
github.comgithub.com/b0b0haha/SchemaHero--Sqlinjection/blob/main/README.md

Frequently asked

questions

It can be, depending on how SchemaHero is integrated. If remote users or external systems can influence schema or column definitions that flow into SchemaHero without strong validation, then the vulnerability may be exploitable remotely through those inputs.

An attacker needs the ability to shape or control data that becomes the column parameter for the mysqlColumnAsInsert function. This often means access to configuration, manifests, or higher-level APIs that define or modify database schemas via SchemaHero.

Refactor the SQL construction logic to eliminate raw string concatenation with untrusted values. Use parameterized operations where possible, and for identifiers, enforce strict validation and canonical escaping routines before incorporating them into SQL statements.

Adopt a standard pattern where all SQL is generated through safe abstractions: parameterized queries, vetted query builders, strict validation on schema metadata, and code review policies that prohibit ad hoc SQL string concatenation with external input. Integrating static analysis checks for CWE-89 and enforcing secure database interaction guidelines in development workflows further reduces the risk of recurrence.

Find out what's already
exploitable in your codebase.