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
- Hack Tool Apk
- Best Hacking Tools 2019
- Pentest Automation Tools
- Hacker Tools Free
- Pentest Tools Windows
- Nsa Hacker Tools
- Hack Tools Online
- Hacker Tools Hardware
- Hack Website Online Tool
- Hacker Tools For Mac
- Hacker Security Tools
- Pentest Tools Open Source
- Hack Tools
- Computer Hacker
- Hacking Tools Online
- Hackrf Tools
- Hacking Tools Download
- Hacking Tools Pc
- How To Make Hacking Tools
- Hack Tools Online
- Hack Tools 2019
- Hacker
- How To Install Pentest Tools In Ubuntu
- Pentest Reporting Tools
- Physical Pentest Tools
- Pentest Tools Subdomain
- Blackhat Hacker Tools
- Beginner Hacker Tools
- Nsa Hacker Tools
- Blackhat Hacker Tools
- New Hacker Tools
- Pentest Tools Kali Linux
- Bluetooth Hacking Tools Kali
- Computer Hacker
- Nsa Hacker Tools
- Pentest Tools Website
- New Hacker Tools
- Pentest Tools For Windows
- New Hack Tools
- What Are Hacking Tools
- Hacker Tools Windows
- Hacking Tools Name
- Termux Hacking Tools 2019
- Hacker Tools For Ios
- Pentest Tools Android
- Pentest Tools Apk
- Nsa Hack Tools Download
- Physical Pentest Tools
- Top Pentest Tools
- Hacker Tools 2020
- Hack App
- World No 1 Hacker Software
- Usb Pentest Tools
- Hacking Tools 2019
- Game Hacking
- Hackrf Tools
- Beginner Hacker Tools
- Hacking Tools 2020
- Hacker Tools List
- Hacking Tools Pc
- Pentest Tools Port Scanner
- Hacking Tools For Windows 7
- Termux Hacking Tools 2019
- Pentest Tools Framework
- Hackers Toolbox
- Hacking App
- Pentest Tools For Android
- Pentest Tools Find Subdomains
- Tools For Hacker
- Pentest Tools Nmap
- Hack Apps
- Hacking Tools For Mac
- Pentest Tools Review
- Hacker Tools 2020
- Hacking Tools Mac
- Hacking Tools Download
- Hacker Tools 2020
- Hack Tool Apk No Root
- Hack Tools Github
- Pentest Tools Alternative
- Hacker Security Tools
- Hacker Security Tools
- Usb Pentest Tools
- Hacker Tools
- Hacking Tools For Windows 7
- Pentest Recon Tools
- Hacking Apps
- How To Hack
- How To Hack
- World No 1 Hacker Software
- Pentest Tools Framework
- Hacking Tools 2019
- How To Make Hacking Tools
- Install Pentest Tools Ubuntu
- Best Pentesting Tools 2018
- Nsa Hacker Tools
- Termux Hacking Tools 2019
- Hack Tools For Windows
- Hack Website Online Tool
- Hack Tools Mac
- Hacking Tools Pc
- Pentest Tools Android
- Hack Apps
- Hack Tools Download
- Hack Tools Download
- Pentest Tools Android
- Hacking Tools Hardware
- Pentest Tools Url Fuzzer
- Hacking Tools
- Hacking Tools Mac
- Kik Hack Tools
- Pentest Tools Subdomain
- What Are Hacking Tools
- Hacks And Tools
- Game Hacking
- How To Make Hacking Tools
- World No 1 Hacker Software
- Hacking Tools Online
- Hack Website Online Tool
No comments:
Post a Comment