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

No comments:

Post a Comment