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 posts
- Hacker Tools For Mac
- Nsa Hacker Tools
- Pentest Tools List
- Best Pentesting Tools 2018
- Hacker Tools Free Download
- Hacking Tools Name
- Hacker Tools For Ios
- Hack Tool Apk No Root
- Bluetooth Hacking Tools Kali
- Hacker Tools Hardware
- Install Pentest Tools Ubuntu
- Hacking Tools For Windows 7
- Hacking Tools 2019
- Hacking Tools Download
- Hacking Tools For Mac
- Hacker Tool Kit
- Hacking Tools Pc
- Hack Tools Github
- Computer Hacker
- Pentest Tools For Ubuntu
- Hack Tool Apk No Root
- Pentest Tools Port Scanner
- Growth Hacker Tools
- Hack Tools For Mac
- Hacking Tools For Games
- Pentest Tools
- Hack Tools Download
- Hacker Tools Github
- Ethical Hacker Tools
- Pentest Tools Tcp Port Scanner
- Hack Tools For Pc
- Wifi Hacker Tools For Windows
- Pentest Tools Framework
- Hacker Tools Linux
- Pentest Tools Find Subdomains
- Pentest Tools Tcp Port Scanner
- Blackhat Hacker Tools
- Easy Hack Tools
- Pentest Tools Bluekeep
- Hacker Tools Github
- Hack Tools For Games
- New Hacker Tools
- Hack Tools For Ubuntu
- Hacking Tools Windows 10
- Hack Tool Apk No Root
- Hacker Tools Online
- Hack Tool Apk No Root
- Black Hat Hacker Tools
- Hacking Tools Windows
- Ethical Hacker Tools
- Hackrf Tools
- Nsa Hacker Tools
- Pentest Tools
- Hack Tools For Games
- Hacking Tools 2019
- Hacking Tools Download
- Hacking App
- Hacking Tools And Software
- Pentest Tools Online
- Hacker Search Tools
- How To Install Pentest Tools In Ubuntu
- Free Pentest Tools For Windows
- Termux Hacking Tools 2019
- Hacker Tools For Mac
- Hacking Tools Kit
- Hacker Tools Github
- Hack Tools
- Hack Rom Tools
- Nsa Hacker Tools
- Hack Website Online Tool
- New Hacker Tools
- Hacking Tools Kit
- New Hack Tools
- Hack Tools 2019
- New Hacker Tools
- Pentest Tools Find Subdomains
- Hack Website Online Tool
- Hack Tools For Mac
- Best Hacking Tools 2020
- Hacking Tools Windows
- Hacking Tools Hardware
- Ethical Hacker Tools
- Hacking Tools 2019
- Hack Tools Pc
- Nsa Hack Tools
- Hacker Tools Mac
- Pentest Tools Open Source
- Hacking Tools Software
- Hacking Tools 2020
- Hack And Tools
- Hacking App
- Hack Tools
- Hacking Tools For Kali Linux
- Hacking Tools For Windows 7
- Hacker Tools Apk Download
- Hacker Tools Software
- Hackrf Tools
- Hacking Apps
- Pentest Tools List
- Hacker Tools Apk Download
- Pentest Tools Github
- Game Hacking
- Hack Tool Apk No Root
- Hack Tools Mac
- Hacking Tools Free Download
- Hacker Tools Online
- Pentest Tools Website
- Hacking Tools For Beginners
- Ethical Hacker Tools
- Pentest Box Tools Download
- Pentest Tools Tcp Port Scanner
- Hack Tools
- Easy Hack Tools
- Hack Tools Mac
- Hak5 Tools
- Hacking Tools For Windows Free Download
- Underground Hacker Sites
- Pentest Tools Website
- Hackers Toolbox
- Hack Tools For Windows
- Hack Tools Online
- Hacker
- Hacking Tools For Mac
- Pentest Tools Website Vulnerability
- Hack Tools For Mac
- Hack Tool Apk No Root
- Pentest Tools Find Subdomains
- Pentest Tools Download
- Best Hacking Tools 2019
- Blackhat Hacker Tools
No comments:
Post a Comment