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 information
- Pentest Tools
- Hacking Tools Free Download
- Hack Tool Apk No Root
- Pentest Tools Download
- Nsa Hacker Tools
- Hacking Tools Online
- Hacker Tools Free Download
- Nsa Hacker Tools
- Hacker Hardware Tools
- Hack Tools Pc
- What Are Hacking Tools
- Hacking Tools
- Pentest Tools Alternative
- Growth Hacker Tools
- Nsa Hack Tools Download
- Hacking Tools For Windows 7
- Hacker Techniques Tools And Incident Handling
- Hacking Tools Hardware
- Hacking Tools For Pc
- Hacking Tools Free Download
- Pentest Tools Subdomain
- Pentest Tools Find Subdomains
- Pentest Tools Tcp Port Scanner
- Hacker Tools For Pc
- Hacker Tools Linux
- Hack App
- Nsa Hack Tools Download
- Android Hack Tools Github
- Hackers Toolbox
- Hacking Tools For Windows 7
- Underground Hacker Sites
- Hack Apps
- Hack Tools For Mac
- Pentest Tools Linux
- Hacker Hardware Tools
- Hacker Hardware Tools
- Hacker Tools Online
- Hack Tools
- Kik Hack Tools
- Hacker Tools Free Download
- Hackrf Tools
- Pentest Tools Website
- World No 1 Hacker Software
- Hackrf Tools
- Hacker Tools 2019
- Hack Tools
- Black Hat Hacker Tools
- Hack Tools For Mac
- Hacking Tools Windows 10
- Hacking Tools For Mac
- Pentest Tools Website Vulnerability
- Hacker Techniques Tools And Incident Handling
- Hack Tools Online
- Hack Tools For Games
- Hacking Tools Name
- Hacker Tools Online
- Nsa Hacker Tools
- Pentest Tools For Windows
- Hacking Tools For Games
- Pentest Tools Android
- Pentest Tools Online
- Hacker Tools 2019
- Best Hacking Tools 2019
- Hacker Tools Windows
- Hacking Tools
- Pentest Tools Subdomain
- Pentest Reporting Tools
- Hack Tool Apk No Root
- Hacking App
- Pentest Tools Subdomain
- Pentest Tools Windows
- Hacking Tools Windows
- Hacking Tools For Pc
- Hacker Tools For Ios
- Pentest Tools Bluekeep
- Hack Tools Pc
- Pentest Tools For Ubuntu
- Hacker Tools
- Pentest Tools Apk
- Hacker Tools Linux
- Hacker Search Tools
- Hack Tools For Games
- Hacking Tools
- Pentest Tools Windows
- Pentest Tools Subdomain
- Pentest Tools Apk
- Pentest Tools Open Source
- Hack Tools
- Pentest Tools Alternative
- Pentest Tools List
- Hack Tools For Pc
- Hack And Tools
No comments:
Post a Comment