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
- Hacker Techniques Tools And Incident Handling
- Hack Tools Online
- Hacking Tools For Pc
- Pentest Tools Online
- Pentest Tools Website Vulnerability
- Hacker Tools For Pc
- Hack Tools Github
- Hacking Tools For Games
- Hacker
- Pentest Tools Find Subdomains
- Github Hacking Tools
- What Are Hacking Tools
- Hacker Tools Free
- Hacking Tools For Kali Linux
- Hacking Tools For Windows Free Download
- Hacking Tools Usb
- Hacking Tools And Software
- Hack Apps
- Hack Tools For Pc
- Hacker Tools Hardware
- Pentest Tools Subdomain
- Growth Hacker Tools
- Hacker Tools Apk
- Hacker Hardware Tools
- Hacking Tools Windows
- Underground Hacker Sites
- Hacking Tools Kit
- Hack Apps
- Hack Tools
- Pentest Automation Tools
- Pentest Tools Alternative
- Hack Tools For Mac
- Pentest Tools Apk
- Hacking Tools Kit
- Hacking Tools
- Hacking Tools For Games
- Hacking Tools For Windows 7
- Hacker Tools 2020
- Hack Tools 2019
- Pentest Tools
- Hacking Tools Name
- Pentest Tools For Ubuntu
- Hack And Tools
- Pentest Tools For Mac
- Hacker Tools 2020
- Pentest Box Tools Download
- Hacker Tools Linux
- Hacking Tools 2020
- Beginner Hacker Tools
- Hacker Tools For Ios
- Hack Tools For Games
- Pentest Tools Review
- Wifi Hacker Tools For Windows
- Hacking Tools
- Hacking Tools 2019
- Hacker Tools List
- Free Pentest Tools For Windows
- Hack Tools For Mac
- Hacker
- Hack Tools Github
- Pentest Tools Android
- Hack Tools
- Hacker Tools Hardware
- Hack Tools
- Pentest Tools Linux
- New Hacker Tools
- Pentest Tools List
- How To Hack
- Pentest Tools Website Vulnerability
- Nsa Hack Tools
- Hacker Security Tools
- Hacking Tools Online
- Pentest Tools Review
- Hacking Tools Github
- Physical Pentest Tools
- Hacking Tools Online
- Pentest Tools Bluekeep
- Hacking Tools For Games
- Pentest Tools Online
- Hacking Tools Hardware
- Hacking Tools Download
- Game Hacking
- Best Hacking Tools 2019
- Pentest Tools Subdomain
- Hack Tools 2019
- World No 1 Hacker Software
- Pentest Tools List
- Growth Hacker Tools
- Pentest Tools Tcp Port Scanner
- Hacking Tools Mac
- Hacking Tools Pc
- Hacker Search Tools
- Hacking Tools Free Download
- Pentest Tools Open Source
- Kik Hack Tools
- Easy Hack Tools
- Hack Tools Pc
- Pentest Tools Tcp Port Scanner
- Hack Tool Apk
- Hacking Tools For Games
- Pentest Tools Tcp Port Scanner
- Underground Hacker Sites
- Hacking Apps
- Hacker Tools For Pc
- How To Hack
- Hacking Tools For Mac
- Hacking Tools Windows
- Hacking Tools Software
- Black Hat Hacker Tools
- Hacking Tools For Pc
No comments:
Post a Comment