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.
More information
- Pentest Tools Online
- Hacking Tools Name
- Github Hacking Tools
- Pentest Tools Apk
- Pentest Tools For Android
- Pentest Box Tools Download
- Computer Hacker
- Hack Website Online Tool
- Growth Hacker Tools
- Nsa Hacker Tools
- Pentest Tools Website
- Hacking App
- Tools Used For Hacking
- Pentest Tools Windows
- Hacking Tools For Windows
- Hacker Tools Online
- Free Pentest Tools For Windows
- Pentest Tools Port Scanner
- Pentest Tools Windows
- Pentest Tools Framework
- Pentest Tools For Ubuntu
- Hacking Tools For Windows
- What Are Hacking Tools
- How To Make Hacking Tools
- Hack Tools Download
- Hacking Tools 2020
- How To Hack
- Hack Tool Apk No Root
- Hacking Tools For Windows
- Kik Hack Tools
- Best Hacking Tools 2019
- Hack Tools Online
- How To Make Hacking Tools
- Pentest Tools Port Scanner
- New Hack Tools
- Termux Hacking Tools 2019
- Pentest Tools For Windows
- Hacker Tools Online
- Hack Tool Apk No Root
- Pentest Tools Online
- Hacker Tools Windows
- Pentest Tools Framework
- Black Hat Hacker Tools
- Hacking Tools For Games
- Nsa Hack Tools Download
- Hack Tool Apk No Root
- Hacker Tools 2020
- Kik Hack Tools
- Hack And Tools
- Pentest Tools For Windows
- Hack Tools Pc
- Hacking Tools Github
- Pentest Tools Nmap
- Hacker Tools Software
- Hack Tools
- Hacking Tools Name
- How To Hack
- Install Pentest Tools Ubuntu
- Hacker Tools
- Hacker Tools Software
- Black Hat Hacker Tools
- Hacking Tools Hardware
- Tools For Hacker
- Pentest Tools Alternative
- Hacking Tools Windows
- How To Install Pentest Tools In Ubuntu
- Hacker Tools
- Pentest Tools
- Underground Hacker Sites
- What Are Hacking Tools
- Pentest Tools
- Hacking Tools Free Download
- Free Pentest Tools For Windows
- Hack Tools Download
- Hack Tools Pc
- Hack App
- Termux Hacking Tools 2019
- Hacking Tools Download
0 Comments:
Publicar un comentario
<< Home