[Day5] Web 小幸福

[Day5] Web 小幸福

今天我回彰化阿嬷家
看到绿油油的稻田,骑脚踏车凉风吹拂以及蝉鸣声叽叽叫,落日相伴
有种周杰伦-稻香MV的即视感,觉得幸福
这篇文是我回程在火车上颠颇生出来的
区间车车厢微晃写的我头都晕

今天我们要解的题目是

dont-use-client-side

Can you break into this super secure portal? https://jupiter.challenges.picoctf.org/problem/37821/ (link) or http://jupiter.challenges.picoctf.org:37821

Hints

Never trust the client
一打开就有个登入页面

我密码打123tty,随便打都行

他会弹出一个密码错误的通知


老方法,右键查看原始码,要谨记在心喔

<html>
<head>
<title>Secure Login Portal</title>
</head>
<body bgcolor=blue>
<!-- standard MD5 implementation -->
<script type="text/javascript" src="md5.js"></script>

<script type="text/javascript">
  function verify() {
    checkpass = document.getElementById("pass").value;
    split = 4;
    if (checkpass.substring(0, split) == 'pico') {
      if (checkpass.substring(split*6, split*7) == 'a3c8') {
        if (checkpass.substring(split, split*2) == 'CTF{') {
         if (checkpass.substring(split*4, split*5) == 'ts_p') {
          if (checkpass.substring(split*3, split*4) == 'lien') {
            if (checkpass.substring(split*5, split*6) == 'lz_1') {
              if (checkpass.substring(split*2, split*3) == 'no_c') {
                if (checkpass.substring(split*7, split*8) == '9}') {
                  alert("Password Verified")
                  }
                }
              }
      
            }
          }
        }
      }
    }
    else {
      alert("Incorrect password");
    }
    
  }
</script>
<div style="position:relative; padding:5px;top:50px; left:38%; width:350px; height:140px; background-color:yellow">
<div style="text-align:center">
<p>This is the secure login portal</p>
<p>Enter valid credentials to proceed</p>
<form action="index.html" method="post">
<input type="password" id="pass" size="8" />
<br/>
<input type="submit" value="verify" onclick="verify(); return false;" />
</form>
</div>
</div>
</body>
</html>

这扣是用前端 JavaScript写的,他把顺序排错了
我们把他重组排回来
我说他打乱是指 (0,split)--->pico
(6,7)--->a3c8

可以理解成第0,1位置字串是pico
第6,7位置字串是a3c8
所以我们要做的就是
找出0~1, 1~2, 2~3 以此类推,重组出原来的字串

有2个解法,可以手动重组或者写 python

得到flag:picoCTF{no_clients_plz_1a3c89}

好啦,我有点累了
100分题再次解锁

晚安


<<:  成为工具人应有的工具包-05 DataProtectionDecryptor

>>:  Android学习笔记11

Jquery/JS 使用Input 输入生日并限制年龄

客户需求如下 不要用datepicker点,说是手机太小不好点+老人不会点 资料库格式为西元年,但一...

Day28-全家桶

嗨,各位 昨天我们介绍过flac这好用的开源东东了 今天我要来介绍在linux上一个一样你(你)可以...

Day28 laravel todolist 建立使用者群组 下篇

Day28 laravel todolist 建立使用者群组 下篇 在上篇文章中,我们讲到如何邀请其...

你要的是Entity Framework吗?

很多初学Entity Framework( Core)(以下简称EF)的新手,刚开始使用EF时都会有...

DAY5 [C++程序语言简介]

工欲善其事必先利其器,在了解C++之前,下去下载吧!!! 安装Dev C++ [ https://s...