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
- Hacking Tools Software
- Hack Tools Github
- Hack Tools For Pc
- Pentest Tools Linux
- Hacking Tools Windows
- Hacker Tools Free
- Hacker Search Tools
- Hacking Tools For Beginners
- Hacker Tools For Windows
- Bluetooth Hacking Tools Kali
- Beginner Hacker Tools
- Game Hacking
- Best Pentesting Tools 2018
- Hacking Tools Online
- Hack Tools
- Hacker Tools Mac
- Hacking Tools For Windows 7
- Hacking Tools Download
- Pentest Tools For Windows
- How To Make Hacking Tools
- Physical Pentest Tools
- Hack Tools For Pc
- Tools For Hacker
- Android Hack Tools Github
- Game Hacking
- Install Pentest Tools Ubuntu
- Hack Tools Pc
- Pentest Tools Url Fuzzer
- Beginner Hacker Tools
- Pentest Tools
- Pentest Tools Framework
- Pentest Tools Android
- Hackrf Tools
- Hacking Tools For Pc
- New Hacker Tools
- Hack Tools For Windows
- Hack Tool Apk
- Pentest Tools Alternative
- Pentest Tools For Ubuntu
- Hacker Tools For Windows
- Hacking Apps
- Hacking Tools 2020
- Hack Tools Github
- Hacker Tools List
- Hacker Tools 2020
- What Is Hacking Tools
- Hacker Tools For Ios
- Pentest Tools Apk
- Hacker Tools For Ios
- Pentest Tools Windows
- Hacker Hardware Tools
- Hacker Tools Linux
- Hacking Tools Mac
- Hack Website Online Tool
- Pentest Reporting Tools
- Hacker Search Tools
- Hack Tools 2019
- Hacker Tools Software
- Best Pentesting Tools 2018
- Hack Apps
- Hacking Tools Windows 10
- Pentest Automation Tools
- Hacker Tool Kit
- Hack Website Online Tool
- Wifi Hacker Tools For Windows
- Hacking Tools For Mac
- Pentest Tools Subdomain
- Hack Tools For Mac
- Hack Rom Tools
- Hack Website Online Tool
- Hacking Tools Software
- How To Install Pentest Tools In Ubuntu
- Pentest Tools Url Fuzzer
- Hacking Tools 2020
- Hacking Tools 2020
- Hack Tools For Mac
- Hacker Tool Kit
- Hack Tools Mac
- Pentest Tools Subdomain
- Pentest Tools For Ubuntu
- How To Hack
- Pentest Tools Website
- Hacking Tools For Pc
- Hacking Tools For Windows 7
- Hacking Tools Windows 10
- Hack Tool Apk No Root
- Hacker Techniques Tools And Incident Handling
- Hacking Tools For Games
- Pentest Tools Download
- Hack Tools Mac
- Hacking Tools 2019
- Hacker Tools Free Download
No hay comentarios:
Publicar un comentario