Exploiting Golang Unsafe Pointers
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 links
- Best Hacking Tools 2019
- Black Hat Hacker Tools
- Hacking Tools Name
- Hack App
- Game Hacking
- Hacks And Tools
- Hacker Tools Windows
- Pentest Reporting Tools
- Pentest Tools Open Source
- Android Hack Tools Github
- Pentest Tools Linux
- Tools 4 Hack
- Pentest Tools Website
- Pentest Tools Alternative
- Hacking Tools For Beginners
- Physical Pentest Tools
- Hacking Tools Online
- Hack Tools
- Hacker Tools Apk
- Hacking Tools Pc
- Hacking Apps
- Hack Tools Pc
- Hacker Tools For Pc
- Pentest Tools Windows
- What Are Hacking Tools
- Hacker Tools Mac
- Pentest Tools Subdomain
- Hack Tool Apk No Root
- Pentest Recon Tools
- Pentest Tools Linux
- Hacking Tools 2019
- What Are Hacking Tools
- Hacker Tools 2020
- Beginner Hacker Tools
- Pentest Tools Github
- Free Pentest Tools For Windows
- Hacker Tools For Pc
- Hack And Tools
- Hacker Security Tools
- Termux Hacking Tools 2019
- Pentest Tools Online
- Hacking Tools Free Download
- Easy Hack Tools
- Pentest Tools Kali Linux
- Pentest Tools Github
- Pentest Tools For Mac
- Hack Website Online Tool
- Pentest Tools For Windows
- Physical Pentest Tools
- Pentest Tools Subdomain
- Hacker Tools Online
- Pentest Box Tools Download
- Hacking Tools Kit
- Beginner Hacker Tools
- Hacking Tools 2019
- Hack Tools Pc
- Hack Tools For Windows
- Tools For Hacker
- Hacking Tools Windows
- Hacking Tools Name
- Hacker Hardware Tools
- Hacking Tools For Pc
- Pentest Tools Kali Linux
- Hacker Tools 2019
- Hackers Toolbox
- Android Hack Tools Github
- Top Pentest Tools
- Pentest Tools For Ubuntu
- Physical Pentest Tools
- Nsa Hack Tools
- Ethical Hacker Tools
- Tools 4 Hack
- Hack Tools Online
- Pentest Tools Linux
- Pentest Tools
- Pentest Reporting Tools
- Hacking Tools Download
- Hacker
- Hack Tools For Windows
- What Is Hacking Tools
- What Are Hacking Tools
- Hacker Hardware Tools
- Wifi Hacker Tools For Windows
- Physical Pentest Tools
- Pentest Tools Github
- Hacker Tools 2019
- Pentest Tools Linux
- Hacker Search Tools
- Hacker Tools Free
- Tools 4 Hack
- Pentest Tools Alternative
- What Is Hacking Tools
- Hacking App
- Growth Hacker Tools
- Hack Tools For Mac
- Hackrf Tools
- Pentest Tools Kali Linux
- Pentest Tools Website
- Hacker Tools 2020
- Hack Tools For Pc
- Hack Website Online Tool
- Pentest Tools Free
- Pentest Tools Tcp Port Scanner
- Hacks And Tools
- Hacking Tools Windows 10
- Wifi Hacker Tools For Windows
- Best Pentesting Tools 2018
- Hacker Tools For Windows
- Hacker Tools Online
- Pentest Tools For Windows
- Best Pentesting Tools 2018
- Kik Hack Tools
- Easy Hack Tools
- Hacking Tools Kit
- Hack Tools For Windows
- Pentest Tools
- Hacks And Tools
- Termux Hacking Tools 2019
- Hack Tools
- Hackers Toolbox
- Best Hacking Tools 2019
- Hacking Tools For Pc
- Hacking Tools For Windows 7
- Pentest Tools Website Vulnerability
- Hacker Tools For Ios
- Hacker Tools For Mac
- Hack Tools For Games
- Hacker Tools Software
- Ethical Hacker Tools
- Pentest Tools Kali Linux
- Hacker Tools Github
- Pentest Reporting Tools
- Hacking Tools For Games
- Beginner Hacker Tools
- Hacking Tools For Beginners
- Hacking Tools Online
- Pentest Tools Website Vulnerability
- Hacking Tools Download
- Hacker Tools 2019
- Pentest Tools For Mac
- Hacking Apps
- Hacker Tools Github
- Hack Rom Tools
- Pentest Tools Review
- Hacking Tools Usb
- Hacking Tools Hardware
- Growth Hacker Tools
- Hacker Tools Free Download
- Pentest Tools Free
- How To Install Pentest Tools In Ubuntu
- Pentest Box Tools Download
- Hacker Tools 2020
- Hacks And Tools
- Physical Pentest Tools
- Pentest Tools Subdomain
- Pentest Tools Download
- Pentest Box Tools Download
- Pentest Tools Subdomain
- Pentest Tools Github
- Pentest Reporting Tools
- Hacking Tools For Beginners
- Top Pentest Tools
- Hack Rom Tools
- Pentest Tools Download
- Hacks And Tools
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home