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
- Hack Tools Mac
- Hacker Tools Linux
- How To Make Hacking Tools
- Hack Tools Github
- Hacker Tools Hardware
- How To Install Pentest Tools In Ubuntu
- Install Pentest Tools Ubuntu
- Hacking Tools Mac
- How To Make Hacking Tools
- Pentest Tools Alternative
- Pentest Tools For Android
- Hackrf Tools
- Pentest Tools Bluekeep
- Hacker Tools
- Pentest Tools Find Subdomains
- Hacking Tools Online
- Growth Hacker Tools
- Hacking Tools
- Pentest Tools For Windows
- Hackers Toolbox
- Hackers Toolbox
- Pentest Tools Port Scanner
- Hacker Tools 2019
- Pentest Automation Tools
- Pentest Automation Tools
- Hacker Tools Software
- Hacker Tools 2020
- Computer Hacker
- Hacker Tools Free Download
- How To Install Pentest Tools In Ubuntu
- Bluetooth Hacking Tools Kali
- Hacker Tools
- Best Hacking Tools 2019
- Hacking Tools And Software
- Pentest Tools For Mac
- Hacking Tools For Windows Free Download
- Pentest Tools Port Scanner
- Hacking Tools Hardware
- Termux Hacking Tools 2019
- Tools 4 Hack
- Nsa Hacker Tools
- Hacking Tools Online
- Pentest Tools Online
- Hacker
- How To Hack
- Pentest Tools Download
- Pentest Tools Port Scanner
- Pentest Tools Open Source
- Pentest Tools Kali Linux
- Pentest Tools Subdomain
- Hacking Tools For Windows Free Download
- Hacking Tools Usb
- Pentest Tools For Android
- Hacker Tools 2020
- Pentest Tools Android
- Pentest Tools Android
- Hack Tool Apk No Root
- Pentest Tools Url Fuzzer
- Pentest Tools For Android
- Kik Hack Tools
- Hacking Tools Pc
- Hacker Tools Hardware
- How To Hack
- Hacking Apps
- Best Pentesting Tools 2018
- Pentest Tools For Android
- What Are Hacking Tools
- Kik Hack Tools
- Pentest Tools Bluekeep
- Hacking Tools Hardware
- Hacker Security Tools
- Pentest Tools Online
- Computer Hacker
- Tools Used For Hacking
- Pentest Tools Download
- Hack Tools For Ubuntu
- Hack Apps
- Hacking Tools For Pc
- Kik Hack Tools
- Hacker Tools Linux
- Hacker Tool Kit
- Pentest Tools For Windows
- Pentest Tools Android
- Pentest Recon Tools
- Hacker Tools Apk Download
- Hacks And Tools
- Pentest Recon Tools
- Hack And Tools
- Pentest Tools Framework
- Hack Apps
- Hacks And Tools
- Pentest Tools For Android
- Pentest Tools Url Fuzzer
- World No 1 Hacker Software
- Hacker Tools For Windows
- Termux Hacking Tools 2019
- Hacker Tools 2020
- Best Hacking Tools 2019
- Hacking Tools 2020
- Beginner Hacker Tools
- Hacking Tools Windows 10
- Pentest Tools Github
- Pentest Tools Website
- Hack Tools Download
- Pentest Tools Tcp Port Scanner
- Hacking Tools Software
- Hacking Tools For Windows 7
- Hack Apps
- Hack Tools For Games
- Hacking Tools
- Hacking Tools Software
- Hacking Tools Download
- Pentest Tools For Mac
- Pentest Tools Framework
- Hacker Hardware Tools
- Hacker Tools For Mac
No comments:
Post a Comment