Summary
YesWiki's public Bazar entry-listing APIs contain an unauthenticated SQL injection vulnerability in numeric query filters. An attacker may inject boolean SQL expressions and infer database contents based on whether matching entries are returned.
Affected context
The issue occurs in YesWiki's public Bazar entry-listing APIs when filters are applied to fields whose values are represented numerically. The risk exists where attacker-controlled filter values are inserted into SQL without being enclosed in quotes or subjected to strict numeric validation.
Exploit preconditions
- Attack surface: Public Bazar entry-listing API endpoints
- Required access: No authentication is generally required
- Trigger point: Processing of numeric query or queries filters
- Why exploitation is possible: The filter value is escaped but remains unquoted and is not constrained to a valid numeric format, allowing SQL expressions to influence query results
Why this happens
The vulnerability results from treating an attacker-controlled filter as a numeric SQL fragment without enforcing its intended data type. Escaping alone does not safely constrain values that are inserted into dynamically constructed SQL, allowing boolean expressions to alter query behavior. This maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command, commonly known as SQL injection.
Potential impact
- An attacker may infer sensitive database contents
- Query results could be manipulated or selectively exposed
- Confidential wiki or application data could be disclosed
- Database availability or integrity could be affected depending on query capabilities
General mitigation guidance
Mitigation generally focuses on removing attacker-controlled SQL construction and reducing trust in request parameters.
Common defensive patterns include:
- Use parameterized queries or prepared statements for every filter value
- Validate numeric inputs with strict type and range checks before query construction
- Avoid relying on escaping as a substitute for parameter binding
- Apply allowlisted field names and filter operators at the API boundary
- Run the application database account with only the permissions required by the application
- Return consistent responses that minimize inference through result differences
How teams detect issues like this
Organizations can identify similar issues through:
- Static analysis rules for string concatenation or interpolation in SQL statements
- Code review checks for numeric parameters that are escaped but not type-validated
- Dynamic testing of public filters using boolean-condition variations and response comparison
- Database monitoring for anomalous predicates and unexpected query patterns
- Policy enforcement requiring prepared statements for application-generated SQL
Automated security review tools may help flag unsafe query construction, but findings should be validated against the actual data-access layer.

