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
- Nsa Hack Tools Download
- Hacking Apps
- Pentest Tools For Mac
- Wifi Hacker Tools For Windows
- Beginner Hacker Tools
- Hacker
- Hacking Tools And Software
- Computer Hacker
- Pentest Tools Subdomain
- Pentest Tools
- How To Install Pentest Tools In Ubuntu
- Nsa Hack Tools
- Hacking Tools For Beginners
- Hack App
- Nsa Hack Tools Download
- Beginner Hacker Tools
- Hack Tools Github
- Black Hat Hacker Tools
- Hacker Tools Software
- Termux Hacking Tools 2019
- Hacking App
- Hacking Tools Download
- Pentest Tools Github
- Pentest Tools List
- Hack Tools For Games
- New Hack Tools
- Nsa Hack Tools Download
- World No 1 Hacker Software
- Pentest Tools
- Hacking Tools 2020
- Hacker Tools
- Hacker Tools Software
- Pentest Tools Windows
- Hacker Tools For Ios
- Hacking Tools Windows 10
- Hack Tools
- Hack Tools 2019
- Usb Pentest Tools
- Hacking Tools Free Download
- Pentest Tools Framework
- Hack Tools For Ubuntu
- Pentest Tools Tcp Port Scanner
- Hacking Tools Usb
- Hacking Tools Github
- Termux Hacking Tools 2019
- Beginner Hacker Tools
- Hacker Tools For Windows
- Pentest Recon Tools
- Android Hack Tools Github
- Hack Tools Mac
- New Hack Tools
- Pentest Tools Framework
- Hacking Apps
- Hacker Tools Free
- Physical Pentest Tools
- Hacker Tools
- Hacker Tools Github
- Hacking Tools Free Download
- Hack Tools
- Hack Tools Mac
- Pentest Tools Port Scanner
- Physical Pentest Tools
- Pentest Tools Android
- How To Make Hacking Tools
- Hacker Tools Mac
- Pentest Tools For Mac
- Hacking Tools For Beginners
- Hack Tools Github
- Ethical Hacker Tools
- Pentest Tools Framework
- Hacking Tools 2019
- Hacking Tools For Windows 7
- Hacking Tools For Pc
- Hak5 Tools
- Hacker Tools Free Download
- Computer Hacker
- Tools For Hacker
- Hack Tools Pc
- Hackrf Tools
- Hacking App
Tidak ada komentar:
Posting Komentar