Back to the 2021 paper

Unit 4 – Database Security

20217m

Write a short note on any one of the foflowing:

  • (a) SQL injection
Worked SolutionAI Assisted

Short note on SQL Injection:

Attack where attacker injects malicious SQL via user input to alter query logic. Example: Input "' OR '1'='1" into login: SELECT * FROM users WHERE name='' OR '1'='1' -- bypasses authentication, returns all rows. Can lead to data leak, delete, privilege escalation.

Types: Error-based, Union-based, Blind,.

Prevention: Use prepared statements/parameterized queries (SELECT * FROM users WHERE name=?), input validation/sanitization, least privilege, WAF, avoid dynamic concatenation, use ORM.

Example parameterized in Java: PreparedStatement ps = conn.prepareStatement("SELECT * FROM users WHERE name=?"); ps.setString(1,input);

Similar questions

Free AppAndroid App

Coursify Android App

Generate AI courses, take quick quizzes between classes, and master complex engineering concepts on the go.