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.
Related posts
- Hacking Tools Download
- Easy Hack Tools
- Pentest Tools For Mac
- Hack Tools Mac
- Hack Rom Tools
- Hacker Tools For Windows
- Underground Hacker Sites
- Hacking Tools For Kali Linux
- Pentest Tools Bluekeep
- Hacker Tools Free
- Hacking App
- Hacking Tools For Games
- Hacking Tools Windows 10
- Tools For Hacker
- Pentest Tools Subdomain
- Hack Tool Apk
- Growth Hacker Tools
- Pentest Tools Port Scanner
- Install Pentest Tools Ubuntu
- Best Pentesting Tools 2018
- Hacking Tools For Kali Linux
- Pentest Tools Github
- Pentest Tools Url Fuzzer
- Hacking Tools
- Hack And Tools
- Hacker
- Game Hacking
- Hacker Tools Windows
- Hackers Toolbox
- Game Hacking
- Game Hacking
- Hacking Tools Download
- Hacking Tools Name
- Hacker Search Tools
- Hack Apps
- Hacking Tools 2019
- Hacker Tools Linux
- New Hack Tools
- Hack Tools
- Hacker Tools For Ios
- Pentest Tools Port Scanner
- Hacking Tools For Mac
- Hacking Tools Pc
- Hack And Tools
- Hacking Tools Name
- Hack App
- Best Hacking Tools 2019
- Hacker Tools Software
- Hacking Tools For Windows Free Download
- Hack Tools
- Hacker Tools Software
- Hacking Tools For Kali Linux
- Hacker Tools For Windows
- Growth Hacker Tools
- Hacker Tools Windows
- Hacker Tools Apk Download
- Hack Tools Github
- Nsa Hacker Tools
- Hacking Tools
- Hack Website Online Tool
- Hacker Hardware Tools
- Pentest Tools Github
- Pentest Tools Url Fuzzer
- Hack Tool Apk
- Hacker Hardware Tools
- Hack Tools For Games
- Free Pentest Tools For Windows
- Hacker Tools
- Hack Tools For Windows
- Pentest Reporting Tools
- Hack Tools Pc
- Pentest Tools For Mac
- Blackhat Hacker Tools
- Pentest Reporting Tools
- Hacking Tools Software
- Pentest Tools Alternative
- Hack Rom Tools
- Hacker Security Tools
- Hack Apps
- Hack Tools For Windows
- Pentest Tools List
- How To Make Hacking Tools
- Pentest Tools Bluekeep
- Pentest Tools Website Vulnerability
- Hack Tools For Games
- Pentest Tools Online
- Hacker Tools Hardware
- Hacks And Tools
- Hacking Tools Mac
- Pentest Tools Subdomain
- Hack Tool Apk No Root
- Pentest Tools For Windows
- Hack Tools Online
- Pentest Tools Bluekeep
- Hack Tool Apk No Root
- Hacking Tools For Beginners
- Hacking Tools For Windows Free Download
- Nsa Hack Tools
- Hack Tools For Ubuntu
- Hack Tools For Windows
- Hacking Tools Mac
- Nsa Hack Tools
- Hack Apps
- Pentest Tools Nmap
- Hack Rom Tools
- Pentest Tools Alternative
- Hacker Tools Mac
- Pentest Tools Download
- Hack Tools Pc
- Hack App
- Hacker Tool Kit
Nenhum comentário:
Postar um comentário