0

I have a PHP script with this code:

$sid = $_COOKIE['sid'];
$q = mysql_query("SELECT * FROM `order` WHERE `sid` = '$sid' AND `use` <> 1");

In a MySQL table with name users, I have the following columns: id, name, md5password.

How can I do:

 UPDATE `users` SET `md5password` ='newpassword'`

with a potential SQL injection in PHP? Can you give me an example?

MrCode
  • 63,975
  • 10
  • 90
  • 112

1 Answers1

2

You can't. The reason is mysql_query() does not support multiple queries and so even with this SQL Injection vulnerability, you can't execute an UPDATE query.

The best you can do with this SQLi is to extract or read data from the database, you can't update or delete it.

MrCode
  • 63,975
  • 10
  • 90
  • 112