VERIFIED ADVERTISEMENT HERE


VERIFIED & TRUSTED SELLERS    ESCROW SERVICE    FEEDBACK ABOUT TRUSTED SELLER

Text Example

CHECK OUT DARKWEBMAFIAS TRUSTED SELLER BELOW

Website Security

Proxy

Moderator
Staff member
Moderator
How Can We Block Common Web Attacks And Protect Our Website..


A: SQL Injection


–>Types
Login Form Bypassing
UNION SQL Injection


B: Cross Site Scripting


–> Cross Site Request Forgery


C: File Inclusion


Types-> Remote File Inclusion and Remote Code Execution


On this post i am telling about five types of common web attacks, which are used in most types of defacements or dumps of databases.


The five exploits listed above are SQL injection, XSS, RCE, RFI, and LFI. Most of the time, we missed out some website code tags..


coz of this we get website attacks and allows the hacker for attack on vulnerable website.


A: SQL Injection


–> LOGIN FORM BYPASSING


Here is an example of the vulnerable code that we can bypass very easily:


index.html file:
<form action=”login.php” method=”POST” />
<p>Password: <input type=”text” name=”pass” /><br />
<input type=”submit” value=”Authenticate” /></p>
</form>


login.php file:
<?php
// EXAMPLE CODE
$execute = “SELECT * from database WHERE password = ‘{$_POST[‘pass’])”;
$result = mysql_query($execute);
?>


We can simply bypass this by using ‘ or ‘1=1’, which will execute “password = ”or ‘1=1”;”.


Alternatively, the user can also delete the database by executing “‘ drop table database; –“.


PREVENTION:


Use mysql_real_escape_string in your php code.


Example:


<?php
$badword = “‘ OR 1 ‘”;
$badword = mysql_real_escape_string($badword);
$message = “SELECT * from database WHERE password = “‘$badword'”;
echo “Blocked ” . $message . “;
?>


–> UNION SQL Injection


UNION SQL injection is when the user uses the UNION command. The user checks for the vulnerability by adding a tick to the end of a “.php?id=” file. If it comes back with a MySQL error, the site is most likely vulnerable to UNION SQL injection. They proceed to use ORDER BY to find the columns, and at the end, they use the UNION ALL SELECT command. An example is shown below.


http://www.site.com/website.php?id=1′


You have an error in your SQL syntax near ” at line 1 SELECT SUM(quantity)
as type FROM orders where (status=’completed’ OR status=’confirmed’ OR status=’pending’) AND user_id=1′


No error–> http://www.site.com/website.php?id=1 ORDER BY 1–


Two columns, and it comes back with an error! This means that there is one column.
http://www.site.com/website.php?id=1 ORDER BY 2–


Selects the all the columns and executes the version() command on the only column.
http://www.site.com/website.php?id=-1 UNION SELECT ALL version()–


SOLUTION:


Add something like below to prevent UNION SQL injection.


$evil = “(delete)|(update)|(union)|(insert)|(drop)|(http)|(–)|(/*)|(select)”;
$patch = eregi_replace($evil, “”, $patch);


B: Cross Site Scripting


Cross site scripting is a type of vulnerability used by hackers to inject code into vulnerable web pages.
 
Top