SQL injection Attack of network attack and defense

Source: Internet
Author: User
Tags sql injection attack

The root cause of SQL injection attacks is the vulnerability of SQL specifications, but because of the long-term existence and use of the specification, it is almost impossible to modify the specification, only from the developer itself to avoid attacks, although the SQL injection is very serious, but now relatively well controlled, here just as a learning content.
The test process is as follows:
1: Build php,mysql development environment, can see my other blog custom development PHP Environment
2: Add database, table, and table contents.

3: Test separately
Universal password, Universal user name
Digital injection
The test is as follows:
Universal Password: password ' or 1= ' 1 (password can be arbitrarily filled in, note: here if the paste will have coding problems, self-modification)
Universal User name: XX ' UNION SELECT * FROM testuser/* (mysql5.6 version test does not have this problem)
The digital injection is injected with the user name and only the number is submitted.

How do you prevent SQL injection?
1: Modify the server configuration: Modify the MAGIC_QUOTES_GPC setting to On (php5.3 above version does not have this setting)
2: In the code layer to modify, you can use a more rigorous validation method;
3: Use PDO to pre-compile processing.

SQL injection Attack of network attack and defense

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.