Request For Comments. Crackme (Linux/C)


(pico) #1

Hi Everybody!

Inspired by @TheDoctor I started working in a small side project involving some crackme’s, and I would appreciate your feedback/comments (if the binary works on your system, how easy/difficult you found the challenger,…)

The program is encoded at the end of this post. To get the binary, save the text below in a file named c1.bin and then run:

cat c1.bin | base64 -d | gunzip > c1
chmod +x c1

The objective is to get the success message not necessarily finding the password.

Looking forward to your feedback.

THE CODE

H4sIALGFRFcAA+0Yf3AU5fW7X8nlCLsn2BbU6qqhDRKOLMZKHMBsuCTfyQEXkiA/EvFCTsgIiZPs
AaUqppdAl8tZ22kd/yntH7TTcRjE6lChDtlwwAWdgkmtoFhUENxjqwSiJCJm+953e0dytjP9o//V
ndm8773v/X7ve9/mtlb4K60WC0k/VjKfIPZXSxnDy0z6C+4MC9DmEDv8zSNOxusgY5+y8XAiGQ+J
wP6iXA4u0nrdj46Dt5nkvRm9KTm7+Qqmy4LpZxoWmNxpaDdh9Xm5KZf890/aLZS/GV4bvFWL68ju
39z6+vlXf3Etf6pzxfGtBw7fe3//cE1Pd14Z0RrApZ6duKrBFfqrTbUSIg4cxDVVElSJa/txGb2v
mxPIgRT5g6Nem0G0RwDp+SOK32xhLEFggV3Gpa2EZHWpPQdhX3b0DCDbpyjwCa7OwUpUV8VXU+XC
wzRWO+qkynfKQVybZmeGtQ+B43NRLX3rqZuo0hv5KHdHPlecn0sNVdfjdVT5uobGVgtLaakuf48a
bx7A7PZYmHtntOMA9Y+Xr2qIS7U+5XNkF40aGvlngMbqC5zIspy5J+fQSJ+hL6axJwuK9uelxId+
Dx4VFInGQcgFiTQVzBnW5jD2cD9VPvMrZ5khLcjY36PKEcYoGtok4KJrjtDI4cCqBqk+HqCRY4ao
UmX0yp6Uc8P9NFZtaDNhvTK+d+6rhP+z6lPe4B103pOGYWzkh08FtCSoW6E40bX4XpI8CRt7Lcm3
AFDjhKh2fGLwoKr3kp12GbKT9l/CrAxBrID7lOt1NXI1ja4eoV2nZUo7voKmJzTWOripCIqj7Uc1
yi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+rmBblb
4Vrgs/ytB/okoP8ACcs49xIzLzLQq4H+WMZOecaOhHYksFPHFXqz7OwGua3Xx9f52+fb5//5uQT/
P+LjdqUg+6Q3XGxdtWDBA0JhXWO4RQ4LJZ45npKZs8MME58WSzzFJZ57p6fohHja17XLbXKwkXha
WuWQZ21L2NMYbl7fNLO5iXjk0GaZeNpam4JykHhC61Y/1hbcECKeFN7Y3k48a1o3bAi1yP+ruCbA
i//vW038xu8EKbwgi9+ehd9OxvxGQXBGl5kwhVPneH7LeJTpt4yx323muTsvhb+UxZ8tX5QlX2bW
pyxVGqJax/NnuUN+ZMrb0oTM7yspcFsWf7b8XJOWlhfSv8uY8s9l8buzcMm0X5xFT8vPyKJb/g20
kW8+Vab8Q/9BPv38CwsJUUvYEgAA

Solution and more. Crackme (Linux/C)
(Command-Line Ninja) #2

This runs on my machine, If it wasn’t you that posted it, I don’t think I would’ve run it. Running a random binary with no source is kind of scary xD

As for cracking it, I have no idea where to start.


(pico) #3

A little help… A version without symbols stripped + a hint

Hint: Look for strncmp

NEW CODE

H4sIACu8RFcAA+1Zf3RTVx2/Lz/a0EJe9kMFmZIhaJEtNNp56ATWsKS9kYyVrR0CgyzNjzaSHzV9
DwqDjS6U7S1EOR7dYUfPRJ06PR6HcyJDDqQU+mPTURhuTOZkuM2EoJThaMewz++9776QPInHP/zH
c3yH13vv537v98fn+733vTwednkadRyH1EuHFiEycnINdNzA8GcsBRHA5iMD/K1GJiprRMVXQ0n7
ZTMqaRGy0r9kXQXpqHotD5S0NzF4d0Gvss7Abitz2cr8VNtZTFptDaxd9o4QqET/+aW6RdbfCLce
7qalrejCtBujr0qfmffsmpptT+78inlJ3VfnerH07nKcbpkwYekjL5mtKPtjoARLg9k2HUJ/b8XS
O1janMWSeFpqfWPQdYUozjtSrivYP4JTrixOT9YVjbgRfk8tjJ/sO/sJbiR5unLOiDJ1mk4h++hj
XNJ1hQORL7re2PTr1f3URPKclZohKpIZ6LvG89NxMjrOATS+jxCGpYGDpM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JXjbCYiiiSC1
Bv4nBJYTxJxXIvQG4sHusKBmTnW+QA8dhRLBIOpMxNvhl5U3HFvHcu/t6ognBG+M/NwKibFCHGrk
SmZJ6IlEPKFlS1Xuj8S7gsQfEKdZ9nrhRxtzmcnEO4NAnI9mSKumUGAlyYyLAsl8JyRbQKGCa76E
vwNAWlhB+gsR8hJA4RCNkUQCxRHsLvim0lBa9CWWYApRCr3eWJwWZ1AQO71CBFKmUhsB92kM1yCR
0sfsKakvbBOkcEPp/yeOWg1EXR8AAA==

(Command-Line Ninja) #4

I’m sorry. I don’t know how I am supposed to do this? I am literally a total binary/debugging noob.

I ran strings on the generated binary from the base64, but that didn’t really help me. Any pointers? I need you to be really explicit. SORRY FOR THE N00BISHNESS.


(pico) #5

Thanks. @pry0cc. I haven’t realize that I could have use this to trojanize all your computers :slight_smile:.

Let’s see if the second binary (this is also safe, just a bit bigger) and hint helps to crack it!

Thanks again for checking and trusting


(pico) #6

OK, strings does not work on this one. I did it on purpose as I think everybody will know how to do that by now.

In this case, it is better to use the second dump (the one with symbols). This one contains the symbols, so you can see the libc functions called by the application. You can approach the crack in two main ways.

  1. Opening the binary in a debugger and start setting breakpoints to figure out where the key is used and how is it used.
  2. Use objdump -d to get a assembler dump of the binary and to static analysis

In any case, when you find the relevant part of the program you will have to patch the binary. Actually finding the password is a bit tricky…

Hope this helps. I will be posting a solution tomorrow or the day after if nobody does it earlier.

Thanks for the feedback on the difficulty, this is very useful


#7
*Opens up radare2*

Hehe, looks fun ^^


#8

Reverse engineer it, lel
Though I suggest you start with the basics before going into Reverse Engineering.


#10

Solution to the original code:

Binary patching:

  1. After extracting the ELF binary, open it up in a disassembler
  2. Perform a strings analysis and locate any obvious strings’ position(s) in the executable code
  3. Find the conditional ‘jz’ instruction and patch it with an unconditional jmp, i.e. bytes 74 05 should become EB 05
  4. ???
  5. Profit!

(pico) #11

You are the best @dtm!!!

How would you qualify the difficulty level?..


#12

I’m not that great, honestly. It was pretty easy for me because I had some prior experience with this sort of thing. I haven’t explored enough of RE to develop an understanding of the range of difficulty for challenges.