Does Hibernate guard against SQL injection attack? If i am using hibernate then am i completely safe from SQL injection attack? I heard that Using Hibernate to execute a dynamic SQL statement built with user input can allow an attacker to modify the statement’s meaning or to execute arbitrary SQL commands.
Does Hibernate guard against SQL injection attack ? If i am using hibernate then
Share
No, it doesn’t guard the wrongly written ones, So you need to be careful when you write the queries. Always use the prepared statement style, for example consider the below HQL queries,
query1 ** is still vulnerable to **SQL Injection where as query2 is not.
So In short hibernate provides you many ways that you should use to guard yourself from the SQL Injection attacks.