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 information
- Hak5 Tools
- Hacking Tools For Windows 7
- Beginner Hacker Tools
- Pentest Tools Website Vulnerability
- Hacker Tools Mac
- Pentest Tools Open Source
- New Hacker Tools
- Hack Rom Tools
- Pentest Automation Tools
- Hacking Tools Windows
- Hacker Tools For Pc
- Pentest Tools Open Source
- Best Pentesting Tools 2018
- Easy Hack Tools
- Hacker Tools Online
- Termux Hacking Tools 2019
- Hacking Tools Software
- Hack Tools For Ubuntu
- Hacker Tools Software
- Hacking Tools For Windows 7
- Hacking Tools Windows
- Easy Hack Tools
- Growth Hacker Tools
- Top Pentest Tools
- Hack Apps
- Hack App
- Hack Tools Pc
- Hacker Tools Free
- Hack Tools For Games
- How To Install Pentest Tools In Ubuntu
- Pentest Tools Alternative
- How To Install Pentest Tools In Ubuntu
- Hacker Tools For Windows
- Pentest Tools Subdomain
- Hacking Apps
- Hacker Search Tools
- Underground Hacker Sites
- Hacker Tools Linux
- Hacker Tools 2020
- Hacking Tools 2020
- World No 1 Hacker Software
- Hacks And Tools
- Hacker Techniques Tools And Incident Handling
- Hacker Tools Hardware
- Nsa Hack Tools
- Hacking Tools And Software
- Hacking Tools Windows 10
- Hack Tools Github
- Hacking Tools 2019
- Pentest Tools For Windows
- Android Hack Tools Github
- Hacking Tools Usb
- Hacking Tools Kit
- Pentest Tools Tcp Port Scanner
- Pentest Tools Apk
- Pentest Reporting Tools
- Hacking Tools Kit
- Hacker Search Tools
- Hacker Techniques Tools And Incident Handling
- Pentest Tools Website Vulnerability
- Hacker Security Tools
- Hacker
- Hacker Tools
- Hacker Tools Software
- Hacking Tools Hardware
- Hacking Tools For Games
- Hacker Security Tools
- Pentest Tools Github
- Pentest Tools Review
- Pentest Tools For Android
- Wifi Hacker Tools For Windows
- Hackrf Tools
- Hacker Tool Kit
- Hacking Tools For Mac
- Hacker Tools For Pc
No comments:
Post a Comment