Kamis, 27 Agustus 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 articles


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

Tidak ada komentar: