Jump to content

Title: Record any file to download it to getshell

Featured Replies

Posted

0x01 Introduction

One day I had nothing to do, so I searched for the xx system on Fofa, thinking about trying my luck, and similar

1049983-20220119225612527-1364655911.jpg

0x02 Testing process

I picked a website and opened it

1049983-20220119225613163-1439267662.jpgEm…, try your luck, backhand admin admin enters, it is a management system

1049983-20220119225613562-313120700.jpg Then, according to the website's functional points, click a few randomly, and found that there was nothing but regular operations. After searching for a while, I found that there was a file download operation.

1049983-20220119225613876-1349432502.jpg

Good guy, it's hidden very deeply. I caught the package and saw the requested address. It seems to be a file

1049983-20220119225614402-159575045.jpgfileName is changed to./etc/passwd to see, good guy, I reported an error

1049983-20220119225614938-1294885574.jpg It seems that this path should not be the one. Then I tried it one by one././etc/passwd and././etc/passwd and both have 500 errors. When you arrive, you can access it.

1049983-20220119225615472-1186122569.jpg Let’s see if you can read the historical commands. If you can read the historical commands, you can see if there is any website backup file or website installation package. Hehe, change the path to /root/.bash_history, access! ….500 Error

1049983-20220119225615994-2012918871.jpg It seems that the permissions are insufficient. There is no way, start from other places.

Next, you can check the website source code in F12 and use the iconic statements or files in the source code to search for the same system. Maybe there will be root permissions, probably like this

1049983-20220119225616528-1337144661.jpg After having the same system, try weak password again

1049983-20220119225616920-100761018.jpg Maybe I have good luck recently, and the weak password has entered again. hey-hey

1049983-20220119225617369-1237355266.jpg Next try the operation just now, download the././././etc/passwd file to see

1049983-20220119225617822-1470359648.jpg Try reading the history command /root/.bash.history

1049983-20220119225618270-857525528.jpg You can read the historical commands and slowly flip through them. Finally, you will find that there is a website source code.

1049983-20220119225618653-1742935129.jpg Download it with backhand

1049983-20220119225618998-757262743.jpg Decompress

1049983-20220119225619315-1947083995.jpg 1049983-20220119225619680-1165688496.jpgJSP's website, I have never learned Java and have cracked it. I first built up the environment with the historical commands, so I deployed the same system on my server.

I haven't learned Java, and the automated Java audit tool is still charged, so I just use one method to do it manually.

1049983-20220119225620165-708289661.jpg After searching for it for most of the day, I almost wanted to give up.

However, this system has mysql, let’s take a look at the structure in the data first. Probably this looks

1049983-20220119225620586-481103708.jpg Then I found an account that comes with the system in the table of the management website users (represented by account x here). Account x is higher than admin permissions.

1049983-20220119225621169-770288268.jpgPut the password to cmd5 to check

1049983-20220119225621575-1976315723.jpg Want money? I am a lot of poor people and have no money. I look for a good master and check it out. The good master is very quick and I replied to the message.

1049983-20220119225621999-891368438.jpg Then I used this account x to log in to the system I built and found that I could not find out that this account existed on the website, which means that it might be left by the developer. Hehe, with this account, other systems can log in.

Then I found that the system has an upload point to upload files. Since they are all in the white box, you can deploy a real-time file monitoring tool to see the changed files, or to see if the files to be uploaded later have been uploaded.

FileMonitor is used here to monitor files

1049983-20220119225622414-783233812.jpg Upload file, grab package and change the suffix.jsp

1049983-20220119225622849-1570156655.jpg prompts that upload failed

1049983-20220119225623276-2048107424.jpg Check the file monitoring, it can be uploaded

1049983-20220119225623680-1104630029.jpg suffix is controllable, but the file name is uncontrollable, which is troublesome. Generally, file names are named after timestamps or specific algorithms. If you upload them a few more times, it doesn't seem to be regular.

1049983-20220119225624147-1308714869.jpg Look at the class file in the downloaded website source code. Look at the requested address

Image should be the Uploadfile method in the upload class (I haven't learned Java, I don't know if it's right, don't criticize~)

I found the Uploadfile method and looked at it one by one. I was dizzy, but in the end I found the method to generate the file name=-=

1049983-20220119225625149-1811091206.jpg Let me see what UUID.randomUUID().toString() is

1049983-20220119225625633-667069781.jpg Three parts: current date and time + clock sequence + globally unique IEEE machine identification number (network card mac address)

Suddenly, I thought about it and could find a way to get the first two, but the mac address of the last network card is very difficult. Any file download cannot be downloaded with the mac address of the network card, and another road is blocked.

After a few hours, I found another upload point

1049983-20220119225626147-800504049.jpg File monitoring

1049983-20220119225626548-1854421406.jpg Direct transmission to horse

1049983-20220119225627041-1428346929.jpgEchoed the address

1049983-20220119225627401-450524635.jpg Ice Scorpion successfully connected

1049983-20220119225627845-114544922.jpg Finally, use the system's own account to log in to the system, and then use the second upload point to upload the horse.

1049983-20220119225628330-1035735350.jpg

0x03  Summary

1. Search for an open source CMS system through fofa, click any target site, enter the weak password admin/admin to enter the system 2. At the background file download, http://www.xxx.com/filenam=xxxx.xls appears, then there is a vulnerability to download any file in these links 3. Use bp to fuzz path, try to read././etc/passwd and././etc/passwd and both 500 errors,/././etc/passwd can read the content. Then change to././././root/.bash_history, and the error is 500. 4. Any target website of this test cannot read history records. Then search for several other similar open source cms systems through fofa, enter the same weak password admin/admin to enter the system, and then you can also read the././././root/.bash_history content normally. Display the records of the target administrator's operations, including the name of the compressed package that backs up the target site and is saved to the root directory of the website. 5. You can directly download the source code compressed package in the root directory to the local area and perform code audits. 6. Found that the target source code contains the website configuration file and the backup file of the mysql database. 7. By building an environment locally, the target system can run normally locally. At the same time, it also monitors file changes through FileMonitor (https://github.com/TheKingOfDuck/FileMonitor), and manages the database through phpmyadmin. The system's own account system and corresponding password hash value are found in the database table, and successfully decrypted through md5, and logs into the local environment system backend through the system account. 8. At the file uploading site in the background, there is a file upload vulnerability. Uploading test.jsp is prompted to be successful. However, the monitoring of FileMonitor shows that a new file has been established. Although the uploaded file name is not searched, it proves that it has not been uploaded successfully. 9. By searching the upload keyword in the source code, you can know that the rules for the successful file name after upload are: current date and time + clock sequence + globally unique IEEE machine identification number (network card mac address) 10. Another file upload was found in another place in the backend of the local environment system. A.jsp can be successfully uploaded and the uploaded file name is returned. Search for the file name to know the saved path. 12. Finally, use the system-owned account system to log in to the target system background, and then use the second place to upload the horse. Original link: https://mp.weixin.qq.com/s?__biz=Mzg4NTUwMzM1Ng==mid=2247493857idx=1sn=f7db570914d9e4b4f517ab05b5e5d380chksm=cfa54cf2f8d2c5e41b2636bb3e6a9961617324182a2dd93b52a1fa3bea9dd42d8ed96b377bb4scene=178cur_album_id=1553386251775492098#rd

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Important Information

HackTeam Cookie PolicyWe have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.