Skip to content
Karak Studio icon

Desktop · Windows

Karak Studio

Guided walkthrough

This walkthrough takes you through Karak Studio one click at a time. You will open a small program, look at it in every view, find out how it decides whether a password is right, and record what you learn. It takes about 30 minutes. No experience is needed.

You will use First sip, one of the practice programs built into the app. It asks for a password and says “Correct” or “Wrong”.

Spoiler warning. This walkthrough reveals First sip’s password. If you would rather solve it yourself, do the practice file first and come back.

Each step says what to do, then what you should see. If what you see is different, stop and compare carefully before going on.

Double-click Karak Studio.exe.

If Windows shows “Windows protected your PC”, click More info, then Run anyway. This appears because the app is not signed by a registered publisher.

You should see a mostly empty window with Look inside a program in the middle and an Open file button under it.

Step 2: Find your way around the empty window

Section titled “Step 2: Find your way around the empty window”

Before opening anything, find these five things. You will use all of them.

Where What
Top-left Open file and Study buttons
Top, middle Back and Forward arrows, then a long box that says “Go to an address or name, or search”
Top-right Save as .asm and the Look chooser
Left side A row of tabs starting with Functions
Right side A panel headed What this line does
  1. Click Study in the top bar. The window changes to the Study guide.
  2. At the bottom of the chapter list on the left, click Practice files.
  3. Find the box titled 1. First sip and click Open in Karak Studio.

The Study guide closes and the program opens. The bottom-left corner of the window now says first-sip.exe 64-bit x86 · 56 functions.

If you see “Could not save the practice file”, your antivirus blocked it. See the Troubleshooting section of the manual.

Every file opens on the Overview tab.

The Overview page for first-sip.exe

Read the page from the top:

  • The heading says first-sip.exe, then 64-bit x86 command-line program (exe), its size (13,824 bytes) and a build date. So this is a small program that runs in a terminal window.
  • Fingerprints shows a SHA-256 and an MD5. These identify this exact file. You do not need them now.
  • Under the fingerprints: 56 functions · 40 imports · 61 pieces of text.
  • What it can do (2) lists two abilities:
    • Reads, writes or deletes files, because it uses ReadFile and WriteFile. A terminal program reads the keyboard and writes to the screen with these same two functions, so this is expected.
    • Makes memory runnable, because it uses VirtualProtect. Here that comes from standard start-up code the compiler adds, not from anything the program’s author wrote.

This is the first lesson of triage: an ability tells you what a program can do, and you still have to work out why.

Scroll down inside the Overview.

  • Text worth a look lists text that looks interesting. For this program there is little: you may see Password: under Keyword.
  • Hidden text says none was found.

A real suspicious file would have web addresses, commands or registry keys here. This one is harmless, so the page is quiet.

Click the Text tab in the left panel.

The Text tab

You should see 61 entries. The first six are the program’s own:

karak-chai
Wrong. Try again.
Correct! Well done.
Press Enter to close.
First sip
Password:

Everything below those (“Argument domain error”, “Mingw-w64 runtime failure” and so on) belongs to the start-up code the compiler added. Learning to tell a program’s own text from its compiler’s boilerplate is a skill you will use on every file.

Two of the entries are obviously messages: Correct! Well done. and Wrong. Try again.. One is not a message at all: karak-chai. Keep that in mind.

The plan is the one used on almost every program: find a piece of text you recognise, see what code uses it, and work backwards from there to the decision.

Step 7: See where the “Wrong” message is used

Section titled “Step 7: See where the “Wrong” message is used”

In the Text tab, click Wrong. Try again..

Now look at the right-hand panel. Near the bottom it says Used in 1 place, and under that one entry starting sub_1400014C6+.

That means: one place in the program refers to this text, and it is inside the function at address 1400014C6.

Click the sub_1400014C6+... entry.

Three things happen:

  • The main area switches to the Assembly view.
  • The heading reads sub_1400014C6.
  • One line is highlighted. It is the instruction that loads the “Wrong” text.

You are now inside the function that reports the result. It is not the function that decides the result. It is only told the answer and prints the matching message.

Assembly is hard to take in at a glance. Click the C code tab above the listing.

You should see something close to this:

void sub_1400014C6(i64 arg1)
{
sub_140001481((u8)arg1 != 0 ? "Correct! Well done." : "Wrong. Try again.", ...);
sub_140001481("Press Enter to close.", 0x17);
...
ExitProcess((u8)((u8)arg1 ^ 1));
}

Read the first line of the body. It picks one of two messages depending on whether arg1 is zero, and passes it to another function. So:

  • arg1 is the verdict: not zero means correct, zero means wrong.
  • sub_140001481 prints text.

