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
- Usb Pentest Tools
- Pentest Tools Tcp Port Scanner
- Hacking Tools Github
- Pentest Tools Review
- Hacking Tools For Windows Free Download
- Hack Website Online Tool
- Hacker Tools Apk
- Ethical Hacker Tools
- Hack Tool Apk
- Hacking Tools For Windows Free Download
- Pentest Tools Website
- Free Pentest Tools For Windows
- Best Hacking Tools 2019
- World No 1 Hacker Software
- Hacker Tools 2020
- Pentest Tools Kali Linux
- Hacking Tools Mac
- Hack Tools Download
- How To Install Pentest Tools In Ubuntu
- How To Hack
- Pentest Tools Find Subdomains
- Beginner Hacker Tools
- Pentest Tools Android
- Top Pentest Tools
- Hacker
- Underground Hacker Sites
- Nsa Hack Tools Download
- Hacker Tools 2020
- Hak5 Tools
- Growth Hacker Tools
- Hackrf Tools
- Hacking Tools Kit
- Computer Hacker
- Hacker Tools Apk Download
- Hack Tools For Ubuntu
- Ethical Hacker Tools
- Best Hacking Tools 2020
- Growth Hacker Tools
- Hacking Tools Name
- Hacking Tools For Kali Linux
- Blackhat Hacker Tools
- Hak5 Tools
- Nsa Hack Tools
- Pentest Tools Bluekeep
- Pentest Tools Online
- Hack Rom Tools
- Bluetooth Hacking Tools Kali
- Hacker Search Tools
- Hacking Tools Windows
- Hacker Tools For Ios
- Hacking Tools Free Download
- Pentest Automation Tools
- Hacking Tools For Windows Free Download
- Hack Tool Apk
- Hack Tool Apk
- Usb Pentest Tools
- Pentest Tools Url Fuzzer
- Hacker Tools Online
- Hackrf Tools
- Hacker Tools Github
- Hacker Tools Free
- Hacker Techniques Tools And Incident Handling
- Free Pentest Tools For Windows
- Hack Tools Github
- Hack Website Online Tool
- Hacking Tools For Windows
- Pentest Automation Tools
- Pentest Tools Github
- Best Hacking Tools 2020
- Hack And Tools
- Pentest Box Tools Download
- Physical Pentest Tools
- Pentest Tools Subdomain
- Hacking Tools Github
- Hack Website Online Tool
- Hacker Security Tools
- Pentest Tools Free
- Hack Tools Pc
No comments:
Post a Comment