I'm currently reviewing someone's code, and I ran into the following Python line:
db.query('''SELECT foo FROM bar WHERE id = %r''' % id)
This goes against my common sense, because I would usually opt-in to use prepared statements, or at the very least use the database system's native string escaping function.
However, I am still curious how this could be exploited, given that:
- The 'id' value is a string or number that's provided by an end-user/pentester
- This is MySQL
- The connection is explicitly set to use UTF8.