The decision was made by whoever called this function.

Step 10: Give the two functions real names

Section titled “Step 10: Give the two functions real names”

You now know what two functions do. Write that down, in the app, before you forget.

  1. With sub_1400014C6 still open, click Rename next to its name (or press F2).
  2. Type report_result and press Enter.

The heading changes to report_result. Look at the Functions tab: it is listed under its new name.

Now do the same for the printing function:

  1. In the C code, double-click the first line, the one that calls sub_140001481. That function opens.
  2. Click Rename, type print, press Enter.
  3. Click the ← button in the top bar to go back.

The C code of report_result now reads print(...) on both lines. Every name you add makes the next function easier.

Look at the right-hand panel again. It now says Called from 1 place, with one entry: entry_point+....

Click it.

You are taken to entry_point, the function where the program starts. This is the one that knows the whole story.

With entry_point open, click the C code tab if it is not already showing. You should see four calls in a row:

void entry_point()
{
...
print("First sip", 0x15);
v1 = sub_140001525(&var_48, 0x40);
v2 = sub_140001432(&var_48, v1);
report_result(v2);
}

Read it as a story:

  1. Print the title and the “Password:” prompt.
  2. Call sub_140001525 with a buffer and the number 0x40 (64). It returns something, kept in v1.
  3. Call sub_140001432 with the same buffer and v1. It returns something, kept in v2.
  4. Report the result, using v2.

Step 2 fills a buffer of up to 64 bytes, so it reads what you type and v1 is how many characters. Step 3 takes what you typed and its length and returns the verdict. sub_140001432 is the password check.

Rename both now:

  1. Double-click the line with sub_140001525, rename it read_line, go back.
  2. Double-click the line with sub_140001432, and rename it check_password. Stay in this function.

You are in check_password. Open the C code tab. Notice its first line: check_password(u8* arg1, i64 arg2). Karak Studio saw arg1 being read one byte at a time, so it says arg1 points to bytes (u8*): a piece of text.

The C code of the password check

Take it a few lines at a time.

if (arg2 != 0xA) {
v1 = 0;
}

arg2 is the length of what you typed. 0xA is hex for 10. If the length is not 10, the answer (v1, which the function returns at the end) is 0, which you already know means “wrong”. So the password is exactly 10 characters long.

var_8 = "karak-chai";

A piece of text is fetched and kept in v2. Count its letters: k-a-r-a-k, a hyphen, c-h-a-i. Ten.

v5 = 0;
do {
v1 = arg1[v5] == v2[v5];
if (arg1[v5] != v2[v5]) {
break;
}
...
v5++;
} while (v6);

This is a loop. v5 starts at 0 and goes up by one each time round, so it is a position: 0, 1, 2 and so on. arg1[v5] means “the character at position v5 of arg1”, which is your input, and v2[v5] is the character at the same position of karak-chai. So each time round, the loop compares one character of your input with the same character of the stored text, and leaves with “wrong” at the first one that differs.

Put together: the check passes when your input is 10 characters long and every character matches karak-chai.

Click the Graph tab.

The graph of the password check

You see a handful of boxes joined by arrows. Find these features:

  • The top box ends with a comparison against 0xA and a jump. Two arrows leave it: this is the length test.
  • One box has an arrow coming back into it from below, running up the side. That is the loop.
  • Green arrows are the path taken when a condition is true, red when it is false.

The graph shows the shape of the logic without making you read every line. One test, then one loop: that is the whole function.

Click the Assembly tab. You see the real instructions.

  1. Click the line containing cmp near the top. The right-hand panel explains it: it compares two values and remembers the result for the next jump.
  2. Click the line just under it, a jne. The panel says it jumps only if the two values were different.
  3. Hold the mouse still over any other line for a moment. A small box appears with a quick explanation, without you having to click.

Find the line with the green comment ; "karak-chai". That is the instruction that fetches the stored text. Green comments are Karak Studio telling you what an address really is.

You do not have to read every line. Use the C view for the meaning and the assembly to check a detail.

Step 16: Look at the stored text as raw bytes

Section titled “Step 16: Look at the stored text as raw bytes”

Click the Text tab on the left and find karak-chai. The grey number to its right, 140004000, is its address: where it sits in the program.

Click in the long go-to box in the top bar, type 140004000 and press Enter.

Because that address holds data and not code, Karak Studio opens the Hex view there, and the bottom bar says so.

The Hex view

Find the row whose text column on the right shows karak-chai. On that row:

  • The left column is the address.
  • The middle shows the bytes: 6B 61 72 61 6B 2D 63 68 61 69. Each pair is one letter. 6B is k, 61 is a, 2D is the hyphen.
  • Straight after the last letter is 00. That zero marks the end of the text.

