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

0 Comments:

Post a Comment

<< Home