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.
Read more
- Hacking Tools Github
- Hacks And Tools
- Physical Pentest Tools
- Hack Tools Pc
- Pentest Tools For Mac
- Pentest Tools For Windows
- Pentest Tools Nmap
- Hacker Tools Linux
- Hacking Tools For Pc
- Hacking Tools Software
- Pentest Tools Apk
- Pentest Tools Online
- Pentest Tools Tcp Port Scanner
- Hacker Tools Apk Download
- Hack Tools For Windows
- World No 1 Hacker Software
- Pentest Automation Tools
- Hacking Tools Download
- Hacking Tools Hardware
- Hacking Tools For Beginners
- Pentest Tools For Mac
- Hackers Toolbox
- Hacker Tools Apk
- Top Pentest Tools
- Hacking Tools Kit
- Growth Hacker Tools
- Hacker Tools Free Download
- Usb Pentest Tools
- Pentest Tools Kali Linux
- Kik Hack Tools
- Hacks And Tools
- Hacker Tools Mac
- Hacking Tools 2019
- Hack Tools 2019
- Pentest Tools Find Subdomains
- Hacking Tools Github
- Hack Tools For Windows
- Pentest Tools Github
- Hacker Tools Mac
- Hack Tools Mac
- Android Hack Tools Github
- Hack Tools For Ubuntu
- Pentest Tools Kali Linux
- Pentest Tools Kali Linux
- What Are Hacking Tools
- Hackers Toolbox
- Kik Hack Tools
- Hacking Tools For Beginners
- Hackers Toolbox
- Hacking Tools And Software
- Hack Rom Tools
- Kik Hack Tools
- Hack Tools
- Hacking Tools For Kali Linux
- Install Pentest Tools Ubuntu
- Hacker Tools Github
- Hack Tools For Games
- Hack Tools Online
- Blackhat Hacker Tools
- How To Install Pentest Tools In Ubuntu
- Hack Tool Apk No Root
- Pentest Tools For Ubuntu
- Hack Tools Online
- New Hack Tools
- Hacker Hardware Tools
- Hack Tools Pc
- Hacking Tools Download
- Pentest Recon Tools
- Pentest Tools Nmap
- Pentest Tools Url Fuzzer
- Hacking Tools For Windows Free Download
- Hack Tools Mac
- Hacker Tools Online
- Best Pentesting Tools 2018
- Hack Tool Apk No Root
- Hacking Tools For Mac
- Pentest Tools Android
- Pentest Tools Linux
- Pentest Tools Download
- Hack Tools Online
- New Hacker Tools
- Hacking Tools 2020
- Hacking Tools Name
- How To Install Pentest Tools In Ubuntu
- Best Hacking Tools 2020
- Hack Tools For Pc
- Hak5 Tools
- How To Hack
- Hack Tools Pc
- How To Hack
- Growth Hacker Tools
- Hacker Tools Apk Download
- Pentest Tools Tcp Port Scanner
- Hackers Toolbox
- Pentest Recon Tools
- Hacker Tools Github
- Pentest Tools Apk
- Pentest Tools Nmap
- What Are Hacking Tools
- Hacker Tools For Pc
- Hacker Tools Windows
- Hacking Tools For Mac
- Wifi Hacker Tools For Windows
No comments:
Post a Comment