This is what “the password is stored as plain text” means in practice. It is sitting in the file where anyone can read it.

  1. Click the Functions tab and click check_password.
  2. In the Assembly view, click the cmp line near the top.
  3. In the right-hand panel, click Add note.
  4. Type length must be 10 and press Enter.

The note appears at the end of that line after //.

Now click Bookmark in the same panel. A coloured bar appears at the left edge of the line.

Click the My notes tab on the left. Your note is listed. Clicking it brings you straight back to this line, from anywhere.

Click the Calls tab above the main area.

The Calls view

  • The left side, This function calls, says check_password calls nothing. It does all its work itself.
  • The right side, Who calls this function, shows entry_point. Click its arrow to open it. Nothing calls entry_point, because that is where the program begins.

Now click entry_point in the Functions tab and look at the Calls view again. On the left you see the four functions you named: print, read_line, check_password and report_result. That is the whole program on one screen.

  1. Click Study in the top bar, then Practice files.
  2. In the First sip box, type karak-chai into the answer field.
  3. Click Check.

The Practice page

You should see Correct! Well done. in green, and the box is marked as solved. The answer box applies the same rule as the program, so nothing had to be run.

Close Karak Studio completely, start it again, and open First sip the same way as in Step 3.

Look at the Functions tab. print, read_line, check_password and report_result are still there, and your note is still in the My notes tab. Your work is saved as you go and tied to the file.

First sip has 56 functions. Real programs have hundreds or thousands. The method is the same.

  1. Click Open file.
  2. In the file name box, type C:\Windows\System32\notepad.exe and press Enter.

The bottom bar shows several hundred functions.

On the Overview:

  • What it can do now lists more abilities: files, the registry, starting other programs, and others. Each makes sense for a text editor: it opens and saves files, remembers its settings in the registry, and can open the help page.
  • Text worth a look lists a couple of web addresses under Web address and several entries under Registry key, such as Software\Microsoft\Notepad.

Click one of the registry keys. You jump to the code that uses it. This is the same move as Step 7, on a real program.

  1. Click the Imports tab on the left.
  2. In the filter box, type CreateFile.
  3. Click CreateFileW in the list.

The right-hand panel says Used in some number of places. Each one is a spot where Notepad opens a file. Click the first. You land on a call instruction with a green comment ending in !CreateFileW. The part before the exclamation mark is the DLL the function comes from.

Look at the lines just above the call. They put values into rcx, rdx, r8 and r9. Those are the first four inputs to CreateFileW. The Study guide’s chapter 7 explains this in full.

  1. Click the Search tab on the left.
  2. Type save.

Results appear as you type, labelled function, import or text. Click any of them.

Now click Also search inside the code under the filter box. After a moment, more results appear labelled code. These are instructions whose text contains your search.

Click in the long box in the top bar, type entry_point and press Enter. You jump to where the program starts.

Type an address instead, such as the one shown in the bottom bar after “starts at”, and press Enter. Same result.

Press the ← button a few times. You step back through everywhere you have been.

Click Save as .asm in the top bar, choose a folder, and save.

Open the saved file in any text editor. It contains the whole program as text: every function, with names, labels and comments. This is useful for searching with your editor’s own tools.

Click the Look dropdown in the top-right corner.

  • Choose Split view. The Assembly and C code now sit side by side under one Code tab, and the explanation panel moves to the bottom. Click a line of C and watch the assembly beside it scroll to match.
  • Choose Clean light. The lists and the explanation panel share one sidebar and the code gets the full width.
  • Choose Workbench to return to where you started.

Pick the one you like. The app remembers it.

You have now used every part of Karak Studio.

  • Work through the Study guide from chapter 1. Chapters 3 to 8 teach you to read assembly, and chapter 12 walks through a check function with arithmetic in it.
  • Solve the other three practice files. Sugar count needs arithmetic, Hidden leaf hides its password, and House blend has many correct answers.
  • Read the manual for the details of each view, the limits, and how to handle files safely.

What you did in Parts A to D is the method for nearly every program:

  1. Size it up. Read the Overview and the Text tab before any code.
  2. Find a landmark. A message, a file name, a web address, or an imported function connected to your question.
  3. See what uses it. Click it and jump to the code.
  4. Work outwards. Read that function, then find who calls it, until you reach the decision.
  5. Name things as you go. Rename every function the moment you have a guess.
  6. Read the meaning in C, check the details in assembly.
  7. Write it down. Notes and bookmarks, so tomorrow you start where you stopped.