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)





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

No hay comentarios:

Publicar un comentario