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.