sql-injection

Does oci_bind_by_name prevent SQL injection safely?

泄露秘密 提交于 2020-01-15 07:39:32
问题 I have read the documentation provided by oracle here, where it states that: Binding is important for Oracle database performance and also as a way to avoid SQL Injection security issues. How safe is it to use oci_bind_by_name to escape variables? Are there better practices to avoid SQL Injection, or does oci_bind_by_name suffice? TIA! 回答1: Using bound parameters is sufficient in common cases, and good practice for avoiding SQL injection. But a parameter in a prepared statement can be used

Does oci_bind_by_name prevent SQL injection safely?

Deadly 提交于 2020-01-15 07:39:19
问题 I have read the documentation provided by oracle here, where it states that: Binding is important for Oracle database performance and also as a way to avoid SQL Injection security issues. How safe is it to use oci_bind_by_name to escape variables? Are there better practices to avoid SQL Injection, or does oci_bind_by_name suffice? TIA! 回答1: Using bound parameters is sufficient in common cases, and good practice for avoiding SQL injection. But a parameter in a prepared statement can be used

Is using org.postgresql.core.Utils.escapeLiteral enough to prevent SQL Injections?

倖福魔咒の 提交于 2020-01-15 06:29:12
问题 I need to sanitize some user entered data before building sql queries and updates to submit to my DB. I know that it is preferable to use either prepared statements but this is not an option. Unfortunatly, I am stuck with escaping all user supplied Input. It looks like the Postgres JDBC libs come with a tool to do String escaping. See org.postgresql.core.Utils.escapeLiteral(..) (attached below). I am hoping that since this comes with Postgres, that it is safe to use. After several hours of

Does Eloquent ORM(laravel 5) take care of SQL injection?

北慕城南 提交于 2020-01-15 02:40:07
问题 I couldn't find it online, but does Eloquent ORM take care of SQL injection like PDO prepared statements do? 回答1: As per your question all the eloquent queries are taken care of for SQL injection, because they use the PDO driver in core. So you don't have to worry, but the input are stored as they are so you might want to sanitize as per your application's needs (HTML formatting, etc.) 回答2: No framework "takes care of" SQL injection. You take care of SQL injection. A framework may provide

How to combine stored procedure and select query result?

三世轮回 提交于 2020-01-14 14:06:24
问题 I am trying to combine the results of xp_cmdshell with a select query. I have tried union & read about creating a temp table, but as my result will be having only 1 column. To be more precise i need a smaller query to combine the results of xp_cmdshell with select query as am trying to use it in union based sql injection For example: Select name from employee union exec xp_cmdshell 'whoami' I know this wont work but somewhat similar would be great :) 回答1: Create a temp table and do insert

How to combine stored procedure and select query result?

故事扮演 提交于 2020-01-14 14:06:01
问题 I am trying to combine the results of xp_cmdshell with a select query. I have tried union & read about creating a temp table, but as my result will be having only 1 column. To be more precise i need a smaller query to combine the results of xp_cmdshell with select query as am trying to use it in union based sql injection For example: Select name from employee union exec xp_cmdshell 'whoami' I know this wont work but somewhat similar would be great :) 回答1: Create a temp table and do insert

Login code sample which has been hacked via SQL Injection, although mysql_real_escape_string…

匆匆过客 提交于 2020-01-14 08:55:10
问题 I use CodeIgniter, and having trouble with hacking. Is it possible to make SQL Injection to the login code below: function process_login() { $username = mysql_real_escape_string($this->input->post('username')); $password = mysql_real_escape_string(MD5($this->input->post('password'))); //Check user table $query = $this->db->getwhere('users', array('username'=>$username, 'password'=>$password)); if ($query->num_rows() > 0) { // success login data Am I using the mysql_real_escape_string wrong,

Keywords in SQL script data causing problems when executing programmatically - C#

断了今生、忘了曾经 提交于 2020-01-14 05:23:17
问题 I'm fairly new to sql and am having a problem with keywords causing havoc in my sql script. I'm trying to execute a list of premade .sql script files in C#. I'm currently reading the file to a string and executing it with command.ExecuteNonQuery(). This works great for most of the scripts, but I'm running into one that inadvertently contains a keyword: INSERT INTO [thetable] SELECT '123123', 'abcabc', 'I WANT TO GO TO BED' UNION ALL SELECT '123124', 'abcdef', 'SOOO TIRED' Essentially, when it

Parameterized query with several optional search terms

柔情痞子 提交于 2020-01-14 01:59:30
问题 I have a web application with lots of data, and a search/filter function with several fields, such as name, status, date, and so on. I have been using parameterized queries like this for the regular (non-search) queries: $id = $_POST['itemID']; $db = mysqli_connect($host, $username, $password, $database); $sql_query = "SELECT * FROM tbl_data WHERE ID = ?"; $stmt_query = mysqli_prepare($db, $sql_query); mysqli_stmt_bind_params($stmt_query, "i", $id); mysqli_stmt_execute($stmt_query); //and so

Rails is this query open to sql injection?

青春壹個敷衍的年華 提交于 2020-01-13 13:11:18
问题 I'm still learning how to write good queries using ActiveRecord. I'm curious if this query is subject to sql injection because of the way i'm using the date field in the query. Can someone please point out any obvious mistakes or any better ways to write this query? @arrangements_for_month = Arrangement.joins(:timeslot). where("timeslots.timeslot BETWEEN '#{month}' AND '#{month.end_of_month}'", params[:id]). order('location_id') 回答1: You should just use the preferred way of including