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 articles
- Blackhat Hacker Tools
- Pentest Tools For Ubuntu
- Hacker Tools For Windows
- Hack Tools
- Hacker Tools Apk
- Nsa Hack Tools
- Tools 4 Hack
- Android Hack Tools Github
- Kik Hack Tools
- Top Pentest Tools
- How To Install Pentest Tools In Ubuntu
- Hacking Tools Download
- Hack Apps
- Pentest Recon Tools
- Pentest Tools For Windows
- Hack Tools For Windows
- Black Hat Hacker Tools
- Top Pentest Tools
- Hacking Tools Github
- Hacker Tools
- Pentest Tools Online
- Bluetooth Hacking Tools Kali
- Hack Tool Apk No Root
- Pentest Tools Download
- Hacking Tools Mac
- Hack Tools Download
- Blackhat Hacker Tools
- Nsa Hacker Tools
- Hacker Tools Free
- World No 1 Hacker Software
- Hacking Tools For Windows
- Hacker Hardware Tools
- Nsa Hack Tools
- Hacker Tools Windows
- Hacking Tools Pc
- Hacking Tools For Mac
- Ethical Hacker Tools
- World No 1 Hacker Software
- Pentest Tools Alternative
- Hack Tools
- Hack And Tools
- Pentest Tools Linux
- Hacking Tools For Windows 7
- Hack Tools
- Hacker Tools Apk
- Pentest Tools Download
- Pentest Tools Framework
- Pentest Tools For Android
- Beginner Hacker Tools
- Best Hacking Tools 2019
- Pentest Tools Website Vulnerability
- Hacker Tools Free Download
- Hacker Tools For Windows
- Pentest Automation Tools
- Hacking App
- Pentest Tools Bluekeep
- Hak5 Tools
- Pentest Tools List
- Hacking Tools For Kali Linux
- Hacking Tools For Kali Linux
- How To Hack
- Black Hat Hacker Tools
- Hak5 Tools
- Hack Tools 2019
- Pentest Tools Tcp Port Scanner
- Pentest Tools Apk
- New Hacker Tools
- Tools Used For Hacking
- Pentest Tools Framework
- Pentest Tools Website
- Pentest Tools Kali Linux
- Pentest Tools Github
- Hack Tools Mac
- Hacker Tools List
- Hacking Tools 2020
- Hacker Tools Free
- Hacks And Tools
- Pentest Tools Nmap
- Pentest Tools Github
- Hacking Tools Software
- Github Hacking Tools
- Hacking Tools Pc
- Free Pentest Tools For Windows
- World No 1 Hacker Software
- How To Hack
- Hacker Tools Software
- Pentest Tools Url Fuzzer
- Hacking Tools For Beginners
- Hacker Tool Kit
- Hacker Techniques Tools And Incident Handling
- Hacking Tools
- Hacking App
- Best Hacking Tools 2019
- Physical Pentest Tools
- Tools 4 Hack
- Hacker Tools Online
- Pentest Tools Review
- Hack Rom Tools
- Hack Tools For Games
- Hack Tools For Games
- Install Pentest Tools Ubuntu
- Pentest Tools Port Scanner
- Best Hacking Tools 2019
- Hacker Tools List
- Hack Tools Mac
- Underground Hacker Sites
- Hacking Tools And Software
- Hacking Tools Software
- Wifi Hacker Tools For Windows
- Nsa Hack Tools Download
- Hack And Tools
- Pentest Tools Github
- New Hacker Tools
- Hack And Tools
- Android Hack Tools Github
- Termux Hacking Tools 2019
- Hacking Tools Pc
- Hack Tools For Mac
- Pentest Tools Framework
- Hacking App
- Pentest Tools Alternative
No comments:
Post a Comment