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 posts
- Hacking Tools For Pc
- World No 1 Hacker Software
- Hacker Tools Linux
- Android Hack Tools Github
- Hacker Tools Apk
- Hackrf Tools
- Hack Apps
- How To Hack
- Pentest Tools Port Scanner
- Hacker Tools Online
- New Hacker Tools
- Bluetooth Hacking Tools Kali
- Pentest Tools Tcp Port Scanner
- Hack Website Online Tool
- Hack Tool Apk
- Hack Tools Mac
- Hacker Tools Apk Download
- Nsa Hacker Tools
- Hack Tools Github
- Nsa Hack Tools
- Physical Pentest Tools
- Hacking Tools Usb
- Hacking Tools For Windows Free Download
- Pentest Tools Alternative
- Hacking Tools For Windows
- Hacker Tools Mac
- Hacking Tools Name
- Pentest Automation Tools
- Hack Tools Download
- Pentest Tools Online
- Pentest Recon Tools
- Hacking Tools For Games
- Pentest Tools
- Hacking Tools Name
- Pentest Tools For Ubuntu
- Hacking Tools Windows 10
- Hack Tools
- Hacking Tools Kit
- Kik Hack Tools
- Install Pentest Tools Ubuntu
- Hacking Tools For Pc
- Pentest Tools Url Fuzzer
- Hacker Tools Hardware
- Blackhat Hacker Tools
- Hacker Tools Windows
- Pentest Tools Github
- World No 1 Hacker Software
- Pentest Tools Bluekeep
- Pentest Tools Bluekeep
- Hacking Tools For Windows 7
- Hack Rom Tools
- Hack Tools For Ubuntu
- Hacking Apps
- Termux Hacking Tools 2019
- Hacking Tools For Kali Linux
- Physical Pentest Tools
- Bluetooth Hacking Tools Kali
- Hackrf Tools
- Hacking Tools 2020
- Beginner Hacker Tools
- Hacker Tools 2020
- Best Pentesting Tools 2018
- What Is Hacking Tools
- Github Hacking Tools
- Pentest Tools Linux
- Kik Hack Tools
- Hacking Tools And Software
- What Is Hacking Tools
- Install Pentest Tools Ubuntu
- Hacking Tools Software
- Pentest Tools Url Fuzzer
- Hacker
- Pentest Tools Github
- What Are Hacking Tools
- Hack Tools
- Pentest Reporting Tools
- Hack Tools For Mac
- Hacker Tools Apk
- Best Pentesting Tools 2018
- Hack Tools Pc
- New Hacker Tools
- Pentest Tools Framework
- Hack Tools
- Growth Hacker Tools
- Beginner Hacker Tools
- Hacking Tools Mac
- Hacking Tools Hardware
- Hack Tools Mac
- Hack Tools For Pc
- Hacking Tools 2019
- Pentest Tools Nmap
- Hacking Tools Mac
- Hack Tools For Pc
- Hack Tools For Games
- Hack Tools For Ubuntu
- Pentest Tools Port Scanner
- Best Hacking Tools 2020
- Pentest Tools For Mac
- Pentest Tools Apk
- Underground Hacker Sites
- Ethical Hacker Tools
- Pentest Tools Framework
- Pentest Tools Find Subdomains
- Best Hacking Tools 2020
- Pentest Tools For Android
- Hack Tools
- Hacker Tools Apk
- Kik Hack Tools
- Hacker Tools 2020
- What Is Hacking Tools
- Pentest Tools For Windows
- Pentest Tools Website Vulnerability
- Github Hacking Tools
- Pentest Tools Alternative
- Pentest Box Tools Download
- Pentest Tools Apk
- Hak5 Tools
- Tools For Hacker
- Hacking Tools Usb
- Hacker Security Tools
- Termux Hacking Tools 2019
- Hacks And Tools
- Hacking Tools Online
- Hack Tools Download
- Hacker Techniques Tools And Incident Handling
- Pentest Tools List
- Pentest Tools Subdomain
- Hack Tools Online
- Hack Tools Pc
- Top Pentest Tools
No comments:
Post a Comment