Welcome to My Blog

Exploiting Golang Unsafe Pointers

Thursday, 18 January 2024

Travel Dealer


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 news


  1. Pentest Tools For Ubuntu
  2. Pentest Tools Website
  3. Hack Rom Tools
  4. Wifi Hacker Tools For Windows
  5. Pentest Tools Online
  6. Hack Tools Online
  7. Hacker Tools For Ios
  8. Hacking Tools
  9. Hak5 Tools
  10. Hacking Tools For Windows 7
  11. Hacker Tools Software
  12. Hacking Tools Windows 10
  13. Bluetooth Hacking Tools Kali
  14. Hacking Tools Online
  15. Hackrf Tools
  16. Pentest Recon Tools
  17. How To Make Hacking Tools
  18. World No 1 Hacker Software
  19. Pentest Tools Nmap
  20. Hackers Toolbox
  21. Pentest Tools Website Vulnerability
  22. Pentest Tools For Ubuntu
  23. Top Pentest Tools
  24. Hacker Tools Apk
  25. Hack Tools For Games
  26. Wifi Hacker Tools For Windows
  27. Ethical Hacker Tools
  28. Pentest Tools Nmap
  29. Hacking Tools 2019
  30. Game Hacking
  31. Hacker Tools Software
  32. Tools Used For Hacking
  33. Pentest Tools Find Subdomains
  34. Hacker Tools For Ios
  35. Hacking Tools Hardware
  36. Best Pentesting Tools 2018
  37. Pentest Tools Review
  38. Hacker Tools For Pc
  39. Hacking Tools For Mac
  40. Hacking Tools Free Download
  41. Hacking Tools Github
  42. Hacker Tools 2020
  43. What Is Hacking Tools
  44. Top Pentest Tools
  45. Pentest Tools For Mac
  46. Hacking Tools Name
  47. Hack Tools For Mac
  48. Hacker Tool Kit
  49. Hacking Tools Software
  50. Pentest Tools Apk
  51. Hacking Tools 2020
  52. Hacking Tools Online
  53. Hack Tools Download
  54. Hacker Security Tools
  55. Pentest Tools Port Scanner
  56. Pentest Tools Apk
  57. Bluetooth Hacking Tools Kali
  58. Hack Tools Pc
  59. Hacking Tools For Windows
  60. Pentest Tools Nmap
  61. Game Hacking
  62. Usb Pentest Tools
  63. Hacking Tools Windows 10
  64. Hacker Tool Kit
  65. Pentest Tools Find Subdomains
  66. Pentest Tools Open Source
  67. Pentest Tools Nmap
  68. Pentest Tools Subdomain
  69. Hack Tools
  70. Computer Hacker
  71. Blackhat Hacker Tools
  72. Pentest Tools Github
  73. Hack Tools For Ubuntu
  74. Hack Tools For Pc
  75. Hack Tools Download
  76. Hacking Tools For Windows Free Download
  77. Pentest Tools Open Source
  78. Pentest Tools Review
  79. Tools Used For Hacking
  80. Hack Tools For Ubuntu
  81. Hacker Tools Mac
  82. Hacking Tools Online
  83. Hacker Tools For Ios
  84. Hack Website Online Tool
  85. Pentest Tools
  86. Hacks And Tools
  87. Hacker Techniques Tools And Incident Handling
  88. Hack Tools For Games
  89. Hacking Tools Github
  90. Hacker Tools 2019
  91. New Hacker Tools
  92. Hacker Tools 2020
  93. Pentest Tools Find Subdomains
  94. Best Hacking Tools 2020
  95. Kik Hack Tools
  96. Pentest Tools Website
  97. Pentest Tools Framework
  98. Kik Hack Tools
  99. Best Pentesting Tools 2018
  100. Hacker Tools Github
  101. Hackers Toolbox
  102. Hacker Tools For Mac
  103. Hacking Tools Software
  104. Pentest Tools For Windows
  105. Pentest Automation Tools
  106. Hacker Tools Free Download
  107. Hack Tool Apk
  108. Pentest Tools For Mac
  109. Install Pentest Tools Ubuntu
  110. How To Make Hacking Tools
  111. Hacker Tool Kit
  112. Pentest Recon Tools
  113. Hacking Tools For Pc
  114. Hack Tools For Mac
  115. Underground Hacker Sites
  116. Kik Hack Tools
  117. Hacker Search Tools
  118. Top Pentest Tools
  119. Best Hacking Tools 2020
  120. Top Pentest Tools
  121. Hack Tools Online
  122. Growth Hacker Tools
  123. Hack Tools For Windows
  124. Pentest Tools For Ubuntu
  125. Pentest Tools Website Vulnerability
  126. Hacking Tools Windows
  127. Hacking App
  128. Hacking Tools Free Download
  129. Usb Pentest Tools
  130. Pentest Tools Open Source
  131. Pentest Tools Download
  132. Hacker Tools Software
  133. Hacking Tools For Windows 7
  134. Pentest Tools For Android
  135. Tools For Hacker
  136. Free Pentest Tools For Windows
  137. Hacking Tools Free Download
  138. Hacking Tools For Windows Free Download
  139. Hacking Tools Online
  140. Nsa Hacker Tools
  141. Hacking Tools Hardware
  142. Hacker Tools 2019
  143. Hacking Tools For Pc
  144. Hacker Tools 2020
  145. Hacking Tools For Windows Free Download
  146. Hack Tools For Games
  147. Termux Hacking Tools 2019
  148. Hacker Tools Free Download
  149. Hacker Tools Apk
  150. Pentest Tools Github
  151. Nsa Hack Tools Download
  152. Hacker Tools Free
  153. Hacker Techniques Tools And Incident Handling

No comments:

Post a Comment