There are situations when c interacts with golang for example in a library, and its possible to exploit a golang function writing raw memory using an unsafe.Pointer() parameter.
When golang receive a null terminated string on a *C.Char parameter, can be converted to golang s tring with s2 := C.GoString(s1) we can do string operations with s2 safelly if the null byte is there.
When golang receives a pointer to a buffer on an unsafe.Pointer() and the length of the buffer on a C.int, if the length is not cheated can be converted to a []byte safelly with b := C.GoBytes(buf,sz)
Buuut what happens if golang receives a pointer to a buffer on an unsafe.Pointer() and is an OUT variable? the golang routine has to write on this pointer unsafelly for example we can create a golangs memcpy in the following way:
We convert to uintptr for indexing the pointer and then convert again to pointer casted to a byte pointer dereferenced and every byte is writed in this way.
If b is controlled, the memory can be written and the return pointer of main.main or whatever function can be modified.
https://play.golang.org/p/HppcVpLfuMf
The return addres can be pinpointed, for example 0x41 buffer 0x42 address:
We can reproduce it simulating the buffer from golang in this way:
we can dump the address of a function and redirect the execution to it:
https://play.golang.org/p/7htJHJp8gUJ
In this way it's possible to build a rop chain using golang runtime to unprotect a shellcode.
Read more
- Hack Apps
- Wifi Hacker Tools For Windows
- Hack App
- Hacking Tools Windows 10
- Ethical Hacker Tools
- Hacker Tools 2019
- Hacker Tools Linux
- What Are Hacking Tools
- Hacking Tools 2020
- New Hack Tools
- Hacking Tools Name
- Hacker Tools 2019
- Usb Pentest Tools
- Hacker Techniques Tools And Incident Handling
- Growth Hacker Tools
- Hack Tools Github
- Android Hack Tools Github
- Hack Tools For Games
- Hacking Tools Windows 10
- Pentest Tools List
- World No 1 Hacker Software
- Pentest Tools Linux
- Best Pentesting Tools 2018
- Hacking Tools Download
- Pentest Tools Website
- Hacker Hardware Tools
- Hacker Security Tools
- Hack Apps
- How To Hack
- Hacker Tools Apk
- Hackrf Tools
- Tools For Hacker
- Pentest Box Tools Download
- Hacker Tools Windows
- Hacking Tools Kit
- Best Pentesting Tools 2018
- Top Pentest Tools
- Hacker Tools Github
- What Are Hacking Tools
- Hacking Tools 2020
- Hack Rom Tools
- Game Hacking
- Pentest Box Tools Download
- Hacker Tools 2019
- Hacking Tools 2019
- Hack Tools
- Hacking Tools Download
- Hacking Tools Free Download
- Best Hacking Tools 2019
- Hack Tools 2019
- Hacking Tools For Beginners
- What Are Hacking Tools
- Pentest Tools For Windows
- Pentest Tools Apk
- What Is Hacking Tools
- Install Pentest Tools Ubuntu
- What Are Hacking Tools
- Hacking Tools Windows 10
- Hack Tools Download
- Pentest Tools Review
- Hacking Tools
- Hacking Tools Software
- Hacker Tools Windows
- Top Pentest Tools
- Hack Tools Online
- Hack And Tools
- Hacking Tools For Beginners
- Hack Tools For Windows
- Kik Hack Tools
- Hacking Tools Windows 10
- Hack Tools Online
- Hack Tools Download
- Hacking Tools Github
Nenhum comentário:
Postar um comentário