segunda-feira, 29 de maio de 2023

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 links


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

Nenhum comentário:

Postar um comentário