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
- Hacks And Tools
- Physical Pentest Tools
- Bluetooth Hacking Tools Kali
- Hack And Tools
- Hack Tools For Windows
- Pentest Tools Port Scanner
- Pentest Tools Bluekeep
- Free Pentest Tools For Windows
- Underground Hacker Sites
- How To Make Hacking Tools
- Hacking Tools For Pc
- Termux Hacking Tools 2019
- Pentest Tools Android
- Pentest Tools Port Scanner
- Pentest Tools For Ubuntu
- Underground Hacker Sites
- Pentest Tools Find Subdomains
- Pentest Tools Nmap
- Hacker Tools Mac
- Hack Tools For Games
- Pentest Tools Alternative
- Pentest Tools Tcp Port Scanner
- Termux Hacking Tools 2019
- Top Pentest Tools
- Pentest Tools
- Android Hack Tools Github
- Pentest Tools For Ubuntu
- Hacker Tools Mac
- Pentest Tools Apk
- Hacker Tools Online
- Pentest Tools Open Source
- Hacker Tools Software
- Hacking Tools For Windows
- Hacker Hardware Tools
- Hack Tools For Mac
- Best Pentesting Tools 2018
- Github Hacking Tools
- Pentest Automation Tools
- Growth Hacker Tools
- Pentest Tools For Windows
- Bluetooth Hacking Tools Kali
- Hacking Tools For Games
- Hacker Tools Apk Download
- Best Hacking Tools 2020
- Hacking Tools Windows 10
- Kik Hack Tools
- Hack App
- Pentest Tools Find Subdomains
- Hacker Tools Apk
- Hack Tools For Pc
- Hack Tools For Games
- Github Hacking Tools
- Hacker Tools Free Download
- Pentest Reporting Tools
- Termux Hacking Tools 2019
- Hacking Tools For Windows Free Download
- Android Hack Tools Github
- Pentest Tools
- Pentest Tools Apk
- Kik Hack Tools
- Best Pentesting Tools 2018
- Hack Tools Pc
- Underground Hacker Sites
- Pentest Tools Bluekeep
- Hacking Tools Free Download
- Hacker Tool Kit
- Hacking Tools Windows 10
- Pentest Box Tools Download
- Pentest Tools For Windows
- Hacker Tools Mac
- Hacker Tools Github
- Game Hacking
- How To Hack
- Hacker Search Tools
- Bluetooth Hacking Tools Kali
- Hacker Tools Apk Download
- Install Pentest Tools Ubuntu
- Hacking Tools
- Pentest Tools Free
- Pentest Tools
- Hacker Tools 2019
- Hack Tools Online
- Pentest Tools Online
- Pentest Tools Find Subdomains
- Computer Hacker
- Hacker Tools Hardware
- Hacking Tools Name
- Hacking Tools Usb
- World No 1 Hacker Software
- Hackers Toolbox
- Hack Tools Mac
- Pentest Tools Kali Linux
- Blackhat Hacker Tools
- How To Hack
- Hacker Tool Kit
- Black Hat Hacker Tools
- Hacking Tools For Beginners
- Hack Tools For Ubuntu
- Pentest Tools Bluekeep
- Hacker Tools Apk Download
- Hack Tools Github
- Hack Tools For Mac
- Hacking Tools For Mac
- Hack Tool Apk
- Hacking Tools Usb
- Hacker Tools For Pc
- Hacker Tools For Mac
- Pentest Tools
- Pentest Tools Kali Linux
- How To Hack
- Hacker Hardware Tools
- Ethical Hacker Tools
- Hacker Tools Windows
- Hack Tools For Games
- Nsa Hack Tools Download
- Hack Apps
- Hacker Tools Apk
- Hacker Techniques Tools And Incident Handling
- Pentest Tools For Android
- Hack Tools For Games
- Hack Tools For Mac
- Install Pentest Tools Ubuntu
No comments:
Post a Comment