Summary
A critical unauthenticated SQL injection in YesWiki's Bazar form-import path allows arbitrary SQL to be inserted into a database INSERT statement. On affected default installations, an unauthenticated visitor may read database contents, including password hashes stored in the yeswiki_users table.
Affected context
The vulnerability occurs in YesWiki installations that expose the Bazar form-import functionality and process attacker-controlled input through FormManager::create(). It is especially risky when the endpoint is reachable without authentication and the application database account has broad read or write permissions.
Exploit preconditions
- Attack surface: Publicly reachable YesWiki Bazar form-import functionality
- Required access: No authentication is generally required on affected default installations
- Trigger point: Processing of attacker-controlled form-import data by
FormManager::create() - Why exploitation is possible: Input is incorporated into an SQL
INSERTstatement without adequate parameterization or equivalent query-safety controls
Why this happens
The underlying bug is an SQL injection flaw, mapped to CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'). Application-controlled SQL statements incorporate untrusted form-import values without reliably separating data from executable query syntax, allowing database commands to be altered by crafted input.
Potential impact
- An attacker may read sensitive records from the application database
- Password hashes, including entries in
yeswiki_users.password, could be exposed - Database records may be modified, inserted, or deleted
- Application integrity and stored wiki content could be compromised
- Exposed credentials may enable follow-on account compromise if reused
General mitigation guidance
Mitigation generally focuses on enforcing a strict separation between SQL code and user-supplied data.
Common defensive patterns include:
- Use parameterized queries or prepared statements for every database operation
- Validate imported fields against explicit schemas, types, lengths, and allowed values
- Avoid constructing SQL fragments through string concatenation or interpolation
- Apply least-privilege permissions to the database account used by YesWiki
- Restrict public access to form-import functionality when it is not required
- Store password hashes using appropriate password-hashing controls and limit access to credential tables
- Add regression tests covering malformed, unexpected, and boundary-value inputs
How teams detect issues like this
Organizations commonly detect SQL injection risks through:
- Static analysis rules identifying SQL built through concatenation or interpolation
- Code review checks for direct use of request or form values in database queries
- Dynamic application testing that submits unexpected delimiters and type-conflicting values
- Web application firewall or database monitoring policies for suspicious query patterns
- Database audit logging for unusual reads from user, credential, or metadata tables
- Automated security review tools integrated into CI pipelines to flag unsafe query construction

