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 news
- Pentest Tools Framework
- Growth Hacker Tools
- Hack Tools Download
- What Are Hacking Tools
- Hacker Hardware Tools
- Hacker Security Tools
- Hacking Tools For Mac
- Hack Tools For Pc
- Pentest Tools Framework
- Pentest Tools Port Scanner
- Hack Tools For Windows
- Termux Hacking Tools 2019
- Hack Tools
- Pentest Tools Website Vulnerability
- Pentest Tools Online
- Pentest Automation Tools
- Free Pentest Tools For Windows
- Hacker Tools Hardware
- Black Hat Hacker Tools
- Pentest Tools Apk
- Pentest Tools Nmap
- Pentest Tools For Android
- Hacking Tools Name
- Physical Pentest Tools
- Hacking Tools Hardware
- Hacking Tools For Pc
- Pentest Automation Tools
- Hacking Tools Download
- Hack Tool Apk No Root
- What Are Hacking Tools
- Pentest Recon Tools
- Hacking Tools Github
- Hack Tools For Mac
- Hack Apps
- Hak5 Tools
- Hacker
- Hacker Techniques Tools And Incident Handling
- Hacking Tools For Windows 7
- Underground Hacker Sites
- Hacking Tools For Kali Linux
- Pentest Tools Find Subdomains
- Hack Tools For Mac
- Hack Tools 2019
- Pentest Tools Download
- Physical Pentest Tools
- Hack Website Online Tool
- What Is Hacking Tools
- Hack Tools Pc
- Install Pentest Tools Ubuntu
- Hacker Tools List
- Bluetooth Hacking Tools Kali
- Hack Rom Tools
- How To Install Pentest Tools In Ubuntu
- Hacking Tools Software
- Beginner Hacker Tools
- Pentest Automation Tools
- Hacking Tools Pc
- Install Pentest Tools Ubuntu
- Pentest Tools Github
- Hacker Tools Windows
- Hacking Tools Software
- Hacker Tools Software
- Hacker Tools Free Download
- Hacker Tools Free
- Hacking Tools Download
- Pentest Tools Tcp Port Scanner
- Blackhat Hacker Tools
- Hacks And Tools
- Pentest Tools Alternative
- Beginner Hacker Tools
- Game Hacking
- Hacking Tools 2020
- Hacking Tools For Windows
- Hack Website Online Tool
- Hack Apps
- Hack App
- Hacker Tools For Mac
- Nsa Hack Tools Download
- Hacker Tools Online
- Pentest Tools Online
- Hacks And Tools
- Hacker Tools For Pc






No comments:
Post a Comment