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
- Hack Tools Online
- Install Pentest Tools Ubuntu
- Hacking Tools For Kali Linux
- Pentest Reporting Tools
- New Hacker Tools
- Hacking Tools Pc
- Pentest Tools Framework
- Pentest Automation Tools
- Hack App
- Underground Hacker Sites
- Bluetooth Hacking Tools Kali
- Tools 4 Hack
- Github Hacking Tools
- Hacking Tools For Windows Free Download
- Pentest Recon Tools
- Pentest Tools For Windows
- Pentest Tools Windows
- Pentest Tools Free
- Usb Pentest Tools
- Physical Pentest Tools
- Hacker Tools List
- Kik Hack Tools
- Pentest Tools Find Subdomains
- Hackers Toolbox
- Hacker Tools Online
- Hacker Techniques Tools And Incident Handling
- Hacking Tools Pc
- Pentest Automation Tools
- Pentest Tools For Windows
- Free Pentest Tools For Windows
- How To Hack
- Hack Apps
- Pentest Box Tools Download
- Hacker Tools 2019
- Ethical Hacker Tools
- Computer Hacker
- Hacking Tools 2019
- Pentest Automation Tools
- Hak5 Tools
- Hack Rom Tools
- Hacking Tools For Windows
- Android Hack Tools Github
- Pentest Tools Android
- Hackrf Tools
- Hacker Tools 2020
- Pentest Tools Review
- Hacker Security Tools
- New Hack Tools
- Hacker Tools For Windows
- Hack Tools
- Black Hat Hacker Tools
- Hacker
- Game Hacking
- Hacker Tools Online
- Hack App
- Hacker Tools Windows
- Hacking Apps
- Computer Hacker
- Best Hacking Tools 2020
- Hack Tool Apk No Root
- World No 1 Hacker Software
- Hacker Tools For Windows
- Free Pentest Tools For Windows
- Hack Tools Mac
- Hacking Tools For Windows Free Download
- Pentest Tools Apk
- New Hacker Tools
- Game Hacking
- Hacking Tools For Kali Linux
- Hacking Tools Software
- Pentest Tools Android
- Hacking Tools Download
- Hacking Tools Free Download
- Pentest Tools
- Pentest Reporting Tools
- Hacking Tools Kit
- Pentest Recon Tools
- What Is Hacking Tools
- Pentest Tools Tcp Port Scanner
- Hack Tools
- Hacking Tools Free Download
- Tools 4 Hack
- Hack Tools
- Easy Hack Tools
- Best Pentesting Tools 2018
- Hacking Tools Name
- Pentest Tools Free
- Pentest Tools Bluekeep
- Game Hacking
- Pentest Tools Apk
- Hacker Tools
- Hacker Tools Apk Download
- Hacker Tools Software
- Beginner Hacker Tools
- Pentest Tools
- Hack Apps
- Pentest Tools Nmap
- Pentest Recon Tools
- Free Pentest Tools For Windows
- Hacking Tools For Windows
- Hacking Tools Pc
- Hacking Tools Hardware
- Hacking Tools For Windows
- Hacker Tools For Windows
- Pentest Reporting Tools
- Pentest Tools Bluekeep
- Hacking Tools Windows
- Hack Tools For Mac
- Hacker Tools Free
- Hak5 Tools
- Hacking Tools Kit
- How To Install Pentest Tools In Ubuntu
- Pentest Tools Windows
- Hacker Tools Free
- Black Hat Hacker Tools
- Hacker Tools
- Hack And Tools
- Hacking App
- Hacking Tools Windows 10
Sem comentários:
Enviar um comentário