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 word
- Hacker Tools Windows
- Hacking Tools Windows
- What Are Hacking Tools
- Black Hat Hacker Tools
- What Is Hacking Tools
- Hacking Tools For Kali Linux
- Pentest Tools Find Subdomains
- Tools 4 Hack
- Pentest Automation Tools
- Pentest Tools Website
- Hacking Tools For Mac
- Tools For Hacker
- Hack Tool Apk
- How To Hack
- New Hack Tools
- New Hacker Tools
- Termux Hacking Tools 2019
- Hacker Tools Apk Download
- Hacking Tools Name
- What Are Hacking Tools
- Pentest Tools Linux
- Hacker Tools Linux
- Pentest Tools Url Fuzzer
- Easy Hack Tools
- Hack Tools 2019
- Hacking Tools Usb
- Wifi Hacker Tools For Windows
- Hacking Tools For Mac
- Hacker Security Tools
- Hack Tools For Mac
- Hacks And Tools
- Growth Hacker Tools
- Best Hacking Tools 2020
- Pentest Tools Alternative
- Nsa Hack Tools Download
- How To Hack
- Free Pentest Tools For Windows
- New Hacker Tools
- Pentest Tools For Mac
- Hack Tools 2019
- Hacking Tools 2020
- Pentest Tools Free
- Hacker Tools Software
- Hacking Tools Usb
- Hack Website Online Tool
- Hacker Tools For Ios
- World No 1 Hacker Software
- Wifi Hacker Tools For Windows
- Hacker Hardware Tools
- Hacker Tools Software
- Hacking Tools For Windows
- Hack App
- Hacker Tools Hardware
- Hacking Tools For Windows 7
- Hacking Tools For Mac
- Hacker Tools List
- Pentest Tools Android
- Pentest Tools For Android
- Ethical Hacker Tools
- Top Pentest Tools
- Pentest Tools Url Fuzzer
- Black Hat Hacker Tools
- Blackhat Hacker Tools
- Hacker Security Tools
- Hacker Techniques Tools And Incident Handling
- Pentest Tools For Mac
- Hacking Tools Windows 10
- Hack Tools
- Pentest Tools List
- Pentest Tools Alternative
- Hacking Tools 2019
- Growth Hacker Tools
- Hack Tools Online
- Pentest Tools For Ubuntu
- Pentest Tools Review
- Hack Tools Online
- Computer Hacker
- Hack Tools 2019
- Pentest Tools Github
- Pentest Tools Online
- Hacker Tool Kit
- What Is Hacking Tools
- Pentest Tools Port Scanner
- Top Pentest Tools
- Pentest Recon Tools
- Hack And Tools
- Pentest Tools List
- Physical Pentest Tools
- Kik Hack Tools
- Hacker Tools Hardware
- How To Hack
No comments:
Post a Comment