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
- Nsa Hack Tools Download
- Pentest Tools Alternative
- Hacking Tools Pc
- Hack Tools Github
- Pentest Tools Github
- Pentest Tools Port Scanner
- Hack Website Online Tool
- Pentest Recon Tools
- Hacking Tools Kit
- New Hack Tools
- Pentest Recon Tools
- Blackhat Hacker Tools
- World No 1 Hacker Software
- How To Make Hacking Tools
- Hack Tools 2019
- Usb Pentest Tools
- Usb Pentest Tools
- Nsa Hack Tools Download
- Nsa Hack Tools Download
- Growth Hacker Tools
- Hacker Security Tools
- Hack Tools Pc
- Hack Tools For Ubuntu
- Pentest Tools For Mac
- Hack Tool Apk No Root
- Hacker Tools List
- Hacking Tools Hardware
- New Hacker Tools
- Best Hacking Tools 2020
- Hack App
- Hack Tool Apk
- Hacker Tools For Mac
- Pentest Tools Port Scanner
- Hack And Tools
- Free Pentest Tools For Windows
- Hacker Tools For Windows
- Hacking Tools Kit
- Pentest Tools Port Scanner
- Hack Tools Mac
- Pentest Tools Kali Linux
- Hacker Search Tools
- Tools For Hacker
- Hacking Tools Online
- Hacking Tools For Windows 7
- Hacking Tools Windows
- Pentest Tools For Mac
- Pentest Tools
- Pentest Tools Port Scanner
- Pentest Tools Port Scanner
- Pentest Tools Android
- Hacker Tools Linux
- Hacking Tools Download
- Hacker
- Hacking Tools For Games
- Hacker Tools Apk Download
- Pentest Tools Framework
- Hack Tools Online
- Pentest Tools List
- Pentest Tools
- Hack Tools Github
- Pentest Tools Download
- Hack Tools For Games
- Hacker Tools List
- Termux Hacking Tools 2019
- Pentest Tools Free
0 comments:
Post a Comment