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.
Continue reading
- Hacker Tools For Mac
- Pentest Tools Online
- Hacking Tools Online
- Hacker Tools For Pc
- Pentest Automation Tools
- Pentest Tools Review
- Best Hacking Tools 2019
- Hacker Search Tools
- Hacker Tools
- Hacking Tools Software
- Hacking Tools For Windows 7
- Hacker Tools Linux
- Hacking Tools Windows 10
- Pentest Box Tools Download
- Hack Tools For Mac
- Hacker Tools For Windows
- Kik Hack Tools
- Pentest Tools Subdomain
- How To Make Hacking Tools
- Hack Apps
- Black Hat Hacker Tools
- Hacking Tools Download
- Hacker Tools
- Physical Pentest Tools
- Nsa Hacker Tools
- Hacker Tools Apk Download
- Hack Tools 2019
- Pentest Tools For Android
- Hacking Tools Hardware
- Hacking Tools For Kali Linux
- Ethical Hacker Tools
- Hacking Tools 2019
- Hack Tools Download
- Pentest Tools Review
- Pentest Tools Kali Linux
- Tools Used For Hacking
- Ethical Hacker Tools
- Hacking Tools 2020
- Top Pentest Tools
- Blackhat Hacker Tools
- Hacking Tools 2020
- Hacker Tools For Ios
- Pentest Tools List
- Hacker Tools Mac
- Hacking Tools For Games
- Hack Tools Github
- Nsa Hacker Tools
- Hack Apps
- Pentest Tools Alternative
- Pentest Tools Online
- Hack Rom Tools
- Hacking Tools Windows
- Hacker Tools Windows
- Hack Tools For Games
- Hacker Search Tools
- Underground Hacker Sites
- Top Pentest Tools
- Pentest Tools Tcp Port Scanner
- Pentest Tools Find Subdomains
- Hack And Tools
- Hackrf Tools
- Hacker Tools For Ios
- Hacker Tools Free
- Hacker Tools List
- Pentest Tools Review
- Hacking Tools Github
- Pentest Tools Kali Linux
- Pentest Tools Subdomain
- Hack Tools Mac
- Hacker Hardware Tools
- Hacker Hardware Tools
- Hack Tools For Ubuntu
- Hacker Tools Free
- Best Hacking Tools 2020
- Hack Tools For Games
- Pentest Tools Url Fuzzer
- Growth Hacker Tools
- What Are Hacking Tools
- Free Pentest Tools For Windows
- Ethical Hacker Tools
- Hack Tools 2019
- Nsa Hack Tools Download
- Hacking Tools 2020
- Hack Apps
- Tools 4 Hack
- Hacker Tools For Pc
- Hacking Tools Windows
- Hacking Tools
- New Hack Tools
- Hacker Tool Kit
- Hacking Tools Hardware
- Hack Tools
- Hacker Tools Online
- Hack Tools For Ubuntu
- Pentest Tools Url Fuzzer
- Hacking Tools For Windows 7
- Hacker Hardware Tools
- Best Pentesting Tools 2018
- Usb Pentest Tools
- What Are Hacking Tools
- Hacker Tool Kit
- Game Hacking
- Pentest Tools Review
No comments:
Post a Comment