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.
Related articles
- Best Pentesting Tools 2018
- Nsa Hacker Tools
- Hacking Tools Hardware
- Hacking Tools Pc
- Hacking Tools For Games
- Free Pentest Tools For Windows
- Pentest Tools List
- Hacking Tools Name
- Ethical Hacker Tools
- Hack Tools For Pc
- Hacker
- How To Hack
- Hacking Tools For Mac
- Hacker Tools Apk Download
- Pentest Tools Framework
- Hack Tools Github
- Hacker Tools Online
- Hacker Security Tools
- Hacking App
- Hacker Tool Kit
- Hacker Tools 2019
- Hack Tools
- Pentest Tools For Windows
- Hacks And Tools
- Hack Tools Github
- Hacker Techniques Tools And Incident Handling
- Pentest Tools For Ubuntu
- Bluetooth Hacking Tools Kali
- Pentest Tools Download
- Hacking Tools Software
- Hacking Tools For Beginners
- Hacking Tools For Windows Free Download
- Hacking Tools Free Download
- Hacker Tools Free Download
- Hacker Tools Github
- Hacker Tools Mac
- How To Hack
- Pentest Recon Tools
- Hacking Tools
- Hacker Tools Windows
- Install Pentest Tools Ubuntu
- Hack Tool Apk
- Hacking Tools Software
- Pentest Tools Alternative
- Hack Tools For Windows
- Pentest Tools For Android
- Tools For Hacker
- Wifi Hacker Tools For Windows
- Pentest Tools Nmap
- Top Pentest Tools
- Hacker Tools List
- Hacker Tools List
- What Are Hacking Tools
- Nsa Hack Tools Download
- Pentest Tools For Ubuntu
- Hacker Tools Mac
- Hacking Tools Software
- Nsa Hacker Tools
- Github Hacking Tools
- Hacker Tools
- Hack Tools Github
- Pentest Tools Apk
- Pentest Tools Free
- Hack Tools For Pc
- Hacking Tools For Games
- Hacking Tools Mac
- Hack Rom Tools
- Pentest Tools Free
- New Hack Tools
- Hacking Tools For Windows 7
- Pentest Tools Download
- Pentest Tools Port Scanner
- Hack Tools
- Best Hacking Tools 2020
- How To Hack
- Hacking Tools Download
- Hack Tools For Windows
- Hacking Tools Free Download
- Hacker Hardware Tools
- Pentest Recon Tools
- Hack Tools Github
- Best Hacking Tools 2019
- Pentest Tools Kali Linux
- Growth Hacker Tools
- Hacking Tools Software
- Pentest Reporting Tools
- Underground Hacker Sites
- Hacker
- Hack Tools Download
- Wifi Hacker Tools For Windows
- Hacking Tools Windows 10
- Hacking Tools Online
- Pentest Tools Tcp Port Scanner
- Hacker Hardware Tools
- Hacking Tools And Software
- Pentest Tools Bluekeep
- Game Hacking
- Pentest Tools Website
- Hack Tools Download
- Hack Tools For Games
- Github Hacking Tools
- Black Hat Hacker Tools
- Physical Pentest Tools
- Hacker Tools Hardware
- Hack Tools For Pc
- Hack Tools Mac
- Hacking Tools Pc
- Hacking Tools For Pc
- Hack Tool Apk
- Beginner Hacker Tools
- Pentest Tools Windows
- Best Pentesting Tools 2018
- Hacker Tools Apk
- Pentest Tools Find Subdomains
- Wifi Hacker Tools For Windows
- Hacking Tools For Beginners
- Hacker Tools Free
- Hacker Tools For Ios
- Hacking Tools Windows 10
- Hacking Tools Pc
- Pentest Tools
- Pentest Tools Github
- Computer Hacker
- Hacker Tools Apk
- Hack Tools For Games
- Hacking App
No comments:
Post a Comment