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 Website
- Hacking Tools Software
- Pentest Recon Tools
- Pentest Box Tools Download
- Bluetooth Hacking Tools Kali
- Hacking Tools Pc
- Hacking App
- Best Hacking Tools 2019
- Hacker Tools Free Download
- Hacker Tools For Ios
- Hack App
- Best Hacking Tools 2019
- Hacking Tools For Pc
- Hacker Tools Free Download
- Hacker Tools For Windows
- Hack App
- Pentest Tools Framework
- Hacking Tools Pc
- Pentest Tools Kali Linux
- Blackhat Hacker Tools
- Pentest Tools Subdomain
- Hacker Tools Software
- Hacking Tools Usb
- Hacker Tools For Windows
- Hack Tools 2019
- Hacker Tools Apk Download
- Hacking App
- Pentest Tools Find Subdomains
- Hack Apps
- World No 1 Hacker Software
- Hack App
- Hack Tools Download
- What Is Hacking Tools
- Hacking Tools For Pc
- Hack Tools
- Hacker Tools For Windows
- Pentest Tools Review
- Pentest Tools For Mac
- Computer Hacker
- Hacking Tools 2020
- Hack Website Online Tool
- Pentest Tools Download
- Hacker Tools 2020
- Easy Hack Tools
- Hacker Tools
- Hacking Tools Windows 10
- Physical Pentest Tools
- Pentest Tools
- Pentest Tools Apk
- Hacker Tools For Mac
- Pentest Tools List
- New Hacker Tools
- Hacker Tools Mac
- How To Hack
- Pentest Tools List
- Pentest Tools Bluekeep
- Hack Tools For Games
- How To Hack
- Hacker Tools For Windows
- Hack Tools For Ubuntu
- Hack Tools
- Underground Hacker Sites
- Easy Hack Tools
- Pentest Tools Free
- Hacking Tools And Software
- Pentest Tools Alternative
- Hacking Tools Windows
- Free Pentest Tools For Windows
- Hacking App
- New Hack Tools
- Hacking Apps
- Hacking App
- Hacker Tools Software
- Hacking Tools Kit
- Pentest Tools Alternative
- Hack Tools
- Underground Hacker Sites
- Best Hacking Tools 2020
- New Hack Tools
- Hackrf Tools
- Hacks And Tools
- Pentest Tools Bluekeep
- Hacking Tools And Software
- Hacking Tools For Windows 7
- Growth Hacker Tools
- Pentest Tools
- Hacker Tools For Windows
- Hacker Tools
- Hacker Search Tools
- Pentest Tools For Android
- Hacking Tools For Windows Free Download
- Pentest Tools Tcp Port Scanner
- Hack Apps
- Pentest Tools Open Source
No comments:
Post a Comment