sábado, 22 de agosto de 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)





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

Nenhum comentário:

Postar um comentário