| शीर्षक | YiSha YiShaAdmin ba04d5072885447553e372bb87e372b55a90780c SQL Injection |
|---|
| विवरण | YiShaAdmin 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. |
|---|
| स्रोत | ⚠️ https://github.com/liukuo362573/YiShaAdmin/blob/master/YiSha.Data/YiSha.Data/Extension/DatabasePageExtension.cs |
|---|
| उपयोगकर्ता | canozal (UID 102350) |
|---|
| सबमिशन | 22/10/2026 03:33 PM (29 दिन पहले) |
|---|
| संयम | 20/11/2026 08:39 PM (29 days later) |
|---|
| स्थिति | स्वीकृत |
|---|
| VulDB प्रविष्टि | 441601 [liukuo362573 YiShaAdmin तक ba04d5072885447553e372bb87e372b55a90780c Pagination Sorting DatabasePageExtension.cs SqlServerPageSql/OraclePageSql/MySqlPageSql/ sort SQL इंजेक्शन] |
|---|
| अंक | 20 |
|---|