Skip to main content

OWASP crackme write up version 3 level 1 ∠( ᐛ 」∠)_ (day 11)



This is again "another" way to crack the owasp crack me challenge, but this time i used xposed framework to bypass the function authentication.

Before using the xposed framework, you guys remember that the application has a root detection method inside the main function that will prevent us to hook into the method using xposed framework, to circumvent the check of the root detection i tamper the smali code of the application like the figure below.


as you can see i tamper three function of the root checker inside the main function. This 3 function is equivalent to this source code:

 if (c.a() || c.b() || c.c()) {
            this.a("Root detected!");
        }

repackage the application and install it to the rooted vm or rooted device. Because we already taking care of the root detection now its time to move on to the xposed framework.

This is the code i write to bypass the authentication function:

package com.example.root.hooking_owasp_level1;

import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.callbacks.XC_LoadPackage;
import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam;
import static de.robv.android.xposed.XposedHelpers.findAndHookMethod;

public class hooking implements IXposedHookLoadPackage{
    @Override
    public void handleLoadPackage(LoadPackageParam loadPackageParam) throws Throwable {
        XposedBridge.log("loaded app:" + loadPackageParam.packageName);
        if(loadPackageParam.packageName.equals("owasp.mstg.uncrackable1")){
            XposedBridge.log("we find our apps");

            findAndHookMethod("sg.vantagepoint.uncrackable1.a", loadPackageParam.classLoader, "a",String.class, new XC_MethodHook() {
                @Override
                protected void afterHookedMethod(MethodHookParam param) throws Throwable {
                    super.afterHookedMethod(param);
                    param.setResult(true);
                    XposedBridge.log("bypass :)");
                }
            });
        }
    }
}


i already explain most of the function in my previous tutorial, right now i want to emphasize in the findAndHookMethod function. The following function will help us to hook into the specific method of application that we want to tamper. as you can see:
  • The first param is the class name that we want to hook
  • The second param is responsible for loading the class
  • The third param is the method name that we want to tamper
now the rest of the parameter is little bit tricky if you dont pay attention. the param between the method name and new XC_MethodHook() is reponsible for taking the input of how many param on the "method we want to hook".

Example:
The "a" function inside the "sg.vantagepoint.uncrackable1.a" class of the owasp crack me challenge only have one parameter like the following source code:

public static boolean a(final String s) {
.....
}

so you need to only provide one param which is "String.class" (use the same type as the used param). If you don't provide the "String.class" the xposed cannot find the method you want to hook. (i hope is not confusing)

After we get the method, notice the "a" function return a boolean value all you need to do is set the value into "true" by using param.setResult(true)

Load the xposed module and enjoy the result :) As you can see from the below figure i input the wrong text and get the correct result.







There you go i hope you enjoy this post :)







Comments

Popular posts from this blog

Having fun analyzing nginx log to find malicious attacker in the net (ง'̀-'́)ง (day 37)

  What makes you sleepless at night? is it because of a ghost or scary stories? is it because you have an important meeting tomorrow? or is it because you have an exam? For me, what keeps me up all night is that I keep thinking about what happens to a website that I just created, is it safe from an attacker (certainly not) or did I missing some security adjustments that lead to vulnerability? well I'm not the best secure programmer in the world, I'm still learning and there is a big possibility that I can make a mistake but for me, a mistake can be a valuable investment to myself or yourself to be better so from this idea, I want to know more about what attackers casually do when attacking a website. Here in this post, I'm going to show you how I analyzed attack to the website that I have permission to design and also some interesting findings that I could get from the analysis Background: All of this analysis comes from the traffic that is targeted to th

Utilize Pwntools for crafting ROP chain :') (day 69)

who doesn't like pwntools? it is a very versatile tool and can be customized according to our need using the python script but did you need to know that pwntools itself can help us to automatically craft a rop chain for us? so in this post, I will show you how to make rop chain less painful and make pwntools do all the heavy lifting. To demonstrate this I will use the binary challenge callme 64 bit from ropemporium link: https://ropemporium.com/challenge/callme.html Crashing the app: Like any other exploitation process, we need to crash the program by generating a long string pattern to determine the offset. based on the information from the above figure we can see that we required to provide 40 bytes of offset Fun stuff: now this where the fun stuff began write the following python script: as in the guideline of the challenged said we need to chain the function call by first to call the callme_one function, callme_two function and then callme_three funct

WriteUp PWN tarzan ROP UNICTF ಠ_ಠ (day 61)

So in this post, I'm going to talk about how to solve the Tarzan pwn challenge from UNICTF 2019. Back in the day when the competition is still going I couldn't finish it and don't have any clue to solve this but this time I was able to finish it :) Also in this post, we will be going to be heavily focused on how to utilize pwntools to construct a ROP chain. If you kinda confused about my explanation in this post you can refer to this following youtube video, link: https://www.youtube.com/watch?v=gWU2yOu0COk I build the python script based on this video Ok, let's get started! In this challenge, you will get two binary first go with tarzan and libc-2.29.so by providing .so file it tell us what version library that the target machine is using this could help us to do ROP chain. first, we run the Tarzan binary to get the basic idea of the program work and as you can see it just show you some text, newline and when you try to input something it doesn't gi