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_vcb4vhGRFp2XQqGeT5y9P_3PWDxP_TeSdYG5RIaDXQTq38zCMH8udfo_saCpSGGALNr7v11kh2-0AvbtVGvSYT9BNcRlyEkNIf1NjM2-n7kOyVQKVoFN17Urpv0U_1GOOb7o-eUxk7y30jwUrLDQQcCUjs-P75Oh2MpA649oIm408v=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_tR7nsU75VlYdu6MJbDChFq2Iaw2k3Xyu0E2TQrgBCfnEn8nJS6PYJtzfW8dOUYHJwBNaYlTuRyxp7sDxbR9FESDy6yUb6TFpn7wSZZzRp7SP9Dp1IN7uD4DsjFAb33TmUSTIyeLquuzkeS6ESMVJzLSv5Km22Bf0L7DRUbDi7BSR02Gg=s0-d)
Step 3:
I launched Hackbar by pressing F9
![[Image: mantrahackbar3.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sPbrp1AITeKSPyX2X6eggUoAJm1k0r5XE64fdQ_5AA6V9aYO1uxiOWDtA3_1PQaVDrLYc5yVcC-blsvOj4YTBfB7iGRibTtND6_yWvF2ej5VUXlBQrbdj9f-W3J0r5BdsA0hrpo_jPqT3234iUkKNp7n9QrHBZgdSJzx5PwBjRt1GF9w=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_umai8ozp5fhl34IAbsnX6wbZxwq8jFBqckL9iCVWMsPDC1H7sETIT1oedbaYpAubX9KWs-_UU53Ua9AxUGHTVPXXrUoenDG_l-GHi6YJA5e_Nl4cFfpGQM3JAakj9L3GgGL1-wkE8pc71Sm9xzH0LcJQYujgZnIBfeYwWA1dGNfqMsPA=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_tVhTyOBuCYryVp-27zN2kiP6_12KrOyVcwQLNmw00850R-XQ_r0xANnkG33XhzPZ7F-_2gfXeyYqIdsMNVAuThu_CjoCMKv_oNnNGfgtNwXM5gjLUzbsqXMSBgAtSNqF63Zuem44NtgvF3gcinlBm78N3mkvvPJp7KsGt05M3Zh1xMkQ=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_u5sir92W9Nss67tu2_yskZ-84V_3ACK8psIWtPMT-iaTbJwMZ5XLAZ6fS4dZ4mls9PlngkACfzL3xCPgrIi__4azCa39yQduPrbDbSba9QsMcEwgQxlAnI40cgvy4qid5IEBkcuLJfJKO52G_RqTTWZ0ujy_3PRtU_0Vbl0hTD2-_Y=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_tJ7Rx1kJZgVBe6_u43U55lM-lQfWq0Ic5w1E2p_qAJ3ZUYNRd2TgWGb6XEvMP3VhE-2n-jEbe4GttYqY_O4vydsdk-b0JjgUduKGxWXLZFRnFqe5UYBNPjnxzpd_UX2wm6UKyskqOa2S2nBuKi8A5VhFY9waOFVw_SGrNBy1kU7e_k-PM=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_vpKb9ScOgWQi_gjGxzFHxyuYI00GNbv4gHdKT-Jcen76t6zqd7PZEcKLsxg27qoFn4-pVRRGnbHc2jXr_lcWeKBMzon3MXTc_MMBeNBg1vq_ocO15Ghcc6HWahSKIQTvy1c42MbVRQ5Z-AB87O54SeT08SoH12TleSbbElIHrRmVjDwvk=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_sonY6581_3TEAxMx4MEq5Yd7rxfc15gsNsaTbDcCilOHCu1bZ4BV5293V_FCZhLK3trpaAgeDcxPZgU2zoyRa_dWmIuhetJDbK0VyAuG2jXZ4pVCyBK5f6w4HlWWOb5XAfTOqE3nHFFPwe-HhMQ0ZPc67cEal7IyhTUDsSOtL2iAVcKKg=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_uXSnyfxmeJ0qK_A7WxS6g0M-tzxMTIFSvxpkZJnaxBVfMc3vQseLzV_31FUC6R2S4M79HBQuTcBpBljEnF_eDfFUPrVaHokMwqfCDKWlniYQmZUADG8KLwAtai2wtyGfi5bZIWYdNnfyLCLe_qr3Z_bKs30HQ8ktcIYzu1fe479wtt09M=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_v7rDutEdRJudLzGgu8hquKGYdIVpvaaUMoaY8BPGU7SsAyfLj0mwSFQYoO4femRW9N50mpxCaBiseBh06nGa8YPM5sZlzocZNpVCe6OGr6Lu7e39C_UC0ZPgmP5bZ5ukzm3dMlkky2DoBSO3LsJ9ZlTeeClAJqpVEB1wDFX0WV5fRD5Q=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_uv-HU0w8y_n9_ZJZn5td0Ywm3gO0fRClnzQoaNeE0MPNHvCI44GIhRt1TR_LPyi_vdCCr4EStSO-UnXVl4rudtFxKrw668jHfrkZkVPlYBBUTTnTQY0ZmYCoI8aGOO55WQLH_0v3QB_IErl5c8OFNMjVmYZSgF5CpiLQWDZC6m1h6vkvA=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_uKSnQTiOVShonv4ddkLcI-Od7mM_9LvZ3CLf2ph2RrBXiwGPs-7gJtcFplNjzh3Fj5vdZL-vLhVmC3uVH8z4NCLk8DJMReLsUDtKtJbmjZGz1dHIl5AWZc0r5GwyDZi0NiQKWmTh_vPYl7ju4rZy4Fs1v_84P7Dyg06uNboYSjLfNqzLY=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_tNcBD_duIal9GCfXFoumIh9sfbjZcO7QUkZ_DU5zP5jOEVbFLkp3Bq0gjeiSQbcW8Xb_z4xfSTComsaRn6TJkTAXOfGTn-KWaNKGi9dSvfeupPn1dqnYa2KSajM6_yBRSI91Oz5iPVgBLGX-hv1MCAH-VbtkTlyN6HtZke4GX7jCtKWQ=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_vp3y9cDsuTMr72zRPpMV_OTd-U2lz4K90znQrnPUjnqKmJuz94nNEKuHnurFVnYmGnBAxBf2lG1Y4TpOkSJTlnO8FB52GWwHtXQXQIpTQUEeveeQDU0bCMymLaPiWhejALobLAuTJf8HguW1QEvqdRzXHHxvzbgTdqdaeeFItYipqkvQ=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_tdzFvN1yD1C8_6itM8KkFY4kNVepQIa5n62aCPrsFeVJGnTVkJ9REWsV3W-VNsmV3f77UzmNRisBref4oBbFvUC0uMudq8eZk1a4Jmwe2LBl4nP0d_52DTaXcRElbLSdXryLEKQ7h1LxPzfX1OfBCGQ5TnynLUV1wLzADFE3bhyp61VEw=s0-d)
Step 17:
Lets find the user name
![[Image: mantrahackbar27.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_th2FqGxrQvyYiKWsq-qoddQbu2Zp7-JIk3XpskmtWi313xcTg4CjggLEFFrvfSQrSuyJ0w26cwYg0GrWSn6mQLV1vBldy8jNixChIsQIpcRa2hExFITuFqDpSWyIjWIErpOiQptontDjpMfsyw9ThSRiorAx-PyDzkFj8twk7YjoUm6SY=s0-d)
Step 18:
Now, what about password
![[Image: mantrahackbar26.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uKoW0AaLa7UEV1sItFHUGWtW3p5SpIJHMiQTcrkxJ6BRVHETpbLC7rvdGIjcRvL-TOF6Yeb8JnjbHRBBX6JLDQvNS_GqVMErFGQtOf3alGPpUdHI6Fh_Hgiy2TKT2lN_Ilf4BKtmUCVnpEXCyxeOkLSI4Ay_mIVKqpBaY1HCjoKKHh6HY=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_v1sglRA6RGAFOwhMw4p06RB8gz7xedlOUaI_OZ1pi_G-dUiV-bBsynz2CH8AEoWBTmjKRkqMPmW0_mYplzSdqd70mOosRZgt5xjNwd909Ddf_-zSuJTKSWc_T2spqTsKznpSbSzy2qFGTiPgDCE6B2Krni_DZOHsBrbmvTMD6LlOVvC88=s0-d)
Step 20:
Voila.!!! I got the password
![[Image: mantrahackbar31.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vD1Ts3J04Ak0_FsWL3pTN9-uzP_wDA1MP7RGLDIt86xTDISyIb_pYuSiUBlVXKBsYDqAYSdloGcCmfJvDHN-wFyqD7NYkv9Lz-ZVaa4AbAplOrBozSIS6D4NHpJNxrRbKVIc3cS9pkiUFUtqaSqViL0YewxEBMsyXCbe6dDdS-QgHAGQY=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_tg5sRENhoxmjUMbYLFUWmE4AtMoxYLr3fIUHIFcV8_ZAWBbOZKsaKtpRM6q_9Z8Edbmgw0Z-DEiz_9s7BRvuD35VLwOJNcyjL50qzMwCoBVg2tBEc4vnwrqktcJOPblLWWQ5rnk01UOxxYbw49YdG-Lw1N39S2IekySO_mZtnMos7-Lo8=s0-d)
Step 22:
Logging in with the credentials I have
![[Image: mantrahackbar33.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_v4ysbJGNx1kpJYm1U_N9j-MFJl9fS4ImtYgZgmkWeWBbBybL1lgJvE5Jzmaw34ImXcznwZRvqphlOWSPjmsVJ5C5YnpJvlhQVWoMM7t-QMuR1ygZ6atIluQiVC7BS0jtTsg8F7nv274eOGunDTfoG2PQU99gAfx7lCLTMHhTBuOC7Ef9U=s0-d)
Step 23:
Greetings.!!!
![[Image: mantrahackbar35.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tjqJx3nVvAOvGNHmeQM-moLav3sSgl2ZQAyanhrBZ4XWEI7cBDkJRMF9FWH0mRIZJJKHdnb1kp4zOeMlK5XnW7P-sRNlHVgPbHar5lM-TGGTu2tRTS8rsc66oBte1YdLZC9N_HIPCWB2shfdL7JgYExp7toGt6GZXjUjwDS9YEgxLc3hE=s0-d)
Step 24:
I'm an admin now. Look at my powers.
![[Image: mantrahackbar36.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tHznV78hih0zqV82IcXScWvevGS9xIZKQy6nST9Rj0ItIwhhscdtNmGKEQKfdDVvXgxXJ23VjDV9Dg1PAp1US2DmacKIxfyd3gj5Xw8t4op3K4pBAPdL-TpRaGDtCpvOlf88fDhUq9hueBxKsSrHpHEqT2aJZ6IdUQF7_8rNSaYUiVYXY=s0-d)
Step 25:
Let me add an event
![[Image: mantrahackbar37.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vvfYK5tJT0jTY3ejy5ajjx8qhNSEgD6ukzwZ8desr7toS44wP_1qlFhN6Lni27AWCbIT99C1LSWQ3TAcNf0YrnRmdlTUhzy9JhsgRPCY0dTx4sbN_60CqdajiJgD73D2_sp5ECUBmOjyBBTxvBJOZINQ8qJ4XWKGDm8_zumGfcedy75Q=s0-d)
Step 26:
and of course I want to upload a picture
![[Image: mantrahackbar38.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tRGdtrG2W1OgYeFZcInGEJB6LRVufkvZhi3sukvcrx-jitzgiZDLc6kbFV-bIg5VaC3E-OlbxwZD6-yLpNe8keAHT8zkgeBka5eV4oxDqk7U9CvSAUceUTaYXE-U8VVXIj3N0F3bkloz_dovnw4YrqdR38bsFIHmOROsbXGHN9YpgmzA=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_vRhmlMmjf4CXC1tu0xVhvhOemf055_zlWJOZdqN5w4BxZZaHmCgywhe51sR0rtBpdG1LABMwk7uEF1zKWz4NxMot-6DEOHoaW1miwx-sBlyDeIemIdwI5GFLslmJ40VYVbE6eJ7WxNXNbEmN1SovX6Fd-9Kz7p10LIHeMlcfdxAKWBRu8=s0-d)
Step 28:
Now I'm pressing on "Add Event" button
![[Image: mantrahackbar40.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_v9yADRb7UBqfdrdnZY5Smy7TqwOZJ0SKh4HkHjSAsnUrCNKDRDwpY6EJ67zzal-9m8_vNsa_ni1AeHAkZLvUh7r9ifCCF3avSEJVfzUkp0TD9sADJhqPH3Ymn5m1v-Qi26B2EsG33tLpfcm95xeDJSexKxWFZnJpd8QI06H9dJrG1iJ3I=s0-d)
Step 29:
Nice. Looks like it's got uploaded
![[Image: mantrahackbar41.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vv3kHH9UkeXmVeMp0_DlMNSjKC49szKCHSzGGqd8QHV6VJzOzCF_RLITF0wdvylxfEGwzJsSsufhpGu5Mom8bTQav5h03u6wM4nMR7hZhIr5NEC2hpwBuIDNgHF22uQwDTPchc4ArjLZyTgjkkSHDc9CNKCtDgiHjLPsQi4Hk7sEnB6A=s0-d)
Step 30:
Let's see where the shell got uploaded to
![[Image: mantrahackbar42.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_t-GRhhUKMOBxvjKtMlNh5VltEFIoja12KJORSYOudStrv_KSa-opf7Zv2fi9-v7OlDSbeHnbAGar1AdQc9h0lx7H1FC7KeIbok3FVXolMQPBdYDj-N6ssy5Dq_q02B6lud9OENnWvaeseYjyF3wXjKisGL7lVXpRTTfSTbmioj_QO24_M=s0-d)
Step 31:
I'm trying to get the default upload location
![[Image: mantrahackbar43.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_ss7cQKA2Kmkg8DfKQtBREcW1-vzITmJyHDYx7rsAci23pEZfufJjm3CitkRPz3SozFhPacelWfydLsfmT_KmhndtKYIMdF1gvoSpelugWWynle62LrxiWFi4fxSsm246hrfrmyE9kXG6O24EqRKu98r6FgArrK8e2kFlt6habZcW-XlxI=s0-d)
![[Image: mantrahackbar44.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sRlpu7P_PEj50JV_yZ6s0IlLL1pIJ3mSt4RELA5n2ztFfGY1_Xd1q74MUJKem_A7VqHeqGMus9pr5kBQV0l5jw35FmfraquEXNRMyx6i6BOSJLuauiu8-fOQBcXxM1mBZiCnn9O4tgXfLKsve-9HpjHcXqiJ1Z__in293gSOtpeDiosoA=s0-d)
Step 32:
Looks like I got it
![[Image: mantrahackbar45.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_scEehdhnUzOKWi8r3nwpkUAr1QVCpWpL4X5CX3iGoJkoIuFpSTkXFz-UbvNrmNA_ryNDd8RzLNQPKzgKy9iGvd15G7UidZYm94-LUNq7Y_0Nz8WAsGHsbLNCUcSjcVPnX_KBjLGI2Z5viLJSQtM8pxu42l2YBHQweYTyqaaNyrUfprZQU=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_uoK3yq5q1mAECi5T0mW2EKmEL-rjns-QNzdsS6g3ONtlbV33SL3P5CwgnmgPZBtsspQIe5HdaO153KyWZ2segNPz4_Txx5XHAktoqsLLfx7EYfQR-B2BYqdPqaqCxx-_0BO-Tz3a4wMOcV_RvxzrZ0QopIyb3PrKNbSLihqzNSMalAciA=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_v4n3SbGdJiNfnwzU_2rhAjASz5Ns-bOQh0T1fY00b7ui6YXyv6X7A5aY4TvPwfHRCZIZwpOpfwvrPNyCpJSOamf0E6kTq9WEr_6D0G2AXnyesrPZCZg0JPXDTQQ-_2EYRFVGzjAnb9Ce4fxTCEZkPIukvtEp5KEf0WhrEpelGN8VY4TD8=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_tM2YHDekGuTjXHzrfWK1aAJdIAGxZiKobJ3OR9dC7reFIBr87Ugw7jtvafVgTIRmuWs-WwDIacbu13efuqc1-h5asxMbz63h7KgKHwK8jEjYfV2aps4UWkzUM3m0iixI4eSOuxuUFlmqMUN5G8lCZiDWX8hdo2sSm8GvmZc-rc99r2EYk=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_ta4Z-UllAMKuyW9PSp1E10wTG_rhdC54qqaI5eaUSR5dYFKIrxPmFhef4tHV6CJOD38n9D2TBbMMWNoZmZaMgkC16GwQlFa3dwGt7-RjuF2eYnVFc5Z-fSKLTyfuYtcxIrCemi_eRopIONpLgFPJGpYHAgbKT3OAbYmFZ9TLGqb6HqhQ=s0-d)
Step 37:
Let me go back and edit the log file
![[Image: mantrahackbar52.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_s-o5jLcYSI7nxfqWkDwPNpGlCWeRdahjS0EdW1HhSGpnK_OVZSGlXqriDYn5Sk6DmZUC_y_rO_D0xA6Qs_P_g9HcvUTHSZdPIQwVX-TyF3cs0Bu7uNtiljfPax6jhnEQl4doO-1KD58DPiMZ-4qOML-Ierr9AxMwU3h9rI6sccUsIZO-E=s0-d)
![[Image: mantrahackbar53.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vQ3s4_GXi6uCRgyWg8QsRJLmnTbHZqqgDPXDpvsTZuejAQKO25BhGJp4AJDfd_wwfG8TzEqYqJdTeqLKoauZrKpnnlGZ-H16Yu00_Y9R6zlWgXSUOHHyr3KPk0gd87bs4aSgBf-AQuST0L47NOU7IDtZTCpiFqDBSeHubctxezI3ov8g=s0-d)
Step 38:
I deleted complete log entries. Now saving it.
![[Image: mantrahackbar54.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_scqyGnFlJZxoWSqVZBvf7-7hQ_ZTJ9Hm-tQ7XM3Tk3FzQ64EnWeHXhxfcsd48oqwvUpBWK4PKxmR4XCU60w6ePGDXMAeW91eUKRXdvjsrFch-dWog9swVv5S9e7zJHG7lmjBk7cVU-p-ldsiLmea5zA6qKT5z_D7Da-4_Xm2gPZPZRtNI=s0-d)
Step 39:
Nice. Log file is empty now
![[Image: mantrahackbar56.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_u0hJ2o4IUp-e6HRn0Flb3vRsS7HCoMZ4zw3qECdQirjrp5d5zvB-wreulTfp4bNpNcGc21-nwVZqPR6fuY2AcnLVGvFudLQED-pDe4r_fkbVpLyRQrhhcMNtSGbrEMEW0ctnwWkJnKFvZG9QVHVkZJc4AwuzSSUu2A1v4ZeBfkCg2bkP4=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_vaHYJopbomzto8KaiqKlowMq8cAslrI2bLTUkmDb8nCiiaiFiySK0PGwgZDXCCnYUCZUPPwLEpGhiBWTyGnfXJwARus9rWs0AWc8z9FkOxuv9GtKmPLZzYVIhyFPOWd4hzwSHXPqfRD78R997psAJqilZFHd2BFmgWx8BZSNlH2QiTykE=s0-d)
Step 41:
Confirmed.!!!
![[Image: mantrahackbar58.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tjtNueGFtVwsEZ5Cd4D25uTnGEIN3LJqu2eJCVmln0t3iO2TRA1MoB2KEfXkFMwYUL2j0avIp1T2myYEVjhtsmOxnck3485ef9bef1EPGJwUF3U1gp_KgWawh5SOAwIbm5yJ1EhvF9xg04rEjkc5fHRybaIuT5ANvkLL1jS44G-4Q5GJ8=s0-d)
Step 42:
OK. Good Bye C99
![[Image: mantrahackbar59.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_v-490xNWcJZrxOsVLy2v8_xMc0a_BoYhxdjsAdPjZjd9WsSlEGNkYPpA3rIwUEOeddFOOD-YTl-VgU3YEqxgBO2GXGUR41-vEncdvY3e2cAx75rQLXhgIDJ5mxOfN1PlVpyWLRtqX8q9R-oikJb2nYPhe9IsU4vcnPAUqHWCQTs0cJKw=s0-d)
Step 43:
Well. It got deleted itself
![[Image: mantrahackbar60.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tTyy5g5f0JupnXmWnRmRBEsvXMhLzDZjBgYKYbMKQ_mVK-uVrRPvxZxDg5mK61cuYaHlImmISW1ikzllfU0U_DgPIU3dfZ2kaMSl_grb10sVcwpXlE40Ea7VE-YbDfgRb3XH6CRkWC8QePFMNKGKcLIMb55NmbXn-RErdPO3jW6by1OLs=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
Tags
bypassing