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
- Pentest Tools Apk
- Bluetooth Hacking Tools Kali
- Hacker Tool Kit
- Hacker Tools Mac
- Hacking Tools Software
- Hacking Tools Name
- Pentest Tools Online
- Hacker Tools 2019
- Hack Tools Github
- Hacker Tools Apk
- Pentest Tools For Ubuntu
- Hacker Tools Free
- Hacker Tools Hardware
- Physical Pentest Tools
- Hack Tools For Pc
- Pentest Tools Nmap
- Hack Tools Online
- Hackrf Tools
- Computer Hacker
- Hacking Tools Hardware
- Hacker Hardware Tools
- Hacker Tools For Mac
- Hacker
- Pentest Tools Nmap
- Ethical Hacker Tools
- Usb Pentest Tools
- Hacking Tools Usb
- Pentest Tools Alternative
- Hacking Tools And Software
- Hacking Apps
- Pentest Tools Port Scanner
- Hack Tools Github
- Hacking Tools Mac
- Pentest Tools Windows
- Hack Tools Mac
- Hack Apps
- Hacker Tools Software
- Pentest Tools Open Source
- Ethical Hacker Tools
- Hacker Tools For Mac
- Pentest Tools Url Fuzzer
- World No 1 Hacker Software
- Hacker Tools 2020
- Pentest Tools Download
- Hack Tools For Mac
- Pentest Tools For Windows
- Hacking Tools 2019
- Hack Tools Download
- Hacker Tool Kit
- Pentest Tools Framework
- Hacking Tools For Kali Linux
- Black Hat Hacker Tools
- Pentest Tools Framework
- Hacks And Tools
- Hack Tools For Pc
- Android Hack Tools Github
- Hack Tools Pc
- Hacker Tools Online
- Hack Tools For Games
- Hack Tools For Mac
- Best Pentesting Tools 2018
- Hacker Tools Linux
- Hack App
- Hacking Tools For Beginners
- Tools 4 Hack
- Hack Tools
- Hack Tool Apk
- Pentest Reporting Tools
- Best Hacking Tools 2020
- Usb Pentest Tools
- Pentest Tools For Windows
- Pentest Tools Bluekeep
- Hacker Tools Free Download
- Hack Tools Online
- Hack Tools Mac
- Pentest Tools Framework
- Pentest Tools Online
- Hack Tools For Pc
- Hacking Apps
- New Hack Tools
- Pentest Tools For Android
- Hack Tools Pc
- Wifi Hacker Tools For Windows
- Pentest Tools Apk
- Hacker Tools Apk
- Hacker Tools For Ios
- Hackrf Tools
- Nsa Hack Tools Download
- Pentest Tools For Ubuntu
- Pentest Tools Kali Linux
- Pentest Tools Tcp Port Scanner
- Hacking Tools Online
0 comments:
Post a Comment
Request Item or Service