Summary
Windmill CE and EE between versions 1.276.0 and 1.603.2 contain an SQL injection vulnerability in the folder ownership management feature, where the owner parameter is unsafely incorporated into database queries.
Authenticated attackers can inject SQL to read sensitive data such as the JWT signing secret and admin identifiers, then forge administrative tokens to ultimately execute arbitrary code via workflow execution endpoints.
Affected context
This vulnerability appears in Windmill's folder ownership management functionality, specifically where changes to folder owners are processed on the server side.
It manifests when:
- User-controlled
ownervalues are accepted from authenticated sessions, - These values are used directly in SQL statements without strict parameterization or safe query construction,
- The database contains security-sensitive configuration and identity data (e.g., JWT signing secrets, administrative user records),
- Workflow execution endpoints can trigger arbitrary code or system actions when invoked with valid administrative authorization.
Exploit preconditions
- Attack surface: HTTP endpoints that handle folder ownership changes (e.g., APIs or UI-backed routes).
- Required access: Valid authenticated Windmill account; no administrative role is strictly required if the vulnerable endpoint is accessible to lower-privileged users.
- User-controlled parameter: The
ownerfield used in folder ownership management requests. - Trigger point: Server-side logic that builds and executes SQL queries incorporating the
ownerparameter. - Why exploitation is possible: Input from the
ownerparameter is concatenated or interpolated into SQL queries without adequate parameter binding, escaping, or query abstraction, allowing crafted input to alter the intended SQL structure and access arbitrary data.
Why this happens
The underlying issue is an SQL injection flaw, aligning with CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
Instead of using parameterized queries or a query builder that separates code from data, the folder ownership logic appears to:
- Treat the
ownerparameter as trusted, - Interpolate it directly into SQL or rely on inadequate sanitization,
- Execute the resulting query with database privileges sufficient to read sensitive system tables or configuration data.
This pattern allows attacker-controlled input to modify WHERE clauses, union in additional queries, or otherwise bypass access controls at the database layer, leading to exposure of secrets (like JWT signing keys) and administrative identifiers that can be abused for privilege escalation.
Potential impact
- Exposure of JWT signing secrets, enabling attackers to forge valid application tokens.
- Enumeration and theft of administrative user identifiers and other sensitive account data.
- Creation of forged administrative JWTs, effectively bypassing role-based access controls.
- Remote execution of arbitrary code or workflows via privileged workflow execution endpoints.
- Unauthorized access to additional sensitive database tables, including configuration, logs, or user data.
- Lateral movement within the application environment by abusing high-privilege workflows.
General mitigation guidance
Effective mitigation focuses on eliminating direct SQL injection vectors and reducing the blast radius of any single query:
- Prefer parameterized queries / prepared statements or ORM-based query builders for all interactions involving user-controlled fields such as
owner. - Treat all request parameters, even from authenticated users, as untrusted, and avoid string concatenation or templated SQL query construction.
- Enforce strict input validation and normalization on identifiers like
owner(e.g., enforce UUID, numeric ID, or validated username formats instead of arbitrary strings). - Restrict database accounts used by the application to least-privilege, limiting access to only the tables and operations required for folder ownership management.
- Consider segregating secrets and critical configuration (like JWT signing keys) in dedicated secret stores or isolated tables/services not directly accessible from routine application queries.
- Implement robust authorization checks at the application layer to ensure that only appropriately privileged users can change folder ownership, independent of database-level filtering.
How teams detect issues like this
Detection approaches can combine code-centric and runtime techniques:
- Static analysis: Use rules that flag dynamic SQL built from request parameters (e.g., concatenation or f-strings with
owneror similar fields). Look for raw SQL execution APIs without bound parameters. - Code review: During manual reviews, treat any occurrence of string-based query construction, especially around access control or ownership changes, as a high-risk hotspot that requires parameterization and validation.
- Security testing: Apply focused SQL injection tests against folder-related endpoints in QA and staging, using automated DAST tools or targeted manual tests to identify injectable parameters.
- Logging and monitoring: Monitor for abnormal SQL patterns (e.g., unexpected
UNION,OR 1=1, or wide table scans) and unusual access to configuration or secret-related tables originating from ownership-related requests. - Policy enforcement: Integrate linting or CI checks that prohibit unparameterized SQL execution patterns in application code and enforce ORM or query-builder usage where possible.

