sql injection last few lectures
play

SQL Injection Last Few Lectures XSS - Cross-site scripting - PowerPoint PPT Presentation

SQL Injection Last Few Lectures XSS - Cross-site scripting XSRF/CSRF - Cross-site request forgery Code Injection Attacks Attacker executes arbitrary code on server Programming the program Not sanitizing user


  1. SQL Injection

  2. Last Few Lectures • XSS - Cross-site scripting • XSRF/CSRF - Cross-site request forgery

  3. Code Injection Attacks • Attacker executes arbitrary code on server • “Programming the program” • Not sanitizing user inputs/outputs

  4. SQL Injection • Attacker enters bad information which is sent to the server • Server executes a SQL query with unintended outcomes.

  5. Sample SQL query • dogs(name, breed, owner name) • Danger, lab, Fred • Tinkerbell, poodle, Teri • select * from dogs where owner=‘$name’; • select name from dogs where breed=‘$btype’;

  6. Problem? • $name and $btype are directly passed to the function • select * from dogs where owner=‘$name’; • select name from dogs where breed=‘$btype';

  7. SQL Injection 1. Post malicious input to form 2. Requests unintended SQL query 3. Returns unintended data to attacker

  8. Malicious Input https://xkcd.com/327/

  9. Malicious Input • select * from dogs where owner=‘$name’; • suppose $name was ‘or 1=1- - • or even ′ ; drop table dogs --

  10. How to Thwart • Don’t build SQL commands yourself. • Use parameterized functions where you specify what input you expect.

  11. Demo • hackthissite.org

Recommend


More recommend