Tuesday, August 25, 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)





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

No comments:

Post a Comment