Friday, August 28, 2020

Introduction To Reversing Golang Binaries


Golang binaries are a bit hard to analyze but there are some tricks to locate the things and view what is doing the code.






Is possible to list all the go files compiled in the binary even in an striped binaries, in this case we have only one file gohello.go this is a good clue to guess what is doing the program.


On stripped binaries the runtime functions are not resolved so is more difficult to locate the user algorithms:


If we start from the entry point, we will found this mess:

The golang string initialization are encoded and is not displayed on the strings window.


How to locate main?  if its not stripped just bp on [package name].main for example bp main.main, (you can locate the package-name searching strings with ".main")


And here is our main.main:


The code is:

So in a stripped binary we cant find the string "hello world" neither the initialization 0x1337 nor the comparator 0x1337, all this is obfuscated.

The initialization sequence is:


The procedure for locating main.main in stripped binaries is:
1. Click on the entry point and locate the runtime.mainPC pointer:



2. click on runtime.main function (LAB_0042B030):


3. locate the main.main call after the zero ifs:



4. click on it and here is the main:




The runtime is not obvious for example the fmt.Scanf() call perform several internal calls until reach the syscall, and in a stripped binary there are no function names.



In order to identify the functions one option is compile another binary with symbols and make function fingerprinting.

In Ghidra we have the script golang_renamer.py which is very useful:


After applying this plugin the main looks like more clear:




This script is an example of function fingerprinting, in this case all the opcodes are included on the crc hashing:
# This script fingerprints the functions
#@author: sha0coder
#@category fingerprinting

print "Fingerprinting..."

import zlib


# loop through program functions
function = getFirstFunction()
while function is not None:
name = str(function.getName())
entry = function.getEntryPoint()
body = function.getBody()
addresses = body.getAddresses(True)

if not addresses.hasNext():
# empty function
continue

ins = getInstructionAt(body.getMinAddress())
opcodes = ''
while ins and ins.getMinAddress() <= body.getMaxAddress():
for b in ins.bytes:
opcodes += chr(b & 0xff)
ins = getInstructionAfter(ins)
crchash = zlib.crc32(opcodes) & 0xffffffff

print name, hex(crchash)


function = getFunctionAfter(function)





More articles


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

No comments:

Post a Comment