buuctf刷题之旅—web—EasySQL
打开环境,发现依旧是sql注入


GitHub上有源码(https://github.com/team-su/SUCTF-2019/tree/master/Web/easy_sql)
index.php源码
<?php
session_start(); include_once "config.php"; $post = array();
$get = array();
global $MysqlLink; //GetPara();
$MysqlLink = mysqli_connect("localhost",$datauser,$datapass);
if(!$MysqlLink){
die("Mysql Connect Error!");
}
$selectDB = mysqli_select_db($MysqlLink,$dataName);
if(!$selectDB){
die("Choose Database Error!");
} foreach ($_POST as $k=>$v){
if(!empty($v)&&is_string($v)){
$post[$k] = trim(addslashes($v));
}
}
foreach ($_GET as $k=>$v){
if(!empty($v)&&is_string($v)){
$get[$k] = trim(addslashes($v));
}
}
//die();
?> <html>
<head>
</head> <body> <a> Give me your flag, I will tell you if the flag is right. </a>
<form action="" method="post">
<input type="text" name="query">
<input type="submit">
</form>
</body>
</html> <?php if(isset($post['query'])){
$BlackList = "prepare|flag|unhex|xml|drop|create|insert|like|regexp|outfile|readfile|where|from|union|update|delete|if|sleep|extractvalue|updatexml|or|and|&|\"";
//var_dump(preg_match("/{$BlackList}/is",$post['query']));
if(preg_match("/{$BlackList}/is",$post['query'])){
//echo $post['query'];
die("Nonono.");
}
if(strlen($post['query'])>40){
die("Too long.");
}
$sql = "select ".$post['query']."||flag from Flag";
//sql执行语句
mysqli_multi_query($MysqlLink,$sql);
do{
if($res = mysqli_store_result($MysqlLink)){
while($row = mysqli_fetch_row($res)){
print_r($row);
}
}
}while(@mysqli_next_result($MysqlLink)); } ?>
SQL执行的语句:$sql="select ".$post['query']."||flag from Flag";
所以整个语句为:1;set sql_mode=PIPES_AS_CONCAT;select 1
第二种:
根据SQL执行语句:$sql="select ".$post['query']."||flag from Flag";
构造出:$sql="select *,1 ||flag from Flag";
所以直接输入“*,1”就可直接出flag

buuctf刷题之旅—web—EasySQL的更多相关文章
- buuctf刷题之旅—web—随便注
打开环境 根据提示应该是sql注入 查看数据库名,和数据表 1';show databases;# 1';show tables;# 查看表内字段(1';desc `1919810931114514` ...
- buuctf刷题之旅—web—WarmUp
启动靶机 查看源码发现source.php 代码审计,发现hint.php文件 查看hint.php文件(http://7ab330c8-616e-4fc3-9caa-99d9dd66e191.nod ...
- BUUCTF刷题记录(Web方面)
WarmUp 首先查看源码,发现有source.php,跟进看看,发现了一堆代码 这个原本是phpmyadmin任意文件包含漏洞,这里面只不过是换汤不换药. 有兴趣的可以看一下之前我做的分析,http ...
- Leecode刷题之旅-C语言/python-1.两数之和
开学后忙的焦头烂额(懒得很),正式开始刷leecode的题目了. 想了想c语言是最最基础的语言,虽然有很多其他语言很简单,有更多的函数可以用,但c语言能煅炼下自己的思考能力.python则是最流行的语 ...
- Buuctf刷题:部分
get_started_3dsctf_2016 关键词:ROP链.栈溢出.mprotect()函数 可参考文章(优质): https://www.cnblogs.com/lyxf/p/12113401 ...
- Leecode刷题之旅-C语言/python-387 字符串中的第一个唯一字符
/* * @lc app=leetcode.cn id=387 lang=c * * [387] 字符串中的第一个唯一字符 * * https://leetcode-cn.com/problems/f ...
- BUUCTF刷题系列(2)5.27日记
CTF-Bugku-安卓篇1signin Writeup Bugku安卓部分第一题,第七届山东省大学生网络安全技能大赛的题目,属于Android逆向分析.(常用工具:安卓模拟器.JEB.Cyberch ...
- Leecode刷题之旅-C语言/python-112 路径总和
/* * @lc app=leetcode.cn id=112 lang=c * * [112] 路径总和 * * https://leetcode-cn.com/problems/path-sum/ ...
- Leecode刷题之旅-C语言/python-434 字符串中的单词数
/* * @lc app=leetcode.cn id=434 lang=c * * [434] 字符串中的单词数 * * https://leetcode-cn.com/problems/numbe ...
随机推荐
- Pytest 学习(二十七)- Jenkins+Allure+Pytest的持续集成
一.配置 allure 环境变量 1.下载 allure是一个命令行工具,可以去 github 下载最新版:https://github.com/allure-framework/allure2/re ...
- curl使用技巧汇总
1,curl 忽略证书安全验证 curl https://192.168.1.5:8443-insecure -I
- Windows安装Pytorch并配置Anaconda与Pycharm
1 开发环境准备 Python 3.7+Anaconda3 5.3.1(64位)+CUDA+Pycharm Community 2 安装Anaconda 2.1 进入官网下载: 根据windows版本 ...
- 冰河,能不能讲讲如何实现MySQL数据存储的无限扩容?
写在前面 随着互联网的高速发展,企业中沉淀的数据也越来越多,这就对数据存储层的扩展性要求越来越高.当今互联网企业中,大部分企业使用的是MySQL来存储关系型数据.如何实现MySQL数据存储层的高度可扩 ...
- Eureka 集群Demo
由于自己遇到了一些eureka集群疑问,就自己搭了一个集群demo进行测试.测试中通过两个eureka相互注册形成集群,两个服务提供者向eureka中注册服务,两个服务消费者通过feign进行服务调用 ...
- HW之蓝队防守
待看文章: https://blog.csdn.net/DBappSecurity_/article/details/107364216?utm_medium=distribute.pc_releva ...
- python 画图二(三维图,多轴图)
import sys reload(sys) sys.setdefaultencoding('utf-8') import matplotlib.pyplot as plt import numpy ...
- robots.txt协议如何设置禁止搜索引擎抓取?
什么情况下要设置禁止搜索引擎抓取自己的网站呢? 公司内部测试的网站,或者内部网,或者后台登录的页面,肯定不希望被外面的人搜索到,所以要禁止搜索引擎抓取.还有在我们的网站还未正式上线之前,我们需要做大量 ...
- k8s重器之Service
Service是k8s的核心,通过创建Service,可以为一组具有相同功能的容器应用提供一个统一的入口地址,并将请求进行负载分发到各个容器应用上. 目录: Service定义详解 Service基本 ...
- MySQL求两表的差集(非交集)
mysql如何查询两个字段数不同的表中数据不一致的记录 一般可用NOT EXISTS(非存在子句)或 LEFT JOIN左(右)连接后所产生空字段值来筛选两表的差集 1.NOT EXISTS not ...