Summary
InvoicePlane improperly interpolates the administrator-controlled tax_rate_decimal_places setting into an SQL ALTER TABLE statement. A crafted value may alter the schema-changing query, allowing an authorized administrator or another party able to control the setting to corrupt database structures and disrupt invoice and payment management.
Affected context
The vulnerability occurs in InvoicePlane's settings handling when the tax_rate_decimal_places value is incorporated into an ALTER TABLE statement for the ip_tax_rates table without strict integer validation. Risk depends on whether an attacker can reach the relevant administrative setting or otherwise modify the value before the schema update executes.
Exploit preconditions
- Attack surface: InvoicePlane's administrative settings interface and related configuration-handling logic
- Required access: Ability to control or modify the
tax_rate_decimal_placessetting, typically through an authorized administrative context - Trigger point: Processing the setting in
Settings::index()and constructing theALTER TABLEstatement - Why exploitation is possible: The setting is treated as SQL syntax rather than being constrained to a strictly validated numeric value
Why this happens
The underlying defect is the direct interpolation of a configuration value into a SQL statement that changes database schema. Because the value is not restricted to the intended integer domain before query construction, SQL syntax can be introduced into a data-definition operation. This maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command, commonly called SQL injection.
Potential impact
- Required database columns may be removed or altered
- Invoice, tax, client, or payment data structures could become inconsistent
- The application may become unavailable or fail during normal operations
- Financial records could be corrupted or rendered inaccessible
- Recovery efforts could require database restoration or schema repair
General mitigation guidance
Mitigation generally focuses on separating configuration data from SQL syntax and enforcing a narrow trust boundary for administrative settings.
Common defensive patterns include:
- Validate the setting as a bounded integer before any database operation
- Use typed application interfaces and database mechanisms that do not permit values to become SQL syntax
- Prefer controlled schema migration routines over dynamically assembled DDL
- Apply allowlists and canonicalization to configuration values
- Run the application with database privileges limited to the operations it requires
- Maintain tested backups and recovery procedures for financial data
- Treat administrative inputs as untrusted even when access is restricted
How teams detect issues like this
Organizations can look for this class of issue through:
- Static analysis rules identifying string interpolation or concatenation in SQL and DDL statements
- Code review checks for administrative or configuration values used directly in database commands
- Tests that supply non-numeric, boundary, and unexpected values to settings handlers
- Database and application monitoring for unexpected
ALTER TABLEoperations - Policy enforcement requiring parameterization, strict type validation, and approved migration paths
- Automated security review tools that flag untrusted data reaching SQL execution APIs

