Showing posts with label hydra. Show all posts
Showing posts with label hydra. Show all posts

Tuesday, May 27, 2014

[WALKTHROUGH] KIOPTRIX Level 3

Sups h4x0rsss.... :)

Sorry that I intentionally skip on posting my 'walkthrough' on Kioptrix Level 2. In fact, I have already pwned the box but those snapshots taken during my process are stored in another machine... :((

Things are getting complicated lately as I have lost my precious internet connection for several days which cause me having some bad time in updating my blog post. However, worry not much that internet is coming back again soon enough... :))

And, I will be sure to update my Kioptrix Level 2 walkthrough at soonest possible...


Delay no more, here I present to you the Level 3 of Kioptrix series... which I think is pretty easy to complete the challenge. However, I am sure there are some other penetration way... just that I happened to penetrate through the easy one huh...


OK! Let's start with finding the IP address of the target box since it is using DHCP...

Here it is, the IP address of our target box is 192.168.17.142... ( It's pretty easy to differentiate the target IP as we all know that that is the only strange IP wandering around... :p )

Next step is the reconnaissance process... as usual here comes the big help of Nmap...
 

 Results told us that there are only 2 services running on the box, which are the SSH and the HTTP service...

Let's bring it to further aggressive mode and see if we are able to harvest some more information of the target box...


Not fruitful enough...

Not to be disappointed, the reconnaissance process is not ended yet... :p

Let's take a look on their website...


Ahaaa... we found a login page for the website... tried some easy combination "admin::admin", "admin::password", "admin::letmein"...

Of course they leave such stupid careless mistakes here... Tried with mysql injection by assuming the input is not sanitized and they are running MySQL database...

Again another rejection by the box... :(

Looks carefully and we notice that it is "Proudly powered by LotusCMS"! Some Google-fu tells me that Lotus CMS version 3.0 is vulnerable...

So here we bring up the msfconsole and look for lotuscms vulnerability... :))


Simple and straightforward enough that we only have 1 choice for our attacking towards the target box...


Setting up the info required by the exploit framework... and we're ready to GO!


After some MAGIK done by Metasploit, we just got another shell on the target box... :))

Tried running some local escalate exploit but does not work... :(

After banging around the walls, we are still stuck at "www-data" privilege, which is not our ultimate goal... :(

So after poking around the files/documents inside the box, we collected some username from /etc/passwd for cracking purpose... ( You leave me no choice! )


Launching Hydra against SSH service on our target box...

After some times, password surfaced with the username "loneferret"...


Next step to do is SSH into the target box using the credentials found earlier...

However, the user "loneferret" does not have sudo privilege for shell... :(


However, we notice that user "loneferret" is able to execute the ht editor...

After execute the ht editor with sudo privilege...


We can edit the sudoers list in the /etc/sudoers using ht editor with sudo privilege...

Pressing on "F3" will pop up the "Open Windows"... navigate to /etc/sudoers directly by typing in the address bar at the top...

Then, we add in the bash shell command as sudo privilege under user "loneferret"... and press "F2" to save...


Quit the ht editor and check again on the available sudo command for user "loneferret"...


 And, shoot in the MAGIK words "sudo /bin/bash" and we are given a root shell on the target box... :))


Wednesday, May 14, 2014

[WALKTHROUGH] De-ICE_S1-130

After a long rest, finally here is the S1-130 of De-ICE series as promised...

This challenge involved some Java programming language... ;)

Unlike those previous challenges in De-ICE series, the ip address this time is not the same as the name (S1-130).. Instead, the ip address for the target box this time is 192.168.1.20 as we found out using Netdiscover.


Never forget to do some reconnaissance before we initiate our attacks...


 By visiting the web site, we can see the admin email account for the Nosecbank domain... :)


 Next thing to do is generate some mutated usernames based on the 'customerserviceadmin' found on the website using my customized scripts...

Let's see if any generated username is valid through the SMTP service using RCPT command...


 Now we got a valid username reside in the target box... "csadmin" which is mutated from the original username "customerserviceadmin"...

After that we got the valid username, let's hit the box using Hydra... another long waited process... :(


 Password found for the username "csadmin"!

No-brainer-answer after this is to login using the credentials found... :p


 After login successfully into the target box, we should seek to root privilege escalation... :)


Unfortunately, the available sudo command for csadmin is very limited... :(

But we found an email from the sdadmin... :)


