How Web Pages Are Hacked

Stopping the most common attack:

Ok well, one of the easiest ways of getting superuser access is through anonymous ftp access into a webpage. This can easily be secured against. First, you need to learn a little about the password file…

This is an example of a regular encrypted password file. The Superuser is the part that gives you root. That’s the main part of the file.

This is another example of a password file, only this one has one little difference, it’s shadowed. Shadowed password files don’t let you view or copy the actual encrypted password. This causes problems for the password cracker and dictionary maker(both explained later in the text). Below is another example of a shadowed password file:

Shadowed password files have an “x” in the place of a password or sometimes they are disguised as an * as well.
Now that you know a little more about what the actual password file looks like you should be able to identify a normal encrypted pw from a shadowed pw file. We can now go on to talk about how to crack it.
Unfortunately cracking a password file isn’t as complicated as it would seem, although the files vary from system to system. 1. The first step that you would take is to download or copy the file. 2. The second step is to find a password cracker and a dictionary maker. Although it’s nearly impossible to find a good cracker there are a few ok ones out there. I recommend that you look for Cracker Jack, John the Ripper, Brute Force Cracker, or Jack the Ripper. Now for a dictionary maker or a dictionary file… When you start a cracking prog you will be asked to find the password file. That’s where a dictionary maker comes in. You can download one from nearly every hacker page on the net. A dictionary maker finds all the possible letter combinations with the alphabet that you choose(ASCII, caps, lowercase, and numeric letters may also be added). We will be releasing our password file to the public soon, it will be called, Psychotic Candy, “The Perfect Drug.” As far as we know it will be one of the largest in circulation. 3. You then start up the cracker and follow the directions that it gives you.

The PHF Technique

Well, I wasn’t sure if I should include this section due to the fact that everybody already knows it and most servers have already found out about the bug and fixed it. But since I have been asked questions about the phf I decided to include it.
The phf technique is by far the easiest way of getting a password file(although it doesn’t work 95% of the time). But to do the phf all a script kiddie needs do is open a browser and type in the following link:
http://webpage_goes_here/cgi-bin/phf?Qalias=x%0a/bin/cat%20/etc/passwd
You replace the webpage_goes_here with the domain. So if you were trying to get the pw file for www.webpage.com you would type:
http://www.webpage.com/cgi-bin/phf?Qalias=x%0a/bin/cat%20/etc/passwd
and that’s it! You just sit back and copy the file(if it works).

Telnet and Exploits

Well, exploits are the best way of hacking webpages but they are also more complicated than hacking through FTP or using the phf. Before you can setup an exploit you must first have a telnet proggie, there are many different clients you can just do a net search and find everything you need.
Kiddies will try to get an account with your target(if possible) and view the glitches from the inside out. Exploits expose errors or bugs in systems and usually allow you to gain root access. There are many different exploits around and you can view each separately. I’m going to list a few below but the list of exploits is endless, so make sure you check a site like bugtraq.com often and update your server often.
This example is known as Sendmail v.8.8.4
It creates a suid program /tmp/x that calls shell as root. This is how you set it up:

and now on to another exploit. I’m going to display the pine exploit through Linux. By watching the process table with ps to see which users are running PINE, one can then do an ls in /tmp/ to gather the lockfile names for each user. Watching the process table once again will now reveal when each user quits PINE or runs out of unread messages in their INBOX, effectively deleting
the respective lockfile.
Creating a symbolic link from /tmp/.hamors_lockfile to ~hamors/.rhosts(for a generic example) will cause PINE to create ~hamors/.rhosts as a 666 file with PINE’s process id as its contents. One may now simply do an echo “+ +” > /tmp/.hamors_lockfile, then rm /tmp/.hamors_lockfile.
This was written by Sean B. Hamor…For this example, hamors is the victim while catluvr is the attacker:

now on to another one, this will be the last one that I’m going to show. Exploitation script for the PPP vulnerability as described by no one to date, this is NOT FreeBSD-SA-96:15. Works on
FreeBSD as tested. Mess with the numbers if it doesn’t work. This is how you set it up: