Mysql-instance of PHP-MYSQL injection attacks

Source: Internet
Author: User
Can I provide an instance of PHPMYSQL-based injection attacks? PHPVERSION5.6.3 fails to simulate injection attacks. After printing the SQL statement, directly copying the script to MysqlWorkbench can successfully DROP the database. However, when running locally, a syntax error is always reported, asking where the error is, how to instantiate such an attack. & Quot; error_reporting (E_ALL ^ E_NOTICE ^ E_WARNING ^ E_DEPRECATED); $ data $ _ GET [& #39; SQL & #39;]; $ data2mysql mysqlphp instance database

Can I provide an example of an injection attack based on the PHP MYSQL class?

Php version 5.6.3

Failed to simulate injection attack. If you print an SQL statement and copy the script directly to Mysql Workbench, you can DROP the database successfully. However, when running locally, a syntax error is always reported, asking where the error is, how to instantiate such an attack.

 error_reporting(E_ALL^E_NOTICE^E_WARNING^E_DEPRECATED);$data = $_GET['sql'];$data2 = mysql_real_escape_string($data);$sql = "INSERT INTO test (test) VALUES ('$data');";$sqlx = "INSERT INTO test (test) VALUES ('$data2');";echo $sql.'
';echo $sqlx.'
';mysql_query($sql);echo mysql_error();

The link above is omitted,
The access URL is test. php? SQL = values % 27); % 20 DROP % 20 DATABASE % 20 test; % 20 -- % 20

The output is
Insert into test (test) VALUES ('values'); drop database test ;--');
Insert into test (test) VALUES ('values \ '); drop database test ;--');
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'drop DATABASE test; -- ')' at line 1

The second line of anti-injection processing can be executed, but an error is still reported if no processing is performed.

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.