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 info
- Top Pentest Tools
- Hack Rom Tools
- Termux Hacking Tools 2019
- Install Pentest Tools Ubuntu
- Hacker Tools
- Pentest Tools Linux
- Pentest Tools Online
- Pentest Tools Review
- Pentest Tools Android
- Install Pentest Tools Ubuntu
- Hacking Tools Free Download
- Hacking Tools Windows
- Hacking Tools For Pc
- Nsa Hack Tools Download
- Hacker Tools Github
- Usb Pentest Tools
- Best Pentesting Tools 2018
- Hack Tool Apk
- Hack Tools For Windows
- Hacking Tools Github
- Hacking Tools For Kali Linux
- Hack Tools 2019
- Kik Hack Tools
- Hacking Tools For Windows
- Hacker Tools Free Download
- Pentest Tools Nmap
- Hacker Tools 2019
- Hack Tools For Games
- Hacker Search Tools
- Pentest Tools Nmap
- Pentest Tools Apk
- Hacking Tools For Windows 7
- How To Hack
- Pentest Tools Website
- Hack Tools 2019
- Hak5 Tools
- Hacking Tools For Windows
- Pentest Tools Windows
- Android Hack Tools Github
- Pentest Tools Windows
- Pentest Tools Port Scanner
- Hacking Tools 2019
- Hacker Tools For Windows
- Pentest Tools Review
- Hack Tools
- Bluetooth Hacking Tools Kali
- Hacker Tools Hardware
- Github Hacking Tools
- Pentest Tools Nmap
- Pentest Tools Github
- Pentest Tools Github
- Pentest Tools Android
- Hacking Tools Free Download
- Best Pentesting Tools 2018
- Hacker Tools Apk Download
- Hacker Tool Kit
- Pentest Tools Linux
- Pentest Tools Open Source
- Hack Tools Mac
- Hacking Tools Usb
- Android Hack Tools Github
- Hacks And Tools
- What Are Hacking Tools
- Pentest Tools Kali Linux
- Hacker Tools Mac
- Tools For Hacker
- Pentest Automation Tools
- Tools Used For Hacking
- Best Hacking Tools 2019
- Hack Tools For Mac
- Pentest Tools List
- Hacking Tools For Mac
- Hacker Tools Software
- Hack Tools For Pc
- Hacker Tools For Mac
- Underground Hacker Sites
- Hack App
- Hack Tools 2019
- Pentest Tools For Mac
- Pentest Recon Tools
- Hacking Tools Windows
- Hackrf Tools
- Hacking Tools For Windows Free Download
- Install Pentest Tools Ubuntu
- Pentest Tools
- Hacker Tools Free
- Hacking Tools Kit
- Pentest Tools Tcp Port Scanner
- Computer Hacker
- Hacker
- Hack And Tools
- Hacker Tools Linux
- Hacking Tools Download
- Hacking Tools Pc
- Nsa Hack Tools
- Pentest Tools
- Black Hat Hacker Tools
- Hacker Tools
- Pentest Tools Tcp Port Scanner
- Hack Tools For Windows
- Hack Tools For Windows
- Hack Apps
- Pentest Tools Port Scanner
- Hack App
- Hack Tools 2019
- Hacking Tools Github
- How To Make Hacking Tools
- Install Pentest Tools Ubuntu
No comments:
Post a Comment