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 links
- Pentest Tools Windows
- Pentest Automation Tools
- Tools Used For Hacking
- Hacking Tools Windows
- Hack Tools Online
- Hacking Tools Name
- Hacker Security Tools
- Top Pentest Tools
- Hacker Tools Hardware
- Black Hat Hacker Tools
- Hacking Tools Kit
- Blackhat Hacker Tools
- Hacker Techniques Tools And Incident Handling
- Hacking Tools Pc
- Pentest Tools Android
- Hacking Tools Hardware
- Pentest Tools Subdomain
- Pentest Tools Alternative
- Hacking Tools For Kali Linux
- Blackhat Hacker Tools
- New Hack Tools
- Hacker Tools For Ios
- Hacking Tools For Games
- Hack Tools For Ubuntu
- Hacker Tools For Ios
- Hacker Techniques Tools And Incident Handling
- Pentest Tools Website
- Hack Tools For Pc
- Hack Tools For Pc
- Hack Tool Apk
- What Are Hacking Tools
- Hacking Tools Mac
- Hack Tools For Games
- Beginner Hacker Tools
- Hacker Tools Online
- Growth Hacker Tools
- Hacker Tool Kit
- Hacker Tools Free
- Pentest Reporting Tools
- Hacking Tools Online
- Kik Hack Tools
- Tools For Hacker
- Black Hat Hacker Tools
- Hacking Apps
- Best Pentesting Tools 2018
- Hackrf Tools
- Bluetooth Hacking Tools Kali
- Hack Tools
- Usb Pentest Tools
- Hacking Tools Hardware
- Tools 4 Hack
- Hacking Tools Name
- Hacking Tools Pc
- Hacker Tools For Pc
- Usb Pentest Tools
- Hacking Tools Download
- Hacker Tools Free
- Nsa Hack Tools
- Beginner Hacker Tools
- How To Hack
- Pentest Tools Nmap
- Underground Hacker Sites
- Hacker Tools Github
- Hack And Tools
- Hacking Tools Kit
- Pentest Tools For Android
- Pentest Tools For Ubuntu
- Hacking Tools Kit
- What Is Hacking Tools
- Hack Tool Apk
- Easy Hack Tools
- Hacker Tools Free
- Pentest Tools Android
- Hacker Tools Apk
- Bluetooth Hacking Tools Kali
- Hacking Apps
- Pentest Tools Github
- Pentest Tools For Windows
- Hacker Tools For Pc
- Pentest Tools Online
- Hacker Tools Apk Download
- Hack Tools
- Hack Tools For Windows
- Tools For Hacker
- Hacking Tools For Windows Free Download
- Pentest Tools Url Fuzzer
- Top Pentest Tools
- Pentest Tools List
- Hack Tools
- Hack Tools 2019
- Beginner Hacker Tools
- Hacker Tools Windows
- New Hacker Tools
- Hack Apps
- Hack Rom Tools
- Pentest Tools
- Hacker Tools Hardware
- Hacking Tools For Pc
- Kik Hack Tools
- Nsa Hacker Tools
- Hacking Tools For Windows
- Underground Hacker Sites
- Hacker Tools Apk
- Hack Tools Github
- Hacker
0 comments:
Post a Comment