Summary
A SQL injection vulnerability in the alldayoffs feature of Jorani up to version 1.0.4 allows an authenticated attacker to inject arbitrary SQL through the entity parameter.
When user-controlled input is concatenated directly into database queries without proper sanitization or parameterization, an attacker may execute crafted SQL commands against the underlying database.
Affected context
The vulnerability occurs in Jorani's alldayoffs feature where the entity parameter is incorporated into SQL queries.
It is relevant in deployments where:
- The alldayoffs functionality is exposed to authenticated users
- Server-side code builds SQL queries using entity without strict validation or binding
- The application connects to a relational database with privileges to read and modify business data
Exploit preconditions
- Attack surface: HTTP endpoints associated with the alldayoffs feature that accept the entity parameter.
- Required access: Authenticated access to Jorani with permission to invoke alldayoffs-related requests.
- Trigger point: Submission of a specially crafted entity value that is processed into a SQL statement.
- Why exploitation is possible: The server constructs SQL queries by directly embedding the entity parameter, allowing attacker-controlled content to alter the intended query structure instead of being treated purely as data.
Why this happens
This issue stems from dynamic SQL construction where user-supplied data is concatenated into query strings without parameterized queries or consistent input validation.
Under CWE-89 (Improper Neutralization of Special Elements used in an SQL Command), the application fails to neutralize characters like quotes, delimiters, and operators in the entity parameter, enabling an attacker to break out of the intended query context and inject new clauses or statements.
Conceptually, the bug class is: "trusting user input as part of the SQL syntax," rather than strictly handling it as bound data.
Potential impact
- Retrieval of sensitive data the application's database account can read (e.g., user details, leave records, HR data).
- Unauthorized modification of data, such as altering or deleting leave requests and related records.
- Creation or escalation of user accounts or roles if the database schema and privileges allow it.
- Destruction or corruption of application tables, potentially impacting availability.
- In some database configurations, execution of database-level procedures that may extend impact beyond the application.
General mitigation guidance
Effective mitigation focuses on preventing user input from ever influencing SQL structure:
- Prefer parameterized queries / prepared statements for all database interactions, binding entity as a value rather than string-concatenating it.
- Apply strict whitelisting for fields like entity where only a small set of known-safe values is expected (e.g., enumerations mapped server-side).
- Centralize data access through a well-reviewed data access layer or ORM that defaults to safe parameterization patterns.
- Enforce input validation and normalization before using external data in queries, rejecting unexpected formats early.
- Run the database with least-privilege accounts so that, even if a query is abused, the accessible operations and tables are limited.
How teams detect issues like this
Detection typically combines code-level and behavioral approaches:
- Static analysis rules that flag string concatenation or interpolation used in SQL query construction, especially involving request parameters like entity.
- Targeted code review of database access routines in the alldayoffs feature, checking for prepared statements and proper binding.
- Application security tests (SAST/DAST) that probe parameters for SQL injection patterns and verify whether responses or errors indicate query manipulation.
- Logging and monitoring of database queries for anomalous patterns (e.g., unexpected UNIONs, tautological WHERE clauses, or stacked statements), with alerts on suspicious activity.
- Integration of automated security scanners into CI/CD pipelines to catch introduction of new dynamic-SQL anti-patterns.

