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 news
- Hacking Tools For Windows
- How To Install Pentest Tools In Ubuntu
- Hacker Tool Kit
- Hacker Tools List
- Hack Tools Github
- Hacker Tools For Pc
- Hacker Tools 2020
- Hacking Tools For Windows Free Download
- Pentest Tools Tcp Port Scanner
- Pentest Tools For Mac
- Hacker Techniques Tools And Incident Handling
- Tools Used For Hacking
- Tools Used For Hacking
- Hacker Tools Apk Download
- Pentest Tools Bluekeep
- Hacker Tools For Ios
- Pentest Tools Bluekeep
- Hacker Tools Linux
- Pentest Tools Nmap
- Hacking Tools For Mac
- Pentest Tools Github
- Hacker Tools For Pc
- Hack Tools For Pc
- Hack Tools Download
- Hack Tools For Windows
- Hacker Tools For Ios
- Hacking Tools Github
- Hacking Tools And Software
- Hacker Tools 2019
- Termux Hacking Tools 2019
- What Are Hacking Tools
- Hack Tools 2019
- Hack Tools Mac
- New Hacker Tools
- Hack App
- Pentest Tools Website
- Usb Pentest Tools
- Hacker Tools 2019
- Game Hacking
- Pentest Tools Bluekeep
- Hacker Tools 2020
- Hack Tools Mac
- Pentest Tools List
- Best Pentesting Tools 2018
- Pentest Tools Bluekeep
- Pentest Tools Website
- How To Hack
- Hacking Tools Usb
- Pentest Tools Review
- Game Hacking
- Hack Tools
- Hacking Tools 2019
- World No 1 Hacker Software
- Hacking Tools For Games
- Hak5 Tools
- Pentest Automation Tools
- Hacking Tools For Kali Linux
- Hacking Tools Kit
- Top Pentest Tools
- Hacking Tools Software
- Hacking Tools Windows
- Blackhat Hacker Tools
- Hacking Tools And Software
- Hacking Tools For Games
- Hacking Tools 2020
- Android Hack Tools Github
- Pentest Tools Find Subdomains
- Pentest Tools Free
- Usb Pentest Tools
- Hacker Tools 2019
- Hackers Toolbox
- Top Pentest Tools
- Hacker Tools Online
- Pentest Tools Nmap
- Pentest Tools Review
- Hacker Tools For Windows
- Pentest Tools Github
- Pentest Tools Bluekeep
- Hack Tools
- Hack Tools
- Hacking Tools And Software
- Pentest Tools For Ubuntu
- Physical Pentest Tools
- Pentest Tools Find Subdomains
- Pentest Tools Nmap
- Hack Apps
- Hack App
- Hack Tool Apk
- Pentest Tools Framework
- Hacking Tools Free Download
- Hacker Tools Software
- Hacker Tools Windows
- Hacking Tools For Mac
- Pentest Tools Review
- Hack Tools For Windows
- Hacker Tool Kit
- Hack Tools Online
- Hack Tools Download
- Hacker Tools Github
- Hacking Tools Hardware
- Physical Pentest Tools
- Hackers Toolbox
- Hack Tools 2019
- Blackhat Hacker Tools
- Pentest Automation Tools
- Pentest Tools Tcp Port Scanner
- New Hack Tools
- Hack App
- Usb Pentest Tools
- Android Hack Tools Github
- Hacking Tools Github
- Hacking Tools Usb
- Hacker Tools Apk
- Hack Tools
- Pentest Tools Open Source
- Hacker Tools List
- Hack App
- Hacker Security Tools
- Free Pentest Tools For Windows
- Pentest Tools Website
- Hack Tools
- Top Pentest Tools
- Hacks And Tools
- Hacks And Tools
- Hacking Tools Windows
- Hacking Tools
- Hacker Tool Kit
- Pentest Recon Tools
- Pentest Tools Review
- Pentest Tools For Mac
- Hacker Security Tools
- Hack Rom Tools
- Best Hacking Tools 2019
- Hacking Tools 2019
- Hacker Tools For Ios
- Hacker Tools Free
- How To Make Hacking Tools
- Hacking Tools Mac
- Hacker Tools Apk Download
- Hacker Security Tools
- Pentest Automation Tools
- Hacker Tools Free Download
0 Comments:
Post a Comment
<< Home