Puzzle "Test My Patience" by Check Point Security Academy
I mentioned the program on Habré several times. Check Point Security Academy : its essence is that the company Check Point in the summer, announced a competition in the Capture the Flag format, where the participant’s past experience is not important, but only his ability to unravel cyber puzzles is important. According to the results of this competition, the company recruited twenty participants for a three-month professional course on cyber security, and all participants from the very beginning of the course receive a full salary of a specialist in KB, under the obligation to work in the company two years after the end of the course.
In a CTF competition, the flag may even be a picture, for example.
The selection of participants was completed in August, but the competition site will continue to operate until next summer, and I invite those who wish to register and try their hand for the sake of sports interest. The competition consists of 12 puzzles of varying difficulty, rated from 10 to 150 points.
Here I want to make out the “Test My Patience” puzzle from the “Surprise” category. She is of medium difficulty (50 points), and here is her full text:
Hi there,
We found This executable on the local watchmaker's computer.
It is a rumored person.
What is your watchmaker?
Note: This file is not malicious in any way 3r3338. The link is a 32-bit binary for Windows, which is some antiviruses swear. , but if you still run it, it looks like this:
Inside the binary is encrypted; it refuses to run under the debugger; if you try to connect a debugger to it that is running, it ends instantly. Probably, experts from Check Point wrapped their puzzle in a crypto-packer, borrowed from some Malvari.
How can we guess the number, thought of by a watchmaker?
There are two ways. The first one can conditionally be called “the power is, the mind is not necessary”: if the program cannot be debugged live, then we will debug the dead!
Start the 32-bit Task Manager (WindowsSysWOW64taskmgr.exe), right-click on the mysterious process, and select Create dump file. (The 64-bit Task Manager for 32-bit processes creates a wow64cpu emulator dump, which is more difficult to work with.) 3r-3225.
We look at the dump and see that at least the lines in it are already decoded:
3r366.
But the lines with neither the number nor the flag is not visible yet.
We turn to the main caliber gun: WinDbg (X86) -> Open Crash Dump
Where in memory is the line that we want to see printed - “Good job my friend!”?
Team 3r3r6206. lm 3r3207. allows you to determine that the binary is loaded from 3r3206. 01140000 up to 3r3206. 015b2000 ; then s-a ???b2000 "Good job my friend!"
finds the required string at 0115a0d0
:
3r3398.
Let's now find out where this line is printed: maybe some command contains bytes d0 a???
corresponding to the address of the search string? ( S-b ???b2000 d0 a???
)
Luck! - such a team was found:
3r3113.
What is the code around this command? ( Ub 011412f7; u 011412f7
) 3r33225.
3r3124.
We see that, depending on the result of the function 3r3206. 01141180 either the message you are looking for is printed, or “Wrong one ” 3r33232.
Function code 3r3206. 01141180 occupies three screens; it's pretty easy to understand that this is an implementation of 3r3r6206. strcmp () In which call 3r3206 is added. Sleep (700) 3r3207. . It is not yet clear why there is 3r3206. Sleep () ; but it still does not affect the result of the function, so it’s better to figure out what the lines are compared:
3r3145.
Two pointers are passed, equal to ebp-14h
and 3r3r6206. ebp-24h ; the second of them was passed to the function in the function before that. 011410b0
.
Is this the function that requests the hidden number? Check by call stack (3r3206. K ):
3r3164.
Yes, it is she!
The overall scheme of the puzzle is now clear: the user's guess is saved at ebp-24h
, the hidden number - at 3r3r6206. ebp-14h , then they are compared and printed with either “Good job my friend!” or “Wrong one ”
All that remains is to pull the hidden number out of the stack frame. Its ebp
we are already known from the call stack:
3r3183.
Well, well
3r3192.
Success! You can uncork something tasty.
But three mysterious things remained without explanation:
-
- Why inside the local 3r3r6206. strcmp () call 3r3206. Sleep (700) 3r3207. ?
Why, when we entered the hidden number, did the program hang up for a dozen seconds before typing “Good job my friend!”?
What does the watchmaker have to do with this whole puzzle?
So, it turns out that there is a second - more intellectual - way to guess the conceived number. If you just try randomly the numbers 0-? then it is easy to notice that on the nine, the program slightly freezes. If you try the numbers 90-9? then you can see that at the number 98 the program “freezes” twice as long. (By picking up her offal, we already understand what's the matter: a successful comparison of each pair of characters causes a delay of 0.7s.) To solve the puzzle, even without launching the debugger, it was enough to select each next digit so that the delay before the response increased - either manually with an exact stopwatch, or an uncomplicated script. So the compilers hinted at
A long-time attack on cryptographic algorithms 3r3220. when the time until the error message is measured and analyzed.
But learning how to unzip programs wrapped in unknown crypto-packers is, in my opinion, both more interesting and more valuable :-)
Notice that we didn’t have to figure out how the binary is encrypted, nor how a line appears with a hidden number in the stack (we saw in the dump that it’s not among the string constants) - we managed to get both about a dozen WinDbg commands were enough.
! function (e) {function t (t, n) {if (! (n in e)) {for (var r, a = e.document, i = a.scripts, o = i.length; o-- ;) if (-1! == i[o].src.indexOf (t)) {r = i[o]; break} if (! r) {r = a.createElement ("script"), r.type = "text /jаvascript", r.async =! ? r.defer =! ? r.src = t, r.charset = "UTF-8"; var d = function () {var e = a.getElementsByTagName ("script")[0]; e.parentNode.insertBefore (r, e)}; "[object Opera]" == e.opera? a.addEventListener? a.addEventListener ("DOMContentLoaded", d,! 1): e.attachEvent ("onload", d ): d ()}}} t ("//mediator.mail.ru/script/2820404/"""_mediator") () (); 3r33232.
It may be interesting
weber
Author19-11-2018, 01:30
Publication DateInformation Security / Debugging
Category- Comments: 0
- Views: 305
Miro Paris vous propose une large gamme d'accessoire de beauté, maquillage, skincare, kbeauty, crèmes en provenance de Corée du sud, Japon, et Hong Kong. Check Out: Cosmétiques Asiatiques