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.
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:
In this way it's possible to build a rop chain using golang runtime to unprotect a shellcode.
Related news
- Hak5 Tools
- Hack Website Online Tool
- Hacking Tools Software
- Termux Hacking Tools 2019
- What Are Hacking Tools
- Computer Hacker
- How To Install Pentest Tools In Ubuntu
- Computer Hacker
- Pentest Automation Tools
- Pentest Tools For Android
- Hacking Tools Mac
- Hacker Security Tools
- Black Hat Hacker Tools
- Hacker Tools 2019
- Computer Hacker
- Hacker Tools Mac
- Hacker Tools Mac
- Hacker Tools Hardware
- Hack Website Online Tool
- Hacking Tools Windows 10
- Hacking Tools Kit
- Hack Tools Download
- Pentest Automation Tools
- Hacker Tool Kit
- Pentest Tools Kali Linux
- Hacking Tools 2019
- Hack Tools For Ubuntu
- Wifi Hacker Tools For Windows
- Hacking Tools 2020
- Hack Tools For Games
- Hack Tools For Windows
- Hack And Tools
- Nsa Hack Tools
- New Hacker Tools
- Pentest Tools For Android
- Hacker Tools Linux
- Ethical Hacker Tools
- Bluetooth Hacking Tools Kali
- Pentest Recon Tools
- Pentest Tools List
- Hacker Tools For Mac
- Pentest Tools Find Subdomains
- Termux Hacking Tools 2019
- Pentest Tools Alternative
- Pentest Tools Alternative
- Hacks And Tools
- Pentest Reporting Tools
- Hack Tools Online
- Game Hacking
- Hacker Hardware Tools
- Hack Tool Apk No Root
- Hack Tools
- Github Hacking Tools
- Hacker Tools For Mac
- Hack Tools For Ubuntu
- Hacking Apps
- Easy Hack Tools
- Nsa Hack Tools Download
- Hack Website Online Tool
- Best Hacking Tools 2019
- Hacker Tools Free Download
- Pentest Tools For Mac
- Pentest Tools Website Vulnerability
- Hacking Tools Software
- Hack Apps
- Nsa Hack Tools Download
- Hacker Tools For Mac
- Pentest Tools Tcp Port Scanner
- Hacker Tools For Pc
- Hacking Tools 2020
- Pentest Tools Apk
- Pentest Tools Website Vulnerability
- Hacking Tools Free Download
- Pentest Recon Tools
- Pentest Tools Windows
- Pentest Tools Online
- Hack Website Online Tool
- Pentest Box Tools Download
- Hack Tools For Games
- Hack Rom Tools
- Hacking Tools Free Download
- Pentest Tools Windows
- Hack Tools Download
- Hacking Tools For Windows Free Download
- Pentest Tools Linux
- Hacker Search Tools
- Pentest Recon Tools
- Hacking Tools Kit
- Hacker Tools List
- Best Pentesting Tools 2018
- Hack Tools For Windows
- Hacker Tools For Pc
- Hacking Apps
- Growth Hacker Tools
- Pentest Tools Free
- Hacking Tools Download
- Pentest Tools Framework
- Pentest Tools For Windows
- Hacker Tools Linux
- Pentest Tools Github
- Hack Tools Pc
- Hack Tool Apk
- Hacker Security Tools
- Pentest Tools For Windows
- Bluetooth Hacking Tools Kali
- Hack Tools Pc
- Github Hacking Tools
- Nsa Hack Tools
- Wifi Hacker Tools For Windows
- Hack Tool Apk
- Termux Hacking Tools 2019
- Hacker
- Hacking Tools For Beginners
- Pentest Tools Bluekeep
- Hack Tools
- Hacking Tools Windows 10
- Free Pentest Tools For Windows
- Hacker Tools Apk Download