Summary
YesWiki contains a SQL injection vulnerability in the page-deletion workflow because a stored page tag is inserted into a database query without sufficient escaping. A low-privilege authenticated user may be able to manipulate a page tag and trigger arbitrary SQL execution, including time-based extraction of information from database tables.
Affected context
The vulnerability occurs in YesWiki deployments using the affected page API and deletion workflow. It requires a page tag supplied through the application to be stored and later reused in the link-cleanup query without parameterization or equivalent safe handling. Exploitation depends on the attacker having authenticated access sufficient to create or manage pages and invoke the relevant deletion operation.
Exploit preconditions
- Attack surface: Authenticated page-management and deletion API endpoints
- Required access: A low-privilege account with permission to create or manage pages
- Trigger point: Deletion of a page whose stored tag is later used in the link-cleanup query
- Why exploitation is possible: Attacker-influenced tag data is interpolated into SQL rather than being passed as a safely bound parameter
Why this happens
The underlying bug is an unsafe construction of a SQL statement using a database value that originated from attacker-controlled input. The deletion routine incorporates the page tag directly into a query, allowing SQL syntax within that value to alter the query's intended meaning. This behavior maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command, commonly known as SQL injection.
Potential impact
- An attacker may read sensitive records from database tables
- An attacker could alter or delete application data
- Database availability may be affected through resource-intensive queries
- Time-based inference could enable blind extraction of confidential information
- Compromised data could affect wiki content, accounts, or application configuration
General mitigation guidance
Mitigation generally focuses on ensuring that all database operations use parameterized queries or safely abstracted query-builder interfaces.
Common defensive patterns include:
- Binding page tags as data parameters rather than concatenating them into SQL
- Applying strict server-side validation and canonicalization to page identifiers
- Treating values retrieved from the database as untrusted when they originated from users
- Restricting page-management and deletion privileges according to least privilege
- Separating database permissions so the application account has only the access it requires
- Adding regression tests for quotes, delimiters, unexpected encodings, and other boundary inputs
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 statements
- Code review checks for database queries that receive request-derived or stored user content
- Runtime database monitoring for anomalous query structure, timing, errors, or access to unrelated tables
- Web-application policies that alert on unusual page tags and repeated deletion requests
- Automated security testing of API inputs and CRUD workflows, including encoded and delimiter-containing values

