Coder Social home page Coder Social logo

ctf-fun's Introduction

CodeWars: 🐒

LeetCode: LeetCode

LeetCode Log: ⬇️ 🐒

ctf-fun's People

Contributors

iohehe avatar splendor-pro avatar

Watchers

 avatar  avatar

ctf-fun's Issues

m0leCTF2020

吃瓜CTF(m0leCTF2020)里的一个Chall,日常签到观光...

首先映入眼帘的是主页,有一个小星星图片

2020-05-27-051303

注册->登录,然后我们来到了核心功能:

截屏2020-05-27 下午1 16 29

这里可以看到上传文件,还给了一个template,打开看看:

截屏2020-05-27 下午1 16 59

Xml...上传试试:

发送呵呵哒星~
截屏2020-05-27 下午1 21 27

生成了一张图片

截屏2020-05-27 下午1 22 13

我们来访问一下
Uploading 截屏2020-05-27 下午1.24.27.png…

于是成了夜空中最闪耀的星~

既然可以heheda,那么就可以解析xml文件啰,开始尝试XXE:
heheda进化->&heheda;
Uploading 截屏2020-05-27 下午1.35.36.png…

这里就构造了xml实体攻击, 实体,我的理解是描述字符的字符。类比html中的实体,如<p>he&nbsp;heda</p>,html解析器会将其解析成<p>he heda</p>,同样的,在xml中,除了字符实体,我们还 还可以自己定义实体解析内容。xml解析器遇到实体引用,就去DTD中找实体定义(我猜是这样的哈哈哈哈哈)。

截屏2020-05-29 上午10 15 09

读到内容:

Uploading 截屏2020-05-27 下午1.38.40.png…
截屏2020-05-27 下午1 36 16

但是目录翻了个遍,flag呢?
。。。

看来需要读php源码了, 但是问题是以上方法不能读php源码,不能正确生成图片。为啥? 由于PHP是一门标签语言,php文件包含的一些characters(e.g <, >) 导致xml不能正常解析。 需要绕过这一点。 首先我尝试了PHP Protocol Wrappers:php://filter/read=convert.base64-encode/resource=file:///index.php,似乎不太好使。另一种为了规避xml解析,使用CDATA手段https://en.wikipedia.org/wiki/CDATA#CDATA_sections_in_XML。可以看到这个wiki中描述了。

CDATA section is merely an alternative syntax for expressing character data; there is no semantic difference between character data in a CDATA section and character data in standard syntax where, for example, "<" and "&" are represented by "<" and "&", respectively.

截屏2020-05-29 上午8 58 30

所以说内部的context不会被解析(正好在此拿来读源码)。

截屏2020-05-29 上午10 30 48

要拼接一个CDATA,我们应该这样,但是XML说明不允许在内部实体的声明中(&all;)中包含外部实体。( it is not permitted by the XML specification to include external entities in combination with internal entities.) [参考]

这里引入了Parameter Entities参数实体:

截屏2020-05-29 上午10 47 22

参数实体,用%号定义,使用在DTD中时首先被解析。因此上图中先将%paramEntity;解析,再来解析&genEntity;

xml文件:

截屏2020-05-29 上午10 59 02

dtd文件:

截屏2020-05-29 上午10 59 06

首先倒入%data;这个参数实体的内容, 加载内容然后用%start;%file;%end;这三个参数实体所声明的内容拼接成一个CDATA,即参数实体%all;的内容。然后在参数实体%all;的解析中,生成了内部实体&fileContents;的声明。

其实解析实体好像是一个变量赋值过程,而这个过程是解析器来执行的。把实体看成一些变量,好理解成注入内容到"变量"中去。

config

然后...还没完是一个jwt伪造,越权成admin,第一次遇到...

然后...sqlite注入...
admin_dashboard1
admin_dashboard2

后面题目关了我就没复现...参考:https://github.com/nreusch/writeups/blob/master/m0lecon_2020/skygenerator.md

Houseplant CTF 2020

Beginners

Tools:

Beginner 1

BASE64: cnRjcHt5b3VyZV92ZXJ5X3dlbGNvbWV9

Beginner 2

HEX2ASCII: 72 74 63 70 7b 62 6f 62 5f 79 6f 75 5f 73 75 63 6b 5f 61 74 5f 62 65 69 6e 67 5f 65 6e 63 6f 75 72 61 67 69 6e 67 7d

Beginner3

162 164 143 160 173 163 165 145 137 155 145 137 151 137 144 151 144 156 164 137 153 156 157 167 137 167 150 141 164 137 157 143 164 141 154 137 167 141 163 137 157 153 141 171 77 41 175
(don't know)

Beginner4

rot13: egpc{lnyy_orggre_cnegvpvcngr}

Beginner5

morse: -- .- -. -.-- ..--.- -... . . .--. ... ..--.- .- -. -.. ..--.- -... --- --- .--. ...
(Remember to wrap the flag in the flag format rtcp{something})

Beginner6

26 26 26 26 26 26 26 26 19 12 5 5 16 9 14 7 9 14 16 8 25 19 9 3 19

*disclaimer: DON'T DO THIS KIDS. only sleep in math.

Remember to wrap the whole thing in the flag format rtcp{}
(dot' know)

Beginner7

Atbash: igxk{fmovhh_gsvb_ziv_nvzm}

Beginner8

Bacon: 00110 01110 00100 00000 10011 00101 01110 01110 00011 00011 01110 01101 10011 10010 10011 00000 10001 10101 00100

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.