sql-injection

Am I immune to SQL injections if I use stored procedures?

只谈情不闲聊 提交于 2019-11-28 08:16:53
Lets say on MySQL database (if it matters). No, you will not be completely safe. As others have mentioned, parameterized queries are always the way to go -- no matter how you're accessing the database. It's a bit of an urban legend that with procs you're safe. I think the reason people are under this delusion is because most people assume that you'll call the procs with parameterized queries from your code. But if you don't, if for example you do something like the below, you're wide open: SqlCommand cmd = new SqlCommand("exec @myProc " + paramValue, con); cmd.ExecuteNonQuery(); Because you're

A good way to escape quotes in a database query string?

跟風遠走 提交于 2019-11-28 08:05:22
I've tried all manner of Python modules and they either escape too much or in the wrong way. What's the best way you've found to escape quotes (", ') in Python? Dave Webb If it's part of a Database query you should be able to use a Parameterized SQL Statement . As well as escaping your quotes, this will deal with all special characters and will protect you from SQL injection attacks . Use json.dumps . >>> import json >>> print json.dumps('a"bc') "a\"bc" The easy and standard way to escape strings, and convert other objects to programmatic form, is to use the build in repr() function. It

Delphi - prevent against SQL injection

一个人想着一个人 提交于 2019-11-28 07:18:44
I need to protect an application from SQL injection. Application is connecting to Oracle, using ADO, and search for the username and password to make the authentication. From what I've read until now, the best approach is by using parameters, not assigning the entire SQL as string. Something like this: query.SQL.Text := 'select * from table_name where name=:Name and id=:ID'; query.Prepare; query.ParamByName( 'Name' ).AsString := name; query.ParamByName( 'ID' ).AsInteger := id; query.Open; Also, I'm thinking to verify the input from user, and to delete SQL keywords like delete,insert,select,etc

Prevention against SQL Injection in Hibernate

℡╲_俬逩灬. 提交于 2019-11-28 07:15:10
问题 I have used hibernate to interact with my database, now I wanted to make my database layer secure against SQL Injection, so I did some research and I found out that my queries should be parameterized , so does it mean if I just structure my HQL queries as: List mothers = session.createQuery( "select mother from Cat as cat join cat.mother as mother where cat.name = ?") .setString(0, name) .list(); Then it's parameterized and protected from SQL Injection, or is there something else which I need

Can VBA in Ms Access using parameter to prevent sql injection?

ぐ巨炮叔叔 提交于 2019-11-28 06:42:49
问题 I'm currently building a system with Ms Access. Since it's important to avoid sql injection, I want to use paramerters as VB.NET too, but I wonder if it could be or not. If so, I would be appreciate if you show me at least the sql statement inserting data from controls to the database using parameters, and If it can't be, would anyone show me the other ways? I would be appreciate for any recommendation, thanks.. 回答1: This INSERT statement declares a Date/Time PARAMETER using a text box

MySQL injection protection and vulnerability signs using PHP

岁酱吖の 提交于 2019-11-28 06:37:08
What are the best ways to protect from MySQL injection? What are weaknesses I should look out for? I know what it is, but I really have no idea how vulnerable I might be. Though I have taken (what I think to be) steps toward protecting myself and my database. Is there any sure-fire way of stopping someone? BTW...I write in PHP:) Use prepared statements instead of mixing the statement and the actual payload data. see http://dev.mysql.com/tech-resources/articles/4.1/prepared-statements.html PDO::prepare mysqli::prepare You might also be interested in http://shiflett.org/articles/sql-injection

SQL Injection in Java and MySQL when using multiple queries

放肆的年华 提交于 2019-11-28 05:42:33
问题 I've got a web application with an SQL injection as part of an INSERT statement. It looks like this: INSERT INTO table1 VALUES ('str1', 1, 'INJECTION HERE') I can insert the regular multiple-query injections such as ');truncate table1;-- but due to the fact that Java + MySQL is used it does not allow stacking multiple queries so the above injection would result in an error from MySQL and the second query never gets executed. So basically it seems that all one can achieve from such an

Is SQL Injection possible with POST?

我只是一个虾纸丫 提交于 2019-11-28 05:14:14
问题 Sql Injection is possible if parameters are passed via GET. But is it possible via POST also. If yes, can https prevent it? 回答1: Yes, it's possible with $_POST as well as with $_GET , $_COOKIE and $_REQUEST . HTTPS will not protect you at all. You have to use some function to protect you, for example mysql_real_escape_string or use prepared statements. All communication from the web browser should be handled as "untrusted" . Other techniques you can't trust is Ajax , file uploads and

Is this prone to SQL injection?

邮差的信 提交于 2019-11-28 05:06:40
问题 In my controller action, I have the following: def index @articles = (params[:mine] == "true") ? current_user.articles : Article.search(params[:search]) @articles = @articles.sort! { |a,b| b.created_at <=> a.created_at } @articles = Kaminari.paginate_array(@articles).page(params[:page]).per(25) respond_to do |format| format.html format.json { render json: @articles } end end And in the model: def self.search(search) if search.present? where("category LIKE ? OR article_type LIKE ?", "%#{search

Why do we need to specify the parameter type in bindParam()?

吃可爱长大的小学妹 提交于 2019-11-28 04:45:57
问题 I am a bit confuse as to why we need to specify the type of data that we pass in the bindParam() function in PDO in Php. For example this query: $calories = 150; $colour = 'red'; $sth = $dbh->prepare('SELECT name, colour, calories FROM fruit WHERE calories < ? AND colour = ?'); $sth->bindParam(1, $calories, PDO::PARAM_INT); $sth->bindParam(2, $colour, PDO::PARAM_STR, 12); $sth->execute(); Is there a security risk if I do not specify the 3rd parameter. I mean if I just do in the bindParam():