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
- Hacking Tools For Windows
- Hacking Tools 2019
- Hack Tools For Windows
- Nsa Hacker Tools
- Hack Tools Online
- Pentest Tools Port Scanner
- Hacking Tools Kit
- Hak5 Tools
- Physical Pentest Tools
- Hacker Tools List
- Hack Tools 2019
- Hacker Tools Hardware
- Hacker Tools Hardware
- Hacking Tools For Windows Free Download
- Nsa Hacker Tools
- Hacking Tools 2019
- Install Pentest Tools Ubuntu
- Physical Pentest Tools
- New Hack Tools
- Pentest Tools Port Scanner
- Black Hat Hacker Tools
- Pentest Tools For Windows
- Termux Hacking Tools 2019
- Hacking Tools 2020
- Pentest Tools Subdomain
- Hacker Tools 2020
- Hacker Tools
- Pentest Tools Bluekeep
- Tools 4 Hack
- Pentest Tools For Ubuntu
- Hacker Tools For Pc
- Hacking App
- What Is Hacking Tools
- Best Hacking Tools 2019
- Computer Hacker
- Hacker Tools 2020
- Hacker Tools Mac
- Pentest Tools Linux
- Hack Tools Pc
- Hacker Tools Free
- Hackers Toolbox
- Hacking Tools And Software
- Hacker Tools Apk Download
- Hack Tools For Ubuntu
- Hacker Tools Online
- New Hack Tools
- Pentest Box Tools Download
- Nsa Hack Tools
- Pentest Tools Framework
- Hacking Tools Github
- Hacker
- Android Hack Tools Github
- Hacker Tools Software
- Hack Tools Online
- Hacking Tools Pc
- Hacker Security Tools
- Pentest Tools Windows
- Pentest Tools Tcp Port Scanner
- Pentest Tools Bluekeep
- Hack Tools For Pc
- Kik Hack Tools
- Hack Tools
- Hacker Search Tools
- Hacker Tools Mac
- Pentest Tools Kali Linux
- Hacker Tools For Mac
- Hacker Tools Github
- Hacking Apps
- Hack Apps
- Hacking Tools
- Hack Rom Tools
- Hacker Tools 2020
- Termux Hacking Tools 2019
- Hacking Tools Name
- How To Hack
- Hacker Search Tools
- Hack Tools
- Android Hack Tools Github
- Pentest Automation Tools
- Hackers Toolbox
- Best Pentesting Tools 2018
- Hacking Apps
- Physical Pentest Tools
- Hacking Tools Name
- Hacker Hardware Tools
- Pentest Tools Website
- Hacking Tools Software
- Top Pentest Tools
- Hacker Search Tools
- Ethical Hacker Tools
- Top Pentest Tools
- Hack Website Online Tool
- Github Hacking Tools
- Pentest Tools For Windows
- Hacker
- Pentest Tools Tcp Port Scanner
- Hacks And Tools
- Hack Tools For Games
- What Is Hacking Tools
- Hacker Tools Apk Download
- Hacker Tools Apk
- Hacker Tools
- Pentest Reporting Tools
- Hacker Tools Online
- Hacker Tools Apk Download
- Hacking Tools For Games
- Hacking Tools For Games
- Hack Tools
- How To Install Pentest Tools In Ubuntu
- Pentest Tools Open Source
- Hacking Tools Kit
- Hacking Tools Windows
- Pentest Tools Bluekeep
- Hacker Tools Github
- Hackers Toolbox
- Pentest Tools Alternative
- Pentest Tools For Ubuntu
- Hack Website Online Tool
- Hackrf Tools
- Termux Hacking Tools 2019
- Wifi Hacker Tools For Windows
- Pentest Tools Port Scanner
- How To Install Pentest Tools In Ubuntu
- Hack Tools
- Hacking Tools Name
- Hack Tools For Games
- Best Hacking Tools 2019
- Hacker Security Tools
- Hacker Tools Free
- Hacking Tools 2019
- Free Pentest Tools For Windows
- Hacker Tools For Mac
- Hacking Tools For Kali Linux
- Best Hacking Tools 2020
- Termux Hacking Tools 2019
- Nsa Hack Tools Download
- How To Hack
- Hacking Tools Windows
- Hacks And Tools
- Hacker Tools Free Download
- Hacking Tools For Pc
- Hacking Tools Mac
- Hacker Techniques Tools And Incident Handling
- Hacking Tools For Windows 7
- Tools For Hacker
- Usb Pentest Tools
- Usb Pentest Tools
- Hack Apps
- Pentest Tools List
- How To Hack
0 Commenti:
Posta un commento
Iscriviti a Commenti sul post [Atom]
<< Home page