Welcome to My Blog

Introduction To Reversing Golang Binaries

Thursday 27 August 2020

Travel Dealer


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. Nsa Hack Tools Download
  2. Hack Tools 2019
  3. Hack Website Online Tool
  4. Hacker Tools 2020
  5. Nsa Hack Tools
  6. Hacking Tools Software
  7. Pentest Tools
  8. Hacking Tools Pc
  9. Hacker Tools For Windows
  10. Hacker Security Tools
  11. New Hack Tools
  12. Hacker Tool Kit
  13. Hack And Tools
  14. Hacking Tools 2020
  15. Pentest Tools Linux
  16. Hacking Tools For Kali Linux
  17. Hack Website Online Tool
  18. Pentest Tools Port Scanner
  19. Growth Hacker Tools
  20. Hack Tools
  21. Pentest Tools For Windows
  22. Hacking Tools For Pc
  23. Pentest Automation Tools
  24. Hack Website Online Tool
  25. What Are Hacking Tools
  26. Install Pentest Tools Ubuntu
  27. Hacker Tools Apk Download
  28. Top Pentest Tools
  29. Ethical Hacker Tools
  30. Hack Apps
  31. What Are Hacking Tools
  32. Nsa Hack Tools Download
  33. Nsa Hacker Tools
  34. Hacker Techniques Tools And Incident Handling
  35. Kik Hack Tools
  36. Hacker Hardware Tools
  37. How To Install Pentest Tools In Ubuntu
  38. Best Pentesting Tools 2018
  39. Hacking Tools For Beginners
  40. Nsa Hacker Tools
  41. Pentest Tools List
  42. Hacker Tools Online
  43. Blackhat Hacker Tools
  44. Hacking Tools For Windows 7
  45. What Are Hacking Tools
  46. Pentest Recon Tools
  47. Hacker Techniques Tools And Incident Handling
  48. Hak5 Tools
  49. Hack Tools Pc
  50. Hacker Hardware Tools
  51. Game Hacking
  52. Hacking Tools For Pc
  53. Top Pentest Tools
  54. Computer Hacker
  55. Pentest Tools Apk
  56. Hacking Tools Windows
  57. Hacker Tools For Ios
  58. Pentest Tools Subdomain
  59. Pentest Tools Port Scanner
  60. Pentest Tools Windows
  61. Hacking Tools 2020
  62. Hacking Tools And Software
  63. Nsa Hack Tools Download
  64. Pentest Automation Tools
  65. Physical Pentest Tools
  66. Pentest Tools
  67. Hacks And Tools
  68. Hack Tools Pc
  69. Hackrf Tools
  70. Hacking Tools And Software
  71. Hacking Tools Github
  72. Hack Tools
  73. Hacking Tools For Pc
  74. Hacking Tools And Software
  75. Underground Hacker Sites
  76. Hacker Tools For Ios
  77. Hacking Tools
  78. Pentest Tools Bluekeep
  79. Hack Tools For Windows
  80. Pentest Tools Find Subdomains
  81. Pentest Recon Tools
  82. Hacking Tools For Windows
  83. Hacking Tools Online
  84. Hacking Tools And Software
  85. Tools For Hacker

No comments:

Post a Comment