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
- Black Hat Hacker Tools
- Hack Tools For Games
- Computer Hacker
- Pentest Tools Tcp Port Scanner
- Hack Rom Tools
- Bluetooth Hacking Tools Kali
- Pentest Tools Nmap
- Hacking Tools For Mac
- Hack Website Online Tool
- Hacking Tools Mac
- Hack Tool Apk No Root
- Hacker Tools 2020
- Hacker Tools Windows
- Hacker Security Tools
- Hacker Tools Windows
- Hack Tool Apk
- Hacker Techniques Tools And Incident Handling
- Hack Tools For Mac
- Pentest Tools For Mac
- Hacker Tools Github
- Hacking Tools
- Pentest Tools Review
- Hacker Tools Apk Download
- Best Pentesting Tools 2018
- Hacking Tools For Games
- Hacker Tools Free
- Pentest Tools Subdomain
- Tools Used For Hacking
- Tools For Hacker
- Pentest Tools Online
- New Hacker Tools
- Hacking Tools Usb
- Pentest Reporting Tools
- Hack Tools For Games
- Hack And Tools
- Hack Tools Github
- Easy Hack Tools
- Pentest Tools Port Scanner
- Hacking Apps
- Top Pentest Tools
- Hacker Tools Free Download
- Pentest Tools Linux
- Hack Tools For Pc
- Hak5 Tools
- Hack Tool Apk
- Hacker Tools Online
- Tools For Hacker
- Hacking Tools Windows 10
- Hacker Search Tools
- Pentest Tools Apk
- How To Make Hacking Tools
- Hacker Tools 2020
- Pentest Tools Review
- Hack Tools Github
- Hack Tools For Windows
- Hacker Tools For Pc
- Github Hacking Tools
- Pentest Tools
- Nsa Hack Tools Download
- Termux Hacking Tools 2019
- Wifi Hacker Tools For Windows
- Pentest Tools
- Underground Hacker Sites
- Hacker Tools Software
- Pentest Tools Nmap
- Pentest Tools For Windows
- Pentest Tools Website
- Hacker Tools Online
- Hacker Tools List
- Android Hack Tools Github
- Hacker Security Tools
- Hacker Search Tools
- Hack Tools For Mac
- Hacking Tools Software
- Hacking Tools
- Hack Tools For Windows
- Hacks And Tools
- Hacker Hardware Tools
- Pentest Tools For Android
- Hacking Tools For Games
- How To Hack
- Hack And Tools
- Pentest Tools
- Easy Hack Tools
- Hack Tools For Pc
- Hacking App
- Pentest Tools Port Scanner
- Hack Tools Online
- Pentest Tools Website Vulnerability
- Hack Tools Download
- Hacking Tools For Beginners
- Hacker Tools For Pc
- Hacking Tools For Kali Linux
- Nsa Hack Tools Download
- Hacker Tool Kit
- Kik Hack Tools
- Hacking Tools Github
- Hack Tools Pc
- Pentest Tools Subdomain
- Pentest Tools Port Scanner
- Hack Tools Pc
- Hackrf Tools
- Hacker Tools Free
- Hack Tools Pc
- Hacker Tools 2020
- Hacker Tools Linux
- Hacking Tools For Mac
- Pentest Tools Windows
- Hacking Tools Download
- Wifi Hacker Tools For Windows
- Hack Rom Tools
- Black Hat Hacker Tools
- Hacker Search Tools
- Pentest Tools Apk
- Hacking Tools Windows
- Hacker Tools Free
- Tools 4 Hack
- Hacker Tools Free
- Nsa Hack Tools
- Pentest Tools Windows
- Hacking Tools For Windows
No comments:
Post a Comment