Week 2
Last week’s challenge
if request.form["username"] == “admin”:
return render_template("flag.html", flag=get_flag())
else:
return "Well, you logged in, but you aren't an admin."
Last week’s challenge
SELECT * FROM users WHERE username='admin' AND password='%s'
SELECT * FROM users WHERE username='%s' AND password='' OR '1'='1'
SELECT * FROM users WHERE username='%s' AND password='' OR 1--'
This Week
sqlite3 functions: substr
“The substr(X,Y,Z) function returns a substring of input string X that begins with the Y-th character and which is Z characters long . . . The left-most character of X is number 1.”
For example:
“SELECT * FROM posts WHERE substr(title, 4, 3) = ‘bar’”
Would match a post entitled “Foobar”
Blind SQL injection
Blind SQL injection
sqlite3 functions: unicode
“The unicode(X) function returns the numeric unicode code point corresponding to the first character of the string X.”
For example:
“SELECT * FROM posts WHERE unicode(title) < 66”
Would match a post entitled “A story” because the unicode codepoint for “A” is 65.
This week