segunda-feira, 31 de agosto de 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 links


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

Nenhum comentário:

Postar um comentário