Aware & Prevent of SQL Injection Methods in PHP

SQL Query Structure or injection is a technique often used for data sanitization and validation by hackers compromising your network to access your data or information, destroy data and take control over your system. To avoid such problem, review the code value before sending it as a query and secure the shared data with the help of the four prime SQL injection methods.

Key Concepts of a SQL Injection methods in PHP:

A software vulnerability occurs while data is entered by users and is sent to the SQL interpreter as a part of a SQL query.

For the SQL interpreter, the hacker provides specially crafted input data to trick the interpreter to execute unintended commands. The user will not be aware between the intended commands and the attacker’s specially crafted data.

It exploits security vulnerabilities at the database layer that allows the attackers to create, read, modify or delete sensitive data.

  1. 1Function mysql_real_escape_string()
  2. Magic Quotes
  3. Validation
  4. HTML Entities

How to Prevent SQL Injection:

  • Validate and sanitize every data entered.
  • Avoid dynamic SQL and use stored procedures, prepared statements, parameterized queries.
  • Update and patch to avoid SQL injection by attackers.
  • Use a Web Application Firewall (WAP) to help filter out malicious data and provide security protection against a particular new vulnerability before a patch is available.
  • Delete any database functionality which is least used to reduce your attack surface
  • Limit the access account by using appropriate privileges which are far safer.
  • Maintain and handle the confidential data carefully. Change the passwords of application accounts in the database regularly

Source: http://www.dneers.com/aware-prevent-of-sql-injection-methods-in-php/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s