sql-injection

Someone has hacked my database - how?

不想你离开。 提交于 2019-11-29 20:21:40
Someone has hacked my database and has dropped the table. In my PHP page there is one single query where I am using mysql_real_escape_string: $db_host="sql2.netsons.com"; $db_name="xxx"; $username="xxx"; $password="xxx"; $db_con=mysql_connect($db_host,$username,$password); $connection_string=mysql_select_db($db_name); mysql_connect($db_host,$username,$password); mysql_set_charset('utf8',$db_con); $email= mysql_real_escape_string($_POST['email']); $name= mysql_real_escape_string($_POST['name']); $sex= mysql_real_escape_string($_POST['sex']); if($_POST['M']!=""){ $sim = 1; }else { $sim = 0; }

Deciphering this XSS attack [closed]

血红的双手。 提交于 2019-11-29 18:41:10
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 9 years ago . Did anybody know more information about this attack ? I recently got this script injected in my web sites By the way dont go on this web site since it's the source of the infection </title><script src=http:/

What is SQL injection? [duplicate]

断了今生、忘了曾经 提交于 2019-11-29 18:06:41
Possible Duplicates: XKCD sql injection - please explain What is SQL injection? I have seen the term "SQL injection" but still do not understand it. What is it? SQL injection is where someone inserts something malicious into one of your SQL queries. Let's assume that you have an SQL query like this: select * from people where name = '<name>' and password = '<password>' Now let's assume that <name> and <password> are replaced by something someone types on your webpage. If someone typed this as their password... ' or '' = ' ...then the resulting query would be: select * from people where name =

Prepared statements and second order SQL injections

☆樱花仙子☆ 提交于 2019-11-29 17:20:25
I have read somewhere here that using prepared statements in PDO makes your app only immune to first order SQL injections, but not totally immune to second order injections. My question is: if we used prepared statements in all queries inlcuding SELECT queries and not only in INSERT query, then how can a second order sql injection be possible? For example in the following queries there is no chance for a 2nd order injection: write: INSERT INTO posts (userID,text,date) VALUES(?,?,?) read: SELECT * FROM posts WEHRE userID=? delete: DELETE FROM posts WHERE userID=? What you have read is a plain

SQL Injections with replace single-quotation and validate integers [duplicate]

▼魔方 西西 提交于 2019-11-29 17:04:58
Possible Duplicate: Can I protect against SQL Injection by escaping single-quote and surrounding user input with single-quotes? I just want to know, If I replace every ' with '' in user inputs, for instance string.Replace("'","''") , and validate numbers (make sure that they are numbers, and do not contain any other character), is SQL Injection still possible? How? I'm using dynamic SQL queries, using SqlCommand . Something like this: cmd.CommandText = "SELECT * FROM myTable WHERE ID = " + theID.ToString(); or cmd.CommandText = "UPDATE myTable SET title='" + title.Replace("'","''") + "' WHERE

How to prevent sql-injection in nodejs and sequelize? [closed]

拟墨画扇 提交于 2019-11-29 16:34:14
问题 I want to write custom queries using Sequelize, and as far as possible avoid potential issues with SQL Injection. My question is therefore if there exists a secure way of writing custom queries with inserted variables using Sequelize? 回答1: Sequelize escapes replacements, which avoids the problem at the heart of SQL injection attacks: unescaped strings. It also supports binding parameters when using SQLite or PostgreSQL, which alleviates the risk further by sending the parameters to the

PHP/MySQL Injection example

别说谁变了你拦得住时间么 提交于 2019-11-29 16:33:24
This is a follow-up to this question: Is PHP's addslashes vulnerable to sql injection attack? (thanks to everyone that replied over there). Same scenario, but I have this code (in another page): $ID = $_GET['id']; $sql = "SELECT * FROM blog WHERE id='$ID'"; $result = mysql_query($sql); This should be easy enough to exploit, right? If I remember correctly I CANNOT run a second query inside mysql_query() but I should be able to do some other malicious stuff, right? Would love to be able to insert a user into the admin table or change a password or something, but I assume I wouldn't be able to do

What is second level SQL Injection

荒凉一梦 提交于 2019-11-29 15:45:21
What is all about the second level SQL Injection.. This is with reference to the question Use of parameters for mysql_query .. and a part of one of the answers had this term... o.k.w I'm not exactly sure but I thought it was 'defined' in the post: Use of parameters for mysql_query Excerpt (see point 2): magic_quotes_gpc automatically escapes things you receive in requests from clients... but it cannot detect so-called second-level injections: You get a malicious query from a client and store its contents in the database. magic_quotes_gpc prevents SQL injection; the malicious string gets stored

Avoiding SQL injection in a user-generated SQL-regex

半世苍凉 提交于 2019-11-29 15:24:52
I'm creating a site where the user unfortunately has to provide a regex to be used in a MySQL WHERE clause. And of course I have to validate the user input to prevent SQL injection. The site is made in PHP, and I use the following regex to check my regex: /^([^\\\\\']|\\\.)*$/ This is double-escaped because of PHP's way of handling regexes. The way it's supposed to work is to only match safe regexps, without unescaped single quotes. But being mostly self-taught, I'd like to know if this is a safe way of doing it. If you use prepared statements, SQL injection will be impossible. You should

Benefits of use parameters instead of concatenation

人走茶凉 提交于 2019-11-29 15:23:12
I am new to ASP.NET and C# programming. I would like to know what is the difference and advantages plus disadvantages of using parameters instead of concatenation in SQL statements, as I heard that it is a better way to prevent SQL injection(?) Below are sample INSERT statements which I have changed from using concatenation to parameters: Concatenation: string sql = string.Format("INSERT INTO [UserData] (Username, Password, ...) VALUES ('" + usernameTB.Text + "', '" + pwTB.Text + "',...); Parameters: cmd.CommandText = "INSERT INTO [UserData] (Username, Password, ...) VALUES (@Username,