23 de ago. de 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 info


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

Nenhum comentário: