Soumettre #1052136: YiSha YiShaAdmin ba04d5072885447553e372bb87e372b55a90780c SQL Injectioninformation

TitreYiSha YiShaAdmin ba04d5072885447553e372bb87e372b55a90780c SQL Injection
DescriptionYiShaAdmin builds paginated SQL queries by concatenating the user-controlled pagination "Sort" value directly into the ORDER BY clause. Sink: YiSha.Data/YiSha.Data/Extension/DatabasePageExtension.cs (SqlServerPageSql / OraclePageSql / MySqlPageSql): orderBy = " ORDER BY " + sort; Source: YiSha.Data/YiSha.Data.Repository/Repository.cs — FindList/FindTable pass pagination.Sort (bound from the list request) to the page builder. Filter: YiSha.Util/YiSha.Util/SecurityHelper.cs — IsSafeSqlParam() is a character blocklist: Regex "[-|;|,|\/|\(|\)|\[|\]|\}|\{|%|@|\*|!|\']". It rejects quotes, parentheses, commas, semicolons and comment characters, blocking classic payloads, but ORDER BY boolean-blind injection does not require any of those characters. Bypass payload (passes the filter): CASE WHEN 1=1 THEN id ELSE name END It is injected into "ORDER BY <payload>", letting an authenticated attacker control the result ordering with an arbitrary boolean condition and read data through an ordering oracle, e.g. "CASE WHEN secret > name THEN name ELSE id END". Proof of concept (against any paginated admin list endpoint, authenticated): sort = CASE WHEN 1=1 THEN id ELSE name END -> one ordering sort = CASE WHEN 1=2 THEN id ELSE name END -> a different ordering Different orderings confirm the injected condition is evaluated by the database. Verified with the project's own IsSafeSqlParam filter and DatabasePageExtension ORDER BY logic executed on SQLite: classic payloads (id;DROP, (SELECT 1), id-- -, name') are rejected, while "CASE WHEN ..." passes and controls output ordering; ordering by a secret-dependent expression leaks data. Impact: Authenticated boolean-blind SQL injection in every paginated list query. Direct exfiltration of arbitrary tables is constrained because the filter blocks subqueries, functions, string literals and stacked/time-based payloads. Severity Medium. Fix: Do not concatenate Sort into SQL. Validate against a per-entity allowlist of sortable column names and map SortType to a fixed ASC/DESC, or use the ORM typed ordering.
La source⚠️ https://github.com/liukuo362573/YiShaAdmin/blob/master/YiSha.Data/YiSha.Data/Extension/DatabasePageExtension.cs
Utilisateur
 canozal (UID 102350)
Soumission22/10/2026 15:33 (il y a 29 jours)
Modérer20/11/2026 20:39 (29 days later)
StatutAccepté
Entrée VulDB441601 [liukuo362573 YiShaAdmin Pagination Sorting DatabasePageExtension.cs SqlServerPageSql/OraclePageSql/MySqlPageSql/ sort injection SQL]
Points20

Want to stay up to date on a daily basis?

Enable the mail alert feature now!