From the email content, we do some password profiling and create a customized password list to be attempted for attacks later...


 Great! Password found for the username "sdadmin"... apparently the password is formed using his son's name and birth year.. XD


 Another limited sudo commands for "sdadmin" user account... :(



But... we can find the replied email from the "csadmin" regarding his son's birthday invitation... "databaser" seems like referring to the "dbadmin" user account...


Another round of password profiling for the "dbadmin" account...


 Luckily, we got the password login for "dbadmin" too...


Here we see the part 1 of the broken email... let's try to fix it and see what might we get from this... :p




Finally, we fixed the java code by sticking up the part 1, 2 and 3... (a complete Java code can be seen at the most bottom part of this post...)

Compiled the Java code and see if we can generate the password for "sysadmin" and "root" account...


 Voila! Now we got the password for "sysadmin" and "root" account... and we found the encrypted flag here...

Let's do something and download the encrypted file over our local box...



After grabbed the encrypted files, decrypt it and we're done with the challenge... :)



[*] deice.java
import java.io.*;
public class deice
{
    public static void main(String[] args)
    {
        try
        {
            System.out.println("[*] Password Generator");
            BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
            System.out.print("[?] Username: ");
            String input=in.readLine();
            int[] output=processLoop(input);
            String outputASCII="";
            for(int i=0; i                outputASCII+=(char) output[i];
            System.out.println("[+] Password: " + outputASCII);
        }
        catch(IOException e)
        {
            System.out.println("[-] IO Error Occurred!");
        }
    }
/*input is username of account*/
    public static int[] processLoop(String input)
    {
        int strL = input.length();
        int lChar=(int)input.charAt(strL-1);
        int fChar=(int)input.charAt(0);       
        int[] encArr = new int[strL+2];       
        encArr[0]=(int)lChar;   
        for(int i=1;i            encArr[i]=(int)input.charAt(i-1);
        //encArr[0]=(int)lChar;
        encArr[encArr.length-1] = (int)fChar;
        encArr = backLoop(encArr);
        encArr = loopBack(encArr);
        encArr = loopProcess(encArr);
        int j = encArr.length-1;
        for(int i=0; i            if(i == j)
                break;
            int t=encArr[i];
            encArr[i]=encArr[j];
            encArr[j]=t;
            j--;
        }
    return encArr;
    }
/*Note the pseudocode will be implemented with the    
root account and my account, we still need to implement it with the csadmin, sdadmin,   
and dbadmin accounts though*/   
    public static int[] backLoop(int[] input){
        int ref = input.length;
        int a = input[1];
        int b = input[ref-1];
        int ch = (a+b)/2;       
        for(int i=0;i            if(i%2 == 0)
                input[i] = (input[i]%ch)+(ref+i);
            else
                input[i] = (input[i]+ref+i);
        }
    return input;
    }
    public static int[] loopProcess(int[] input){   
        for(int i=0; i i < input.length; i++ ) {

            if(input[i] == 40 || input[i] == 41)
                input[i] += input.length;
            else if(input[i] == 45)
                input[i] += 20+i;
        }
    return input;
    }
    public static int[] loopBack(int[] input){
        int ref = input.length/2;
        int[] encNew = new int[input.length+ref];
        int ch = 0;
        for(int i=(ref/2); i i < input.length; i++ ) {

            encNew[i] = input[ch];
            ch++;
        }
        for(int i=0; i            if(encNew[i] <= 33)
                encNew[i] = 33+(++ref*2);
            else if(encNew[i] >= 126)
                encNew[i]=126-(--ref*2);
            else{
                if(i%2 == 0)
                    encNew[i] -= (i%3);
                else
                    encNew[i] += (i%2);
            }
        }
    return encNew;
    }
}


Thursday, May 8, 2014

[WALKTHROUGH] De-ICE S1-120

Here comes the S1-120 of the De-ICE series...

Well, I would say this is not that difficult except the part when escalate to root privilege makes me wondering for some times...

In overall, I still enjoy the hacking challenge this time :)

Let's start with a netdiscover to check out the ip address...

 Usual practice RECON with Nmap...


Nmap with aggressive mode...


 Let's check out the website...

Seems like this can be attack using SQL injection...


Finding out using sqlmap...



The guess is CORRECT! Now we dump all the usernames and password into two separate file...

After that, hydra will do the works by breaking into SSH service...


As per previous challenges, 'ccoffee' seems to be the staff since the very beginning...

So, let's try login using 'ccoffee' account...


Now we got a shell on the target machine...

It seems that we can only run 'sudo' with the following file...but executing the file does not escalate our privilege to root... :(


Let's try to backup the original file before we proceed further...

Try create a shell prompt with a same file name and change the permissions to allow all...

IT WORKS! But we only get the shell with 'ccoffee' privilege...  (feeling depress again...)


 Let's check again at the allowable 'sudo' commands...

Perhaps we should just run 'sudo' with full path of the file?

......... and we got the root shell! :)


Next thing to do is just to find the 'flagsss' this time... and I will leave it to you since there are too much of files to be viewed...

# ls -laRh

This command will list out all the files recursively with human-readable file size... :)


Next challenge would be S1-130...