Linux-based intrusion from forums to SSH-Linux Enterprise applications-Linux Server Applications. I was not used to QQ, but a friend called me to ask for help and went online. I used QQ to display the wooden version of the IP address, so I saw my friend's IP Address: xxx. xxx.19.24 and found that my friend was surfing the internet in the school lab. I suddenly wondered what was in the machine in their lab, because I used to know that the machine in their lab was in section C-what? You asked me to send a Trojan horse directly to friends? The boy is more refined than the monkey. Besides, the boy's technology is not a fuel-saving Lamp. Please use a roundabout strategy!
I used BluesPortScan, a scanner from the treasure chest. The scan speed is extremely fast, but it will be missed. Scan 30 machines first, Port 1-150. After scanning, one machine caught my attention: the IP address of the machine is xxx. xxx.19.7 and ports 22 and 80 are enabled. Port 22 is enabled, and port 8 is a Linux machine. Use SecureCRT to connect to port 22:
TIPS: port 22 corresponds to SSH in Linux. This service has many weaknesses. We recommend that you run SSH on other ports.
Port 79's Finger is not enabled either. Currently, the user name is only known as ROOT. The password is 123 first, and an error is returned. It seems that it is necessary to start elsewhere. It seems that only port 80 is enabled elsewhere, and then port scanning is extended and port 3306 of Oracle is scanned. However, the ROOT password of the database user is not empty, I cannot run the dictionary? Go to port 80.
Telnet port 80, and then GET, and return the Server information: Server: Apache/1.3.27 (Unix) PHP/4.2.3. If you are using Apache server, do not consider the WEB server's own vulnerabilities. Please visit the website. Enter the address xxx. xxx.19.7 in the address bar and press Enter. When the web page comes out, it seems that there is no virtual host or something, which is something that students do by themselves. However, although the content of the Web page is relatively official, it seems that the website is broken. I used PHP and HTML to make a news system that seems to be completely unrecognizable or self-developed. I tried SQL injection in the article management system. I didn't succeed. Forget it, go to the Forum.
When I entered the forum, I used to log on to the admin with the admin password. It turned out to be a success! Find an upload point and throw a PHP backdoor! Next, I was disappointed. I couldn't find an upload point in the Management Panel for a long time. Don't say that I uploaded my profile picture, and there was no profile picture in the user information. Which forum is so popular? Look at the bottom of the webpage: The Code of this Forum comes from xxx.com. The Administrator is not bad and the copyright information has not been changed. What do you think of here? Hurry up and change sensitive characters on your website? Haha, it's late. Enter xxx.com in the address and press Enter. Oh, it's a good personal homepage. Check that there's a micro PHP text forum in his work. That's it, fortunately, I didn't try SQL injection in the forum just now, or it would be a waste of effort. Download the package and try again later.
After the download is complete, decompress the file and find that there is a DB folder under the root directory of the forum. This is the so-called "Database" of the Forum. Open this folder and find that there are some. the dat file, opened in notepad, is indeed in text format. The alert eye immediately stared at the user. dat. Open, the content is as follows:
Admin <~> P | lcv <~> 3 <~> Ecawen@21cn.com Peking <~> Http: // <; ~> <~> <~> <~> <~> 3 <~>
2004-01-01 <~> 1
Admin is the default user, p | 1cv should be the encrypted password, followed by "3" representing the administrator, you don't need to read it later. Enter xxx. xxx.19.7/forums/db/user. dat in the address bar, and paste all the content in IE. Save it.
Well, find the key point. The original user is generally the first two. It is the administrator privilege. The username is aaa and the password is 4 $ @ A % G, the password is cracked. According to people's habits, the system password is not far from this, at least a huge step forward. Re-analyze the Forum code and find the encryption using the following methods:
Function t_encrypt ($ text, $ key)
{
$ Crypt = "";
For ($ I = 0; $ I {
$ I _key = ord (substr ($ key, $ I, 1 ));
$ I _text = ord (substr ($ text, $ I, 1 ));
$ N_key = ord (substr ($ key, $ I + 1, 1 ));
$ I _crypt = $ I _text + $ I _key;
$ I _crypt = $ I _crypt-$ n_key;
$ Crypt. = chr ($ I _crypt );
}
Return $ crypt;
}
There is another key. Where is the key? In a mishi. php file in the database, the content is as follows:
Algorithm used to analyze the encryption function: starting from the first character of the password, taking a character corresponding to the key and converting it into an Ascii code, then, the sum result is subtracted from the Ascii of the next digit of the key, and the final result is converted into a character called ciphertext storage.
The Substr (string, I, j) function extracts j characters from the I-bits of string. Ord () and chr () are conversion functions from character to Ascii and Ascii to character. The above algorithm is simplified: $ I _crypt = $ I _text + $ I _key-$ I + encryption key. Assume that the first Ascii code of the original password is x. Then:
X + ascii (j)-ascii (p) = ascii (4)
The Ascii code is x + 106-112 = 52.
It's strange to convert x = 58 to the character. Restore all the six passwords and log on to the Forum again. The hope is shattered. A wrong password is prompted! The Administrator probably won't change the encryption algorithm in the Code. Does the Administrator change the key?
Return to the Forum again, register a new user ecawen, password mygod, and then open its user. after dat viewing, the encrypted ciphertext is p | lcv. Calculate the key based on the downloaded source code of the Forum. If not, the key is changed. However, the file containing the key is a mishi. php and key are also in PHP statements and cannot be obtained remotely. In the browser, type/forums/db/mishi. php returns a blank page, because the PHP statement is filtered out by the server early. What should we do? After a few seconds, we still have a solution. We don't have to know the exact key, the secret, and the algorithm. We should be able to figure out what we need with such a simple algorithm.
Assume that the first digit of an unknown key is Ascii code a, and each two digits is B ......
My User's ecawen password (I registered, of course I know, I lost mygod). The encrypted ciphertext is p | lcv, so we can calculate it as follows:
(To Look At The Concise ascii (m), we use the ascii code 109 directly)
109 + a-B = 112
121 + B-c = 124
103 + c-d = 108
.
.
.
Look dizzy, in fact, we add () to suddenly open.
109 + (a-B) = 112
121 + (B-c) = 124
103 + (c-d) = 108
.
.
.
Okay, let's take out his administrator password:
X + (a-B) = 52
X + (B-c) = 36
X + (c-d) = 64
.
.
.
Restore x to a character. OK. Is the original password ready? Complicated? The more exciting you are! However, it should be noted that the number of user passwords you have registered should not be less than the number of Administrator passwords. Here, the administrator password is six characters, and I accidentally registered a five-digit password, the sixth place cannot be counted, but another user has to be registered, taking a detour.
All right, log on to the forum with the password, and log on successfully. Open secureCRT and log on to the system via SSH. the user name is ROOT. The password is the password that you just obtained. With excitement, you read the N-th question of opening the door! Let's go in. It's because it's a machine in a friend's school. It's useless to act as a proxy. You have to CALL a friend to back it up!
Later, we found that there was an aaa user with the same name as the forum administrator and the password was the same. Those ida, idq, and webdav have long gone, and the shock wave vulnerability disappears early after the storm. Now the attacks and intrusions dedicated to system vulnerabilities cannot keep up with the times, in addition, many hosts on the Internet are hosted by firewalls and IDS. Instead, we can analyze the comprehensive website defects. Starting with the website database, SQL injection, and other means are a boom. Therefore, the administrators are optimistic about every pass and every detail of your website!
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service