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)





Related word

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

Sem comentários: