jueves, 18 de enero de 2024

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

No hay comentarios:

Publicar un comentario