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
- Pentest Tools Port Scanner
- New Hack Tools
- Pentest Tools Linux
- What Are Hacking Tools
- Hacking Tools For Windows
- Hacker Tools List
- Hack Tools
- Hack App
- Ethical Hacker Tools
- Hacking Tools Software
- Hacking App
- Hack Tools For Windows
- Pentest Tools Alternative
- Pentest Tools
- Android Hack Tools Github
- Hacking Tools Software
- Hacking Tools Hardware
- Hack Tools Mac
- Pentest Tools Online
- Hacker Techniques Tools And Incident Handling
- Hack Tools For Mac
- Hacking Apps
- Hacking Tools 2019
- Hack Tools For Mac
- Easy Hack Tools
- Pentest Box Tools Download
- Pentest Recon Tools
- Tools Used For Hacking
- Hacking Tools Kit
- Growth Hacker Tools
- Hack Tools For Pc
- Hacker Tools Github
- Pentest Tools Bluekeep
- Usb Pentest Tools
- Hacker
- Hacking Tools For Beginners
- Hacker Tools For Windows
- Pentest Tools List
- Hacker
- Hack Tools For Games
- Tools 4 Hack
- Pentest Tools
- Pentest Tools Kali Linux
- Pentest Tools Url Fuzzer
- Hacking Tools For Windows Free Download
- Pentest Tools Review
- How To Hack
- Hacks And Tools
- Hacker Tools 2020
- Hacker Tools Apk
- Blackhat Hacker Tools
- How To Hack
- Nsa Hacker Tools
- Pentest Tools Open Source
- Free Pentest Tools For Windows
- Hack Tools 2019
- Pentest Tools For Android
- Hacker Security Tools
- How To Hack
- Hacker Security Tools
- Hack Tools For Windows
- Hack Tools Github
- Pentest Tools Find Subdomains
- Physical Pentest Tools
- Hack Website Online Tool
- Hacker Tools For Pc
- Hacker Tools 2020
- Bluetooth Hacking Tools Kali
- Hacking Tools Mac
- Github Hacking Tools
- Pentest Reporting Tools
- Hack Tools For Mac
- Hacker Security Tools
- Hack Tools
- Install Pentest Tools Ubuntu
- Pentest Tools Online
- Best Hacking Tools 2019
- Hacker Tool Kit
- New Hacker Tools
- Hackers Toolbox
- Pentest Tools Tcp Port Scanner
- Blackhat Hacker Tools
- Best Hacking Tools 2020
- Bluetooth Hacking Tools Kali
- Pentest Tools Android
- Hacker Techniques Tools And Incident Handling
- Blackhat Hacker Tools
- Pentest Tools Website Vulnerability
- Tools Used For Hacking
- Pentest Tools Apk
- Pentest Tools Free
- Pentest Box Tools Download
- Hackrf Tools
- World No 1 Hacker Software
- Hacking Tools For Beginners
- Hacking Tools
- Pentest Tools Website Vulnerability
- Pentest Tools Url Fuzzer
- Pentest Tools For Mac
- Pentest Tools Subdomain
- Hacker Tool Kit
- Pentest Tools Nmap
- Hacking Tools For Windows
- Nsa Hack Tools
- Pentest Tools Apk
- Pentest Tools Github
- Hacking Tools For Pc
- Easy Hack Tools
- Hacker Tools Windows
- How To Make Hacking Tools
- Hack Tool Apk
- Hacker Hardware Tools
- Easy Hack Tools
- Hacking Tools For Windows
- Pentest Tools
- Hacking App
- Hacking App
- Kik Hack Tools
- Pentest Tools For Windows
- What Is Hacking Tools
- Best Hacking Tools 2020
- Pentest Tools Online
- New Hacker Tools
- Hacking Tools Usb
- Hacks And Tools
- Hack Tools Github
- Hacker Security Tools
- Hack Tools For Games
- Nsa Hack Tools
- Hacker Tools Apk
- Ethical Hacker Tools
- Pentest Tools Windows
- Hacking Tools For Beginners
- Hacking Tools
- Kik Hack Tools
- Ethical Hacker Tools
- Pentest Tools Free
- Pentest Tools Bluekeep
- Hacker Tools Hardware
- Pentest Tools Website
- Pentest Tools Apk
- Hacker Tools Windows
- Hack Tools For Games
- Hacker Tools Free Download
- Pentest Tools Nmap
- Pentest Tools Nmap
- Hack Rom Tools
- Pentest Tools Android
- Pentest Tools For Ubuntu
- Hack And Tools
- Game Hacking
- Hack Website Online Tool
- Pentest Tools List
- Hacker Tools Hardware
- Pentest Tools Free
- Hacks And Tools