Reference: www.networkworld.com/article/2286560/lan-wan/
the-top-10-reasons-web-sites-get-hacked.html
Here are the 10 methods that this article lists:
Let's examine some of these methods in more detail.
I love puppies.
I love puppies.<script type="text/javascript" src="<a href='http://malicious-site.js'>"</script>
I love puppies.%3Cscript%25%20type%3D%22text/javascript%22 src%3D"%3Ca href%3D%22http%3A%2F%2Fmalicious-site.js%22%3E%3C%2Fscript%3E
<scriptwould be replaced by
<script
I <b>love</b> puppies.
<img src="javascript:alert('Gotcha!');">
a = Project.where("name = '#{params[:name]}'") (*)
OR 1 --
SELECT * FROM projects WHERE name = '' OR 1
a = Project.where("name = ?", params[:name])or
a = Project.where(name: params[:name])
img src="https://malicious-site.com/change_account?paytype=debit&paytype_id=1234& paytype_field_1=123456789&paytype_field_2=12345678&paytype_field_3=Richie+Rich& paytype_field_4=BankOfHappiness&op=editpaytype.save&confirmmode="/>
protect_from_forgery with: :exceptionThis displays an error message if a CSFR attack is detected.
<%= csrf_meta_tags %>Calling the csrf_meta_tags method inserts a digital signature onto the page. Requests from scripts on a different page or site are discarded if they do not have a digital signature that matches the one generated by the method.