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.
More articles
- Computer Hacker
- Pentest Tools Kali Linux
- Game Hacking
- Pentest Tools Download
- Hack Tools Online
- Hacker Tool Kit
- Pentest Tools For Windows
- Pentest Tools Windows
- Hack Tools Online
- Hacking Tools Mac
- Hacking Tools 2019
- Hack And Tools
- Hack Website Online Tool
- Easy Hack Tools
- Hack Apps
- Bluetooth Hacking Tools Kali
- Hacking Tools For Windows 7
- Tools 4 Hack
- Hacker Tools Mac
- Hack Tools For Mac
- Hacker Tools
- Hacking Tools Kit
- Hacker Tools Apk
- Hacking Tools Pc
- Underground Hacker Sites
- Hacker Tools 2019
- Wifi Hacker Tools For Windows
- Hacker Tools Apk Download
- Game Hacking
- Physical Pentest Tools
- Ethical Hacker Tools
- Pentest Tools Online
- Tools 4 Hack
- How To Make Hacking Tools
- Hacking Tools Windows 10
- Hacking Tools For Games
- Hack Tools 2019
- Pentest Tools For Windows
- Hacking Tools For Pc
- Hacking Tools Hardware
- Hacker Tools Free Download
- Pentest Tools Review
- New Hack Tools
- Hacking Tools
- Hacker Tool Kit
- Hack Tools For Pc
- Hack Tools Download
- Hacker Tools Windows
- Hack Tools For Mac
- What Are Hacking Tools
- Hacking Tools Software
- Hacker Security Tools
- Hack App
- Pentest Tools For Windows
- Pentest Tools For Ubuntu
- Hack Tool Apk No Root
- Hack Tools For Windows
- Hacking Tools For Mac
- Pentest Tools Nmap
- Growth Hacker Tools
- Hacker Tools Apk
- Best Hacking Tools 2019
- Hacking Tools For Windows Free Download
- Hacking Tools For Pc
- Computer Hacker
- Hack Tool Apk
- Hacker Tools Windows
- Bluetooth Hacking Tools Kali
- Hacking Apps
- Hacker Tools Online
- Usb Pentest Tools
- Hacker Tools Mac
- Hacker Tools Apk Download
- Hack Tools For Pc
- Best Hacking Tools 2020
- Hack Tools Mac
- Nsa Hack Tools Download
- Github Hacking Tools
- Hacking App
- Hacks And Tools
- Blackhat Hacker Tools
- Hack Apps
- Hacking Tools Windows 10
- Hack Tools 2019
- Hacker Tools For Ios
- Pentest Tools Apk
- Hacker Tools Windows
- Pentest Tools For Android
- Hacker Tool Kit
- Pentest Tools List
- Hacking Tools Kit
- Blackhat Hacker Tools
- Hack Tool Apk
- Hacking Tools For Windows Free Download
No comments:
Post a Comment