Tuesday 27 June 2017

Why do PHP websites get hacked easily?

Why do PHP websites get hacked easily?



First of all we are understanding what is php. The PHP Hypertext Preprocessor (PHP) is a programming language that allows web developers to create dynamic content that interacts with databases. PHP is basically used for developing web based software applications. This tutorial helps you to build your base with PHP.

The php format are below showing :

<html>
   <head>
      <title>Online PHP Script Execution</title>      
   </head>
   
   <body>
      
      <?php
         echo "<h1>Hello, PHP!</h1>";
      ?>
   
   </body>
</html>

What distinguishes PHP from something like client-side JavaScript is that the code is executed on the server, generating HTML which is then sent to the client. The client would receive the results of running that script, but would not know what the underlying code was.

The best things in using PHP are that it is extremely simple for a newcomer, but offers many advanced features for a professional programmer.

Now we discus Why is it so easy to hack it?

Vulnerabilities in PHP code are usually caused by a mistake that a developer made when writing the original code. It is quite common for a developer to launch a perfectly working PHP application but to not anticipate all the ways that hackers on the Net will try to gain access.
Most of the vulnerabilities below are caused by ‘unsanitized’ user input. That is, input from a user that the web application accepts but contains malicious code or is passed to a part of the application in a way that creates a vulnerability.
Vulnerabilities in PHP are generally grouped into categories based on their type. Below is a list of the most common kinds of vulnerabilities in PHP code
1. Remote Code Execution occurs when an attacker is able to upload code to your website and execute it. A bug in a PHP application may accept user input and evaluate it as PHP code. This could, for example, allow an attacker to tell the website to create a new file containing code that grants the attacker full access to a website.
2. Cross-Site Scripting or XSS occurs when an attacker causes malicious code to load in a website visitor’s browser and execute. This code can then perform malicious actions like stealing user cookies, which can grant administrative level access, or performing functions as the user which can grant additional access.
3.PHP object Injection This is a more complex attack that occurs when a PHP application takes user input and passes it to a function called ‘unserialize()’ which takes a stored object and turns it into an object in memory.
4.Authentication Bypass Occasionally a PHP developer will think that they are correctly validating that a site visitor has the correct access level before taking an action, but in fact they are checking the wrong thing.


1 comment: