sql-injection

How to confirm SQL injection

本秂侑毒 提交于 2019-12-05 03:43:16
Is there any way to confirm that a particular breach of security was done through SQL injection? There is no easy way here , but if you have the enabled the SQL server you use to log every single sql statement, here is what I would do. Normally, when I SQL inject somewhere, i use one of these as my always true statement for passing throgh the Where clause, after ending the former string. 1=1 0=0 both being used as : blahblahblah' or 1=1 -- You would not use this clauses in everyday code. So if you spot one of these in your history, well, it is a high candidate. Test the sql history to find :

SQL Injection Protection - Cast from string to int

二次信任 提交于 2019-12-05 03:34:55
We all know that parameterized SQL is the way to go when dealing with user input and dynamic SQL, but is casting from string to int (or double, or long, or whatever) as effective if the input you are seeking is numeric? I guess what I am asking is if this technique alone is infallible in regards to SQL injection? I'm no expert, but I'm reasonably sure that this would be safe. But why take the chance? Use parameterised SQL and you don't ever need to worry about it. Besides, parameterising your SQL has other advantages, not just injection-protection. If the string was a valid number before you

How do I prevent SQL injection with ColdFusion

可紊 提交于 2019-12-05 03:30:59
How do I prevent SQL injection when it comes to ColdFusion? I'm quite new to the language/framework. Here is my example query. <cfquery name="rsRecord" datasource="DataSource"> SELECT * FROM Table WHERE id = #url.id# </cfquery> I see passing in url.id as a risk. Use a <cfqueryparam> tag for your id: http://www.adobe.com/livedocs/coldfusion/6.1/htmldocs/tags-b20.htm <cfquery name="rsRecord" datasource="DataSource"> SELECT * FROM Table WHERE id = <cfqueryparam value = "#url.id#" CFSQLType = "CF_SQL_INTEGER"> </cfquery> use a parameterized stored procedure cfqueryparam error handling around

How to use SQL parameters to get dataset from SQL Server

浪尽此生 提交于 2019-12-05 02:03:40
问题 I'm working on C# project and I'm new to this technology. I want to read some data from SQL Server 2008, and I write the following code public User select(string username, string password) { string connection = ConfigurationManager.ConnectionStrings["lawyersDBConnectionString"].ConnectionString.ToString(); string sql = string.Format("select * from users where userName = '{0}' and password = '{1}'", username, password); SqlConnection con = new SqlConnection(); con.ConnectionString = connection

Prevent SQL Injection in ORDER BY clause

半世苍凉 提交于 2019-12-05 01:33:47
In our DB access layer we have some dynamic query creation. For instance, we have the following method for building a part of an ORDER BY clause: protected string BuildSortString(string sortColumn, string sortDirection, string defaultColumn) { if (String.IsNullOrEmpty(sortColumn)) { return defaultColumn; } return String.Format("{0} {1}", sortColumn, sortDirection); } The problem is, sortColumn and sortDirection both come from outside as strings, so of course something should be done to prevent possible injection attacks. Does anybody have any idea how this can be done? If you have to deal in

LINQ to Entities and SQL Injection

自闭症网瘾萝莉.ら 提交于 2019-12-05 01:23:34
I've seen a couple of conflicting articles about whether or not L2E is susceptible to SQL injection. From MSDN : Although query composition is possible in LINQ to Entities, it is performed through the object model API. Unlike Entity SQL queries, LINQ to Entities queries are not composed by using string manipulation or concatenation, and they are not susceptible to traditional SQL injection attacks. Does that imply that there are "non-traditional" attacks that may work? This article has one example of a non-parameterized query - is it safe to assume that if you pass in user-supplied data via a

How secure is laravel 5.1? [closed]

社会主义新天地 提交于 2019-12-04 20:56:53
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed last year . After reading about SQL injection I wonder how secure it is to create apps in Laravel and how to test if your security meets today's standards? 回答1: I've developed a few Laravel applications and found them to be pretty secure in my eyes. I ran a variety of penetration tests, OWASP

is this safe in terms of SQL injection?

≯℡__Kan透↙ 提交于 2019-12-04 19:05:57
Currently getting more and more into MySQL. It's something i haven't been too fussed about but i want to write some scripts with it now. My question is simple, im making a search script and just want to know if my php code can prevent some SQL injections.. the code: $orig = $_POST['term']; $term = mysql_real_escape_string($orig); $sql = mysql_query("select * from db1 where content like '%$term%' "); Is this ok? Alternatively if anyone has an easier/better/safer way of doing this plese feel inclined to let me know. To avoid warnings in case $_POST['term'] isn't set: if (isset($_POST['term'])) {

Is this sanitization unsafe? Is it vulnerable to SQL Injection?

送分小仙女□ 提交于 2019-12-04 18:25:26
Function RemoveSuspeitos(ByVal strTXT) Dim txtAux As String txtAux = strTXT txtAux = Replace(txtAux, chr(34), "") txtAux = Replace(txtAux, "'", "") RemoveSuspeitos = txtAux End Function DB: MSSQL 1) Forget syntax errors in the above code, I am not expert in VB. 2) Lets say I always use single or double quotes, even for int values (e.g.: '" + $int_id + "'). Is this sanitization unsafe? If yes, why? Please show me a real exploit scenario. Here is my try. The problem with vulnerabilities is that they are not that direct as most users think. In reality, production code grows slightly different

pdo to prevent sql injection

做~自己de王妃 提交于 2019-12-04 16:15:59
I'm trying to insert the visitor's inputs into a database. This works, but - is this good enough to prevent sql injection ? <?php $db_host = "localhost"; $db_name = "db_qadenza"; $db_user = "root"; $odb = new PDO ("mysql:host=" . $db_host . ";dbname=" . $db_name, $db_user); if(isset($_POST['Submit'])) { $user = $_POST['user']; $pass = $_POST['pass']; $mail = $_POST['mail']; $confirm_key=md5(uniqid(rand())); $q = "INSERT INTO members (user, pass, mail, confirm_key) VALUES(:user, :pass, :mail, :confirm_key);"; $query = $odb->prepare($q); $results = $query->execute(array( ":user"=>$user, ":pass"=