Created
March 20, 2015 05:35
-
-
Save ferromir/3ba599741eb5b2a3cd83 to your computer and use it in GitHub Desktop.
ACR - Ruby - SQL Injection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This bypasses id == 1 condition and deletes all records | |
params[:id] = "1) OR 1=1--" | |
User.delete_all("id = #{params[:id]}") | |
# Produce: | |
# DELETE FROM "users" WHERE (id = 1) OR 1=1--) | |
# Bad | |
Project.where("name = '#{params[:name]}'") | |
# Good | |
Project.where("name = ?", params[:name]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment