[CTF]Bugku题解WEB部分

去训练一下基础!

BUG

Bugku地址:https://ctf.bugku.com/challenges

0x01 web2

地址:http://123.206.87.240:8002/web2/ ,查看源码

web2


0x02 计算器

地址:http://123.206.87.240:8002/yanzhengma/

运气比较好,随机了一个个位数,这里前端改一下<input maxlength="99">即可

计算器


0x03 web基础$_GET

地址:http://123.206.87.240:8002/get/

更具提示,传入?what=flag

flag


0x04 web基础$_POST

地址:http://123.206.87.240:8002/post/

POST提交参数就好了

flag


0x05 矛盾

地址:http://123.206.87.240:8002/get/index1.php

flag


0x06 web3

地址:http://123.206.87.240:8002/web3/

查看源码,到最底部,解码得flag

flag


0x07 域名解析

地址:

windows下找到c:\windows\system32\drivers\etc\host文件,末尾添加一行并保存:

123.206.87.240  flag.baidu.com

然后访问:flag.baidu.com

flag


0x08 你必须让他停下

地址:http://123.206.87.240:8002/web12/

一进去就不断刷新,查看源码,有一个javascript函数一直刷新,使用Burpsuite抓包不断提交

flag


0x09 本地包含

地址:http://123.206.87.240:8003/

直接500了,下一道


0x0A 变量1

地址:http://123.206.87.240:8004/index1.php

image

构造什么好呐?打印全局变量试试?

image


0x0B web5

地址:http://123.206.87.240:8002/web5/

查看源码:

jsfuck

这是JSfuck,复制该代码在F12控制台运行

image

然后改成大写,提交即可!


0x0C 头等舱

地址:http://123.206.87.240:9009/hd.php

根据题目以及查看源码没东西,还有文件名:hd => head,推测flag应该隐藏在数据包头部

image


0x0D 网站被黑

地址:http://123.206.87.240:8002/webshell/

根据提示,虽然没什么用,但是经常遇到,webshell,猜测这个网站存在webshell

猜测:http://123.206.87.240:8002/webshell/shell.php

结果真的存在,然后查看源码,没有有效信息,也不是不灭之魂大马,不存在后门,burpsuite 直接抓包爆破,得到密码hack

image


0x0E 管理员系统

地址:http://123.206.31.85:1003/

尝试登陆:adminadmin账号密码,显示IP禁止访问,IP已经被记录,打开控制台,发现底部有个<!-- dGVzdDEyMw== -->

image

很明显的base64编码,解码得到:test123,猜测账号:admin,密码:test123

那么,抓包修改XXF为:127.0.0.1

然而还是没法儿得到 Flag,为啥?思路这样没错,可能题目环境有点问题了吧~

补充几个 IP 值头部:

X-Forwarded-For: 127.0.0.1 [,proxy1][,proxy2]
X-Remote-IP: 127.0.0.1
X-Remote-ip: 127.0.0.1
X-Client-ip: 127.0.0.1
X-Client-IP: 127.0.0.1
X-Real-IP: 127.0.0.1

0x0F web4

地址:http://123.206.87.240:8002/web4/

查看源码,发现js中右两个变量被URL编码了,解码得到:

// 第一个变量
function checkSubmit(){var a=document.getElementById("password");if("undefined"!=typeof a){if("67d709b2b

// 第二个变量
aa648cf6e87a7114f1"==a.value)return!0;alert("Error");a.focus();return!1}}document.getElementById("levelQuest").onsubmit=checkSubmit;

// 合起来整理
function checkSubmit() {
    var a = document.getElementById("password");
    if ("undefined" != typeof a) {
        if ("67d709b2b54aa2aa648cf6e87a7114f1" == a.value) return !0;
        alert("Error");
        a.focus();
        return !1
    }
}
document.getElementById("levelQuest").onsubmit = checkSubmit;

image

然后将字符串:67d709b2b54aa2aa648cf6e87a7114f1填入输入框,提交可得flag

image


0x10 flag在index里

地址:http://123.206.87.240:8005/post/

很明显的文件包含漏洞,flag在index.php文件中,那么读取输出

http://123.206.87.240:8005/post/index.php?file=php://filter/read/convert.base64-encode/resource=index.php

解码


0x11 输入密码查看flag

地址:http://123.206.87.240:8002/baopo/

从URL路径可知是一道“爆破”,只需要输入5位数字密码即可查看

使用Burpsuite抓包intruder即可,或者自己写个脚本


0x12 点击一百万次

地址:http://123.206.87.240:9001/test/

鼠标点击发生变化,在控制台重新赋值计数999999,然后再点一下就能看到flag


0x13 备份是个好习惯

地址:http://123.206.87.240:8002/web16/

如题,尝试访问:http://123.206.87.240:8002/web16/index.php.bak

下载该文件,到本地

<?php
/**
 * Created by PhpStorm.
 * User: Norse
 * Date: 2017/8/6
 * Time: 20:22
*/

include_once "flag.php";
ini_set("display_errors", 0);
$str = strstr($_SERVER['REQUEST_URI'], '?');
$str = substr($str,1);
$str = str_replace('key','',$str);
parse_str($str);
echo md5($key1);

echo md5($key2);
if(md5($key1) == md5($key2) && $key1 !== $key2){
    echo $flag."取得flag";
}
?>

这里涉及到有str_replace()通过双写可绕过,md5可以通过0e开头的,也可以利用无法hash数组,返回空来绕过

image


0x14 总结

暂时到这里吧,后面还有更多的题目,下篇文章继续!各位路过的大牛如果有什么新的思路,不妨评论交流一下!

发表评论 / Comment

用心评论~

金玉良言 / Appraise
知识共享网LV 1
2019-05-01 20:56
更换模板了?东哥
头像
DYBOY站长已认证
2019-05-02 10:52
@知识共享网:新模板,还在完善中。。。
文娱帝国LV 1
2019-04-27 14:01
写的好,火钳刘明
头条新闻LV 1
2019-04-26 21:46
文章不错非常喜欢
MrxnLV 2
2019-04-26 00:31
不玩了 变量覆盖、头等舱等 好多都是往年的。。。
MrxnLV 2
2019-04-25 23:27
刚 顺便看了一下 第三题那个计算器 答案写在 JS 源码里面。。。
    $("#code").on('click',codes)
      
    $("#check").click(function(){
        if ($(".input").val() == code && code != 9999) {  
            alert("flag{CTF-bugku-0032}");  
        } else {  
            alert("输入有误!");  
        }  
    });

Warning: Cannot modify header information - headers already sent by (output started at /www/wwwroot/blog.dyboy.cn/content/templates/dyblog/footer.php:56) in /www/wwwroot/blog.dyboy.cn/include/lib/view.php on line 23