Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is Nhibernate Vulnerable to SQL Injection?

Tags:

sql

nhibernate

Just wanted to know if there is a big chance to inject SQL While using nhibernate?

like image 558
user161433 Avatar asked Sep 01 '09 03:09

user161433


People also ask

Is SQLAlchemy secure?

SQLAlchemy's facilities to coerce Python values into direct SQL string values are not secure against untrusted input and do not validate the type of data being passed.

How can we prevent SQL Injection with JPA and Hibernate?

While setting the name parameter, most would generally use this. query. setParameter("name", "%" + name + "%"); Now, as mentioned above traditional parameter like "1=1" cannot be injected because of the TypedQuery and Hibernate will handle it by default.


1 Answers

If you're using the criteria generators then no. nHibernate is aware of the .Net types and is consequently able to handle all escaping for you when generating queries.

Unparameterized HQL is vulnerable however.

like image 105
Spencer Ruport Avatar answered Sep 22 '22 12:09

Spencer Ruport