Questions tagged [sql-injection]

SQL injection is a code injection technique, used to attack data-driven applications, in which malicious SQL statements are inserted into an entry field for execution (e.g. to dump the database contents to the attacker).

SQL injection exploits a type of computer security vulnerability found in applications with SQL databases. It enables attackers to apply malicious SQL commands to the database via user input. It can for example extract, alter or delete sensitive data.

The vulnerability is present when user input is used directly in the SQL commands, instead of as parameters or properly filtered (also known as "sanitized", e.g. by quoting escape characters). It happens primarily because of poorly written SQL handling functions in client applications.

See famous example - Bobby Tables incident and the community wiki question's answer How can I prevent SQL injection in PHP?

Useful Links

3768 questions
1
vote
2 answers

Generic way of adding SqlParameter to the SqlCommand

We have a legacy C# application where we have a lot of inline SQL queries that are being executed against the input that was passed by the user. So, obviously SQL injection came into the picture. Now we want to fix it but the thing is we want to go…
Silly Volley
  • 463
  • 1
  • 5
  • 15
1
vote
1 answer

SQL injection in SP_EXECUTESQL

I have a stored procedure in SQL Server which gets a XML as input parameter. In this XML is defined - what stored procedure with which parameters values should be executed. And according to that the stored procedure execute the wanted one using…
1
vote
1 answer

Is this code vulnerable to SQL Injection? How would I make it safe?

I have a friend who I'm trying to help out on a project, I'm by no means an expert at all in penetrating testing, in fact it's something I'm really new in, but he's asked me to help identify and potential security issues with his program. I'm not…
WGHaven
  • 11
  • 3
1
vote
0 answers

Possible Sql-injection

I saw my logs today and I could see someone tried to launch sql-injection or was trying to find a vulnerability (not sure about it). It looks like two types of attempt were made either to gain some info or to launch an attack. It's an asp.net mvc 5…
curious.netter
  • 774
  • 10
  • 16
1
vote
3 answers

best way to filter data from user(xss and sql injection)

I read a lot about filtering data which my web site get from user to make web site secure in sql injenction and xss . . . but I saw a lot function in php so I can't make decide what to do . . . please help me make it more secure
Moein Hosseini
  • 4,309
  • 15
  • 68
  • 106
1
vote
0 answers

SQL injection with output cursor

I have the following stored procedure CREATE OR REPLACE PROCEDURE MyProcedure(nKey IN INTEGER, pcResult OUTCustomType) IS BEGIN OPEN pcResult FOR SELECT MyPackage.IsBool1(nKey) AS IsBool1, MyPackage.IsBool2(nKey) AS IsBool2, …
Bilel Chaouadi
  • 903
  • 1
  • 10
  • 28
1
vote
3 answers

Links generated in while loop vulnerable to SQL injections

I have a database where I store data of users and devices. Every user has a list of devices. When the user logs into his account the php code below generates a list of the users devices: $query_user="SELECT * FROM devices WHERE users_id =…
Slaven Tojić
  • 2,945
  • 2
  • 14
  • 33
1
vote
0 answers

why my php code for injection isnt working

I write simple php script with mysql to try sql injection and it isn't working. Here is my sql query $sql = "SELECT * FROM users WHERE id = '$userId'"; echo 'QUERY '. $sql .'
'; $userQ = mysql_query($sql); $user = mysql_fetch_array($userQ); I…
Vitas
  • 50
  • 7
1
vote
2 answers

SQL Injection in Code/Static SQL (T-SQL)

Are parametrized static/code SQL statements subject to SQL injection attacks? For example, let's say I have the following simplified stored procedure: Does the fact that I am passing the input @PSeries_desc mean I am subject to injection attacks if…
Abe
  • 6,386
  • 12
  • 46
  • 75
1
vote
1 answer

"Cant process the request", dealing with basic parameterized queries

I am trying something I found online (Extremely new to this) and none of it works. It's some random science project I decided to learn more about yet I am stuck on part 2 of the "procedures".…
1
vote
1 answer

What are the differences between a JPQL-Injection and SQL-Injection

I have read about JPQL injection and SQL injection. In many sites it has been said that ORM injection is almost as same as SQL injection in a testers point of view. So what basically i want to know is the major differences between JPQL and SQL…
Walter Fuchs
  • 167
  • 2
  • 11
1
vote
2 answers

Avoiding SQL Injections to the Stored Procedure in Node.js

How to avoid SQL injections from Node.js when the calls are made to the stored procedure Suppose from the front End of the UI if I entered some special characters Eg.: If ? is entered true will be saved to the database If ?? is entered `true` will…
1
vote
2 answers

Checkmarx shows the code has risks for second order injection

Checkmark scanned our codes and showed these code have risks for second order injection the code like this @SuppressWarnings("unchecked") public List> findBySQL(String sql, List types, List values, Info info)…
Yi-An Lin
  • 9
  • 1
  • 3
1
vote
1 answer

Collect "where" clause array with "join" using wpdb prepare safely

I need to secure a big SQL statement has a lot of conditions in its WHERE clause so I made an array for WHERE clause using $wpdb->prepare properly BUT an error happened while join this array together as a string in the final statement. Here is some…
Hady Shaltout
  • 606
  • 1
  • 9
  • 22
1
vote
1 answer

Can hostname inject SQL?

This is the superglobal in PHP for a clients hostname: $_SERVER['REMOTE_HOST'] It usually looks something like: ecIP-AD-DRE-SS.us-west-1.compute.amazonaws.com IP-AD-DRE-SS.bb.dnainternet.fi IP-AD-DRE-SS.dynamic.lounea.fi Can someone change their…
user10833006