Sunday, August 30, 2020

inBINcible Writeup - Golang Binary Reversing

This file is an 32bits elf binary, compiled from go language (i guess ... coded by @nibble_ds ;)
The binary has some debugging symbols, which is very helpful to locate the functions and api calls.

GO source functions:
-  main.main
-  main.function.001

If the binary is executed with no params, it prints "Nope!", the bad guy message.

~/ncn$ ./inbincible 
Nope!

Decompiling the main.main function I saw two things:

1. The Argument validation: Only one 16 bytes long argument is needed, otherwise the execution is finished.

2. The key IF, the decision to dexor and print byte by byte the "Nope!" string OR dexor and print "Yeah!"


The incoming channel will determine the final message.


Dexor and print each byte of the "Nope!" message.


This IF, checks 16 times if the go channel reception value is 0x01, in this case the app show the "Yeah!" message.

Go channels are a kind of thread-safe queue, a channel_send is like a push, and channel_receive is like a pop.

If we fake this IF the 16 times, we got the "Yeah!" message:

(gdb) b *0x8049118
(gdb) commands
>set {char *}0xf7edeef3 = 0x01
>c
>end

(gdb) r 1234567890123456
tarting program: /home/sha0/ncn/inbincible 1234567890123456
...
Yeah!


Ok, but the problem is not in main.main, is main.function.001 who must sent the 0x01 via channel.
This function xors byte by byte the input "1234567890123456" with a byte array xor key, and is compared with another byte array.

=> 0x8049456:       xor    %ebp,%ecx
This xor,  encode the argument with a key byte by byte

The xor key can be dumped from memory but I prefer to use this macro:

(gdb) b *0x8049456
(gdb) commands
>i r  ecx
>c
>end
(gdb) c

Breakpoint 2, 0x08049456 in main.func ()
ecx            0x12 18

Breakpoint 2, 0x08049456 in main.func ()
ecx            0x45 69

Breakpoint 2, 0x08049456 in main.func ()
ecx            0x33 51

Breakpoint 2, 0x08049456 in main.func ()
ecx            0x87 135

Breakpoint 2, 0x08049456 in main.func ()
ecx            0x65 101

Breakpoint 2, 0x08049456 in main.func ()
ecx            0x12 18

Breakpoint 2, 0x08049456 in main.func ()
ecx            0x45 69

Breakpoint 2, 0x08049456 in main.func ()
ecx            0x33 51

Breakpoint 2, 0x08049456 in main.func ()
ecx            0x87 135

Breakpoint 2, 0x08049456 in main.func ()
ecx            0x65 101

Breakpoint 2, 0x08049456 in main.func ()
ecx            0x12 18

Breakpoint 2, 0x08049456 in main.func ()
ecx            0x45 69

Breakpoint 2, 0x08049456 in main.func ()
ecx            0x33 51

Breakpoint 2, 0x08049456 in main.func ()
ecx            0x87 135

Breakpoint 2, 0x08049456 in main.func ()
ecx            0x65 101

Breakpoint 2, 0x08049456 in main.func ()
ecx            0x12 18

The result of the xor will compared with another array byte,  each byte matched, a 0x01 will be sent.

The cmp of the xored argument byte,
will determine if the channel send 0 or 1


(gdb) b *0x0804946a
(gdb) commands
>i r al
>c
>end

At this point we have the byte array used to xor the argument, and the byte array to be compared with, if we provide an input that xored with the first byte array gets the second byte array, the code will send 0x01 by the channel the 16 times.


Now web have:

xorKey=[0x12,0x45,0x33,0x87,0x65,0x12,0x45,0x33,0x87,0x65,0x12,0x45,0x33,0x87,0x65,0x12]

mustGive=[0x55,0x75,0x44,0xb6,0x0b,0x33,0x06,0x03,0xe9,0x02,0x60,0x71,0x47,0xb2,0x44,0x33]


Xor is reversible, then we can get the input needed to dexor to the expected values in order to send 0x1 bytes through the go channel.

>>> x=''
>>> for i in range(len(xorKey)):
...     x+= chr(xorKey[i] ^ mustGive[i])
... 
>>> print x

G0w1n!C0ngr4t5!!


And that's the key :) let's try it:

~/ncn$ ./inbincible 'G0w1n!C0ngr4t5!!'
Yeah!

Got it!! thanx @nibble_ds for this funny crackme, programmed in the great go language. I'm also a golang lover.


More articles
  1. Hacking Tools Free Download
  2. Black Hat Hacker Tools
  3. Hacker Security Tools
  4. Hacking Tools Free Download
  5. Hacker Tools 2019
  6. Hacking Tools Mac
  7. Pentest Tools Website Vulnerability
  8. Beginner Hacker Tools
  9. Bluetooth Hacking Tools Kali
  10. Pentest Tools Download
  11. Hacking Tools For Windows 7
  12. Hack And Tools
  13. Hacking Tools Usb
  14. Hacking Tools For Windows 7
  15. Pentest Tools Open Source
  16. Hacking Tools Windows 10
  17. Hack Tools 2019
  18. Hacking Tools For Beginners
  19. Pentest Tools
  20. Hacker Techniques Tools And Incident Handling
  21. Hacking Tools For Pc
  22. Hacking Apps
  23. Physical Pentest Tools
  24. Hack Tools 2019
  25. Free Pentest Tools For Windows
  26. Hacker Tools For Ios
  27. Pentest Tools Android
  28. Hack Tools For Windows
  29. What Is Hacking Tools
  30. Hacker Tools Online
  31. Hack Tools Online
  32. Hacker Tools Free
  33. Hacks And Tools
  34. Hacker Security Tools
  35. Hack App
  36. Hacker Tools For Windows
  37. Pentest Tools Download
  38. Tools For Hacker
  39. Hacker Tools
  40. Hacker Tools 2020
  41. Pentest Tools Github
  42. Hacking Tools Online
  43. Hack Tools Mac
  44. Pentest Tools Subdomain
  45. Hacker Hardware Tools
  46. Pentest Tools Alternative
  47. Tools Used For Hacking
  48. Hack App
  49. Pentest Tools Github
  50. How To Install Pentest Tools In Ubuntu
  51. Hacker Tools Windows
  52. Hacker Tools Free
  53. Hack App
  54. Hacking Tools For Beginners
  55. Hacker Tools Linux
  56. Hacks And Tools
  57. Beginner Hacker Tools
  58. Underground Hacker Sites
  59. Hack Tools Download
  60. Hacker Tools Free
  61. Hacker Tools Apk Download
  62. Tools Used For Hacking
  63. Kik Hack Tools
  64. Hacker Security Tools
  65. Tools 4 Hack
  66. Pentest Recon Tools
  67. New Hacker Tools
  68. Hack Tools 2019
  69. Pentest Tools Github
  70. Hacking Tools Mac
  71. Hacking Tools Free Download
  72. Pentest Tools Tcp Port Scanner
  73. Hack Rom Tools
  74. Usb Pentest Tools
  75. Top Pentest Tools
  76. Tools For Hacker
  77. Hacking Tools Online
  78. Tools 4 Hack
  79. Hack Tools
  80. Github Hacking Tools
  81. What Is Hacking Tools
  82. Hacker Tools Linux
  83. Hack App
  84. Hack Tools 2019
  85. Blackhat Hacker Tools
  86. Hack Tools For Pc
  87. Hacker Tools Free Download
  88. Hacking Tools Usb
  89. Nsa Hacker Tools
  90. Hacker Tools Windows
  91. Hacking Tools For Windows Free Download
  92. Tools Used For Hacking
  93. Pentest Tools Alternative
  94. Hacking Tools Usb
  95. Ethical Hacker Tools
  96. Wifi Hacker Tools For Windows
  97. New Hacker Tools
  98. Hacker Tools For Mac
  99. Hacker Tools Free Download
  100. Usb Pentest Tools
  101. Hack Tools
  102. Pentest Tools Find Subdomains
  103. Hacker Tools
  104. Hak5 Tools
  105. Termux Hacking Tools 2019
  106. Hacking Tools Github
  107. Hacking Tools Kit
  108. How To Install Pentest Tools In Ubuntu
  109. Hacking Tools 2019
  110. Hack Tools
  111. Growth Hacker Tools
  112. Hacker Tools Online
  113. Hacking Tools For Beginners
  114. What Are Hacking Tools
  115. Pentest Tools Bluekeep
  116. Hack Tools 2019
  117. What Are Hacking Tools
  118. Physical Pentest Tools
  119. Best Hacking Tools 2019
  120. Hackrf Tools
  121. Hacking Tools Pc
  122. Nsa Hacker Tools
  123. Pentest Tools Kali Linux
  124. Hacker Tools Mac
  125. How To Make Hacking Tools
  126. Hacker Tools
  127. Hack Tools
  128. Hacking Tools Windows 10
  129. Hacking Tools Windows 10
  130. Hack Tools For Pc
  131. Pentest Tools Linux
  132. Pentest Tools Linux
  133. Hack App
  134. Hacker Tools Apk Download
  135. New Hacker Tools
  136. Hack Tools
  137. Pentest Tools For Android
  138. Hacker Tools For Windows
  139. Github Hacking Tools
  140. Hacker Tools Windows
  141. Pentest Tools Tcp Port Scanner
  142. Hacker Search Tools
  143. Hack Apps
  144. Tools Used For Hacking
  145. Hack Tools For Pc
  146. Hackers Toolbox
  147. Pentest Tools Port Scanner
  148. Nsa Hack Tools
  149. Blackhat Hacker Tools
  150. Hacker Tools Github
  151. Hacking Tools For Games
  152. Hacking Tools For Windows 7
  153. Hacker Tools For Ios
  154. Hacks And Tools
  155. Pentest Tools For Android
  156. Hacking Tools Windows
  157. Hacker Tools Free
  158. Pentest Tools Bluekeep
  159. Hacking Tools And Software
  160. Hacking Tools For Windows
  161. Hacker Tool Kit
  162. Hacker Tool Kit
  163. Best Pentesting Tools 2018
  164. Hacker Tools Linux
  165. Hacker Tools Free
  166. Hacker Techniques Tools And Incident Handling
  167. Pentest Tools Linux
  168. Hacking Tools For Windows 7
  169. Android Hack Tools Github
  170. Hackers Toolbox

No comments:

Post a Comment