6/03/2023

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


How Do I Get Started With Bug Bounty ?

How do I get started with bug bounty hunting? How do I improve my skills?



These are some simple steps that every bug bounty hunter can use to get started and improve their skills:

Learn to make it; then break it!
A major chunk of the hacker's mindset consists of wanting to learn more. In order to really exploit issues and discover further potential vulnerabilities, hackers are encouraged to learn to build what they are targeting. By doing this, there is a greater likelihood that hacker will understand the component being targeted and where most issues appear. For example, when people ask me how to take over a sub-domain, I make sure they understand the Domain Name System (DNS) first and let them set up their own website to play around attempting to "claim" that domain.

Read books. Lots of books.
One way to get better is by reading fellow hunters' and hackers' write-ups. Follow /r/netsec and Twitter for fantastic write-ups ranging from a variety of security-related topics that will not only motivate you but help you improve. For a list of good books to read, please refer to "What books should I read?".

Join discussions and ask questions.
As you may be aware, the information security community is full of interesting discussions ranging from breaches to surveillance, and further. The bug bounty community consists of hunters, security analysts, and platform staff helping one and another get better at what they do. There are two very popular bug bounty forums: Bug Bounty Forum and Bug Bounty World.

Participate in open source projects; learn to code.
Go to https://github.com/explore or https://gitlab.com/explore/projects and pick a project to contribute to. By doing so you will improve your general coding and communication skills. On top of that, read https://learnpythonthehardway.org/ and https://linuxjourney.com/.

Help others. If you can teach it, you have mastered it.
Once you discover something new and believe others would benefit from learning about your discovery, publish a write-up about it. Not only will you help others, you will learn to really master the topic because you can actually explain it properly.

Smile when you get feedback and use it to your advantage.
The bug bounty community is full of people wanting to help others so do not be surprised if someone gives you some constructive feedback about your work. Learn from your mistakes and in doing so use it to your advantage. I have a little physical notebook where I keep track of the little things that I learnt during the day and the feedback that people gave me.


Learn to approach a target.
The first step when approaching a target is always going to be reconnaissance — preliminary gathering of information about the target. If the target is a web application, start by browsing around like a normal user and get to know the website's purpose. Then you can start enumerating endpoints such as sub-domains, ports and web paths.

A woodsman was once asked, "What would you do if you had just five minutes to chop down a tree?" He answered, "I would spend the first two and a half minutes sharpening my axe."
As you progress, you will start to notice patterns and find yourself refining your hunting methodology. You will probably also start automating a lot of the repetitive tasks.

More articles
  1. Hacking Tools Usb
  2. Hacker Tools
  3. Hacking Tools Windows 10
  4. Hack Tools Mac
  5. Pentest Tools Find Subdomains
  6. Hacker Tools Github
  7. Tools 4 Hack
  8. Hacker Tools Windows
  9. Hack And Tools
  10. Hacks And Tools
  11. Tools For Hacker
  12. Blackhat Hacker Tools
  13. Best Hacking Tools 2019
  14. Hacker Search Tools
  15. Nsa Hack Tools Download
  16. Underground Hacker Sites
  17. Nsa Hack Tools Download
  18. Pentest Tools List
  19. Hacking Tools Windows
  20. Hacker Tools
  21. Hacker Tools 2020
  22. Usb Pentest Tools
  23. Pentest Tools
  24. Pentest Tools Apk
  25. Hacking Tools Online
  26. Computer Hacker
  27. Pentest Tools Open Source
  28. Hacker Tools Online
  29. Pentest Tools Alternative
  30. Hacking Tools Software
  31. Pentest Tools Alternative
  32. Nsa Hacker Tools
  33. Pentest Tools Framework
  34. Physical Pentest Tools
  35. Pentest Tools Alternative
  36. Hacking Tools 2020
  37. Bluetooth Hacking Tools Kali
  38. Hacking Tools For Games
  39. Hacker Tools Github
  40. Hacking Tools
  41. Hack Rom Tools
  42. Hack And Tools
  43. Pentest Tools For Android
  44. Pentest Tools Url Fuzzer
  45. Underground Hacker Sites
  46. Pentest Tools Github
  47. Pentest Tools Review
  48. Termux Hacking Tools 2019
  49. Hacking Tools
  50. Bluetooth Hacking Tools Kali
  51. Hack Tools
  52. Hacking App
  53. Hack App
  54. Pentest Tools Framework
  55. Hacking Tools Software
  56. Hack Tool Apk
  57. Hacker Tools Online
  58. Hacker Tools Hardware
  59. Android Hack Tools Github
  60. How To Make Hacking Tools
  61. Pentest Tools Open Source
  62. Top Pentest Tools
  63. Hack And Tools
  64. Hacker Tools For Pc
  65. Pentest Tools List
  66. Hackrf Tools
  67. Hacker Tool Kit
  68. Game Hacking
  69. Hacking Tools Pc
  70. Hacker Tools Github
  71. Hack Tools Github
  72. Hacking Tools 2019
  73. Black Hat Hacker Tools
  74. Pentest Tools For Windows
  75. Hacking Tools Kit
  76. Pentest Reporting Tools
  77. Hacking Tools Mac
  78. Hacker Search Tools
  79. Pentest Tools For Windows
  80. Pentest Tools Alternative
  81. Hack Tools Pc
  82. Hack Tools
  83. Hacker Tool Kit
  84. Hacker Tools Mac
  85. Hacking Tools Hardware
  86. Ethical Hacker Tools
  87. Hacking Tools Online
  88. Hacks And Tools
  89. Pentest Tools Subdomain
  90. Pentest Tools Open Source
  91. Hacker Tools 2019
  92. Hacking Tools For Games
  93. Hackrf Tools
  94. Hacking Tools For Kali Linux
  95. Pentest Tools Find Subdomains
  96. Hacker Tool Kit
  97. Pentest Tools For Android
  98. Hacking Tools For Windows 7
  99. Hacker Tools For Windows
  100. Top Pentest Tools
  101. Bluetooth Hacking Tools Kali
  102. Hack Website Online Tool

ANNOUNCEMENT: Submitters Of Papers And Training For Global AppSec DC 2019 (Formerly AppSec USA)

We had an overwhelming turnout out of submissions for Call for Papers and Call for Training for the OWASP Global AppSec DC 2019 (formerly AppSec USA)  We want to give each submission the time deserved to evaluate each before choosing.  Keeping that in mind the notifications of acceptance and thanks will be CHANGED to July 1, 2019.  We appreciate your understanding and patience in this matter.

Related articles