Is there any way to exploit this code:
course = course.replace('\'', '\\\'')
query = "SELECT * FROM student WHERE cost_per_unit > {}".format(course)
to create a query like:
SELECT * FROM student WHERE cost_per_unit > 3; SELECT * FROM student WHERE column = 'ABC'
Here, Python throws a syntax error:
Syntax error at or near "\":
column = \'ABC\'
The replace() method in python replaces that. Is there any work-around so I can somehow inject something?
.format()on SQL queries. Give the query arguments as a sequnce to the.execute()method as described in the documentation.courseLIKEexpressions, so the syntax going between the two is not compatible the way this is handled