Summary
YesWiki contains a SQL injection vulnerability in ReactionManager::deleteUserReaction() where URL path parameters are inserted directly into a SQL LIKE clause. An authenticated user may exploit the issue to alter the intended database query, potentially accessing or modifying data depending on database permissions and query context.
Affected context
The vulnerability occurs in YesWiki deployments using the affected reaction-deletion functionality, where the {idreaction} and {id} URL path parameters reach SQL query construction without sufficient escaping or parameterization. Exploitation generally requires an authenticated account that can access the relevant endpoint and submit crafted path values.
Exploit preconditions
- Attack surface: HTTP endpoint handling reaction deletion
- Required access: An authenticated YesWiki user with access to the affected functionality
- Trigger point: Processing of the
{idreaction}and{id}URL path parameters - Why exploitation is possible: User-controlled values are concatenated into a SQL
LIKEclause instead of being safely bound as query parameters
Why this happens
The underlying bug is an unsafe construction of SQL statements from request-controlled input. By concatenating URL path parameters into a query, the application allows input to influence SQL syntax rather than treating it exclusively as data. This behavior maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command, commonly called SQL injection.
Potential impact
- An attacker may read data beyond the intended reaction records.
- An attacker could alter or delete database content permitted by the application account.
- The vulnerability may enable authentication or authorization bypass in affected query flows.
- Sensitive wiki content or user information could be exposed.
- Database integrity and application availability may be reduced.
General mitigation guidance
Mitigation generally focuses on removing string concatenation from database queries and reducing trust in request parameters.
Common defensive patterns include:
- Using parameterized queries or prepared statements for all database operations.
- Applying allowlist validation for identifiers and enforcing expected data types before query execution.
- Keeping query construction separate from request parsing and authorization decisions.
- Ensuring database accounts have only the privileges required by the application.
- Applying authorization checks independently of database filtering logic.
- Centralizing secure database-access helpers so unsafe query patterns are harder to introduce.
How teams detect issues like this
Detection can include static analysis for SQL strings built through concatenation with request parameters, especially values obtained from URL paths. Code review should flag unparameterized query APIs, dynamic LIKE clauses, missing type validation, and authorization decisions that depend solely on user-controlled identifiers. Runtime monitoring can look for malformed query errors, unusual database response patterns, and repeated requests targeting reaction-management endpoints. Automated security review tools and CI policy checks may help enforce parameterized database access.

