Saturday, May 27, 2023

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 information


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

No comments: