Skip to content

Instantly share code, notes, and snippets.

@Tehada
Last active July 14, 2018 21:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Tehada/181626ce8103115c0811cb1a9817f2c0 to your computer and use it in GitHub Desktop.
Save Tehada/181626ce8103115c0811cb1a9817f2c0 to your computer and use it in GitHub Desktop.
import sqlite3
HEADERS = '(first integer)'
bad_request = '1; delete some_table;'
conn = sqlite3.connect('test_sqlite_injection.db')
cursor = conn.cursor()
cursor.execute('CREATE TABLE IF NOT EXISTS some_table' + HEADERS)
cursor.execute('SELECT * FROM some_table WHERE first = {0}'.format(bad_request))
conn.commit()
conn.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment