Summary
A SQL injection vulnerability in the XWiki Full Calendar Macro's Calendar.JSONService endpoint allows attackers to inject arbitrary SQL into backend queries.
When a user with permission to view this page (including unauthenticated guests in some deployments) interacts with the macro, crafted input can be used to access database information or disrupt service availability.
Affected context
This vulnerability arises in XWiki installations that use the Full Calendar Macro and expose the Calendar.JSONService page.
Any deployment where this page is viewable by broad user groups—especially anonymous or guest users—creates a reachable SQL injection surface.
The issue manifests when user-controllable data is incorporated into SQL queries used to fetch or manipulate calendar-related information in the wiki database.
Exploit preconditions
- Attack surface: HTTP interface exposing the Full Calendar Macro's
Calendar.JSONServiceendpoint. - Required access: Ability to access and view the
Calendar.JSONServicepage; in some configurations, this includes unauthenticated (guest) users. - Trigger point: Request parameters or fields that are processed by the JSON service and incorporated into SQL queries.
- Why exploitation is possible: User-controlled input is embedded into SQL statements without adequate parameterization or sanitization, allowing an attacker to alter the intended query structure.
Why this happens
The root cause is improper construction of SQL queries using data derived from HTTP requests.
Instead of relying on parameterized queries or a safe query-building abstraction, the implementation appears to concatenate or interpolate user input directly into SQL.
This pattern maps directly to CWE-89: SQL Injection, where the application fails to correctly separate data from control instructions, enabling an attacker to influence the semantics of database interactions through crafted inputs.
Potential impact
- Extraction of sensitive database information (e.g., wiki pages, user-related data, or configuration details), depending on underlying database privileges.
- Corruption or deletion of calendar-related or broader application data if writable queries are reachable.
- Denial of service by forcing expensive or malformed queries, potentially locking tables or exhausting database resources.
- Pivoting to additional attacks if database-level access reveals secrets, configuration parameters, or other data that can be reused elsewhere.
General mitigation guidance
Mitigation generally centers on treating all inbound data to database layers as untrusted and structurally separated from query logic.
Useful defensive patterns include:
- Using parameterized queries or prepared statements for all database access paths, especially those driven by web requests.
- Employing higher-level ORM or query-builder abstractions that automatically parameterize values instead of concatenating strings.
- Implementing strict validation and canonicalization of calendar-related parameters (dates, IDs, filters) to ensure they conform to expected formats and types.
- Restricting who can access sensitive service endpoints like
Calendar.JSONServiceand applying least-privilege principles so that database accounts only have the minimal rights needed. - Adopting secure-by-default coding guidelines that forbid manual string-building of SQL except under carefully reviewed conditions.
How teams detect issues like this
Detection can focus on both code-level patterns and runtime behavior:
- Static analysis: Configure rules to flag dynamic SQL string construction that incorporates HTTP parameters or other tainted input, highlighting direct concatenation or formatting patterns.
- Code review: Pay special attention to service endpoints (such as JSON APIs) that transform user-provided filters or search terms into SQL; look for places where validation is weak or absent.
- Policy enforcement: Enforce development policies that mandate parameterized queries and require security sign-off for any exceptions.
- Runtime monitoring: Use database and application logging to detect anomalous query patterns (e.g., injected operators, unexpected UNIONs, or tautological conditions) that may indicate SQL injection attempts.
- Automated SAST/DAST tools can assist by scanning for SQL injection sinks and probing endpoints with crafted payloads to discover unsafe behaviors.

