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 information
- Black Hat Hacker Tools
- Hacker Tools For Mac
- Hacker Tools Windows
- Hacking Apps
- Hacker Tools Apk Download
- Hack Website Online Tool
- Hacker Tools For Windows
- What Is Hacking Tools
- Hacking Tools 2019
- Tools 4 Hack
- Hack Tools Download
- Hacker Tools Windows
- Blackhat Hacker Tools
- Tools 4 Hack
- Hacking Tools Windows 10
- Hacking Tools Name
- Hacker Hardware Tools
- Hacker Tool Kit
- Hacker Tools For Mac
- Hack Tools
- Hacking Tools Software
- Pentest Tools For Windows
- Hack Tools For Windows
- Pentest Tools Alternative
- Pentest Tools Port Scanner
- Computer Hacker
- Hacker Tools For Ios
- Hacking Tools For Mac
- Nsa Hack Tools
- Pentest Tools Download
- Hacking Tools For Games
- Pentest Tools Framework
- Hackrf Tools
- Hacker Tools Linux
- Hack Tools
- Hacker
- Nsa Hacker Tools
- Free Pentest Tools For Windows
- Hack Tool Apk No Root
- Hacking Tools
- Wifi Hacker Tools For Windows
- Hack Tools 2019
- Pentest Tools
- Blackhat Hacker Tools
- Blackhat Hacker Tools
- Hacker Tools
- Hack Tools Mac
- Pentest Tools For Windows
- Pentest Tools Nmap
- Hack Tools For Mac
- Hack Tools
- Bluetooth Hacking Tools Kali
- Hacker Tools Github
- Hacking Tools For Pc
- Pentest Tools Free
- Hacker Tools For Pc
- Pentest Box Tools Download
- Hacking Tools For Pc
- Ethical Hacker Tools
- Pentest Tools Download
- Hacker Tools For Pc
- Physical Pentest Tools
- Hacker
- Hacker Tools Mac
- Hacker Tools For Mac
- World No 1 Hacker Software
- Hacking Tools Pc
- Hacker Tools Windows
- Pentest Tools Open Source
- Hacking Tools Kit
- Nsa Hack Tools Download
- Hacker Tools Apk
- Hack Tools Mac
- Pentest Tools Apk
- Hacker Tools Apk Download
- Hacker Tools Free
- Hacking Tools 2019
- Blackhat Hacker Tools
- Best Pentesting Tools 2018
- Hacking Tools And Software
- Hacking Tools Windows 10
- Pentest Tools Subdomain
- Pentest Tools Website Vulnerability
- Termux Hacking Tools 2019
- How To Install Pentest Tools In Ubuntu
- Hacker Tools Free
- Tools 4 Hack
- Pentest Tools Kali Linux
- Hack And Tools
- Hacker Hardware Tools
- Hacking Tools For Beginners
- Hacker Security Tools
- Hacks And Tools
- Pentest Tools For Windows
- Pentest Tools Subdomain
- Pentest Tools Tcp Port Scanner
- Hacking Tools Windows 10
- Pentest Box Tools Download
- Hack Tools 2019
- Hacker Search Tools
- Hack Tools 2019
- Game Hacking
- Pentest Tools Linux
- Hacker Tools 2019
- Hack Website Online Tool
- Hackrf Tools
- Best Pentesting Tools 2018
- Tools Used For Hacking
- Hack Tools
- Hack Tools Download
- Hack Tools Pc
- Free Pentest Tools For Windows
- Hackrf Tools
- Hack Tool Apk
- Hackers Toolbox
- Hack Tools For Mac
- Hack Tools For Windows
- Wifi Hacker Tools For Windows
- Pentest Tools Find Subdomains
No comments:
Post a Comment