Click here to Skip to main content
15,896,207 members
Home / Discussions / Web Development
   

Web Development

 
Questioni got sql injection attach from 1 month on my website help me plz. Pin
help as an alias25-Jul-08 0:18
help as an alias25-Jul-08 0:18 
AnswerRe: i got sql injection attach from 1 month on my website help me plz. Pin
Ashfield25-Jul-08 1:25
Ashfield25-Jul-08 1:25 
AnswerRe: i got sql injection attach from 1 month on my website help me plz. Pin
L Viljoen25-Jul-08 1:33
professionalL Viljoen25-Jul-08 1:33 
GeneralRe: i got sql injection attach from 1 month on my website help me plz. Pin
help as an alias25-Jul-08 2:15
help as an alias25-Jul-08 2:15 
GeneralRe: i got sql injection attach from 1 month on my website help me plz. Pin
L Viljoen25-Jul-08 2:41
professionalL Viljoen25-Jul-08 2:41 
GeneralRe: i got sql injection attach from 1 month on my website help me plz. Pin
stevio25-Jul-08 2:57
stevio25-Jul-08 2:57 
GeneralRe: i got sql injection attach from 1 month on my website help me plz. Pin
stevio25-Jul-08 3:00
stevio25-Jul-08 3:00 
AnswerRe: i got sql injection attach from 1 month on my website help me plz. Pin
stevio25-Jul-08 1:58
stevio25-Jul-08 1:58 
Good suggestions from the other two replies. Just to expand on the points a bit -

Essentially it comes down to not trusting any input from your users. Any time you're using any user supplied data, you have to make absolutely sure that you don't allow it to be treated it as executable code, or else you are allowing untrusted users to modify the intended behaviour of your application.

This includes when you use user data as part of an SQL query string.

(language dependent, treat this as pseudocode)

For example if you are using an SQL query like

SELECT * FROM Users WHERE UserName='$UserName' AND Password='$Password'

You need to ensure that the $UserName and $Password inputs can not contain any SQL code (or client/server code, but that's another story)

If the $UserName field contains something like "Alan';DELETE FROM Users;INSERT INTO USERS (UserName, Password) VALUES ('Hacker', 'MyEasyPassword');"

Then the rogue user would have been able to delete all your users, and insert a new user with the details he wants. This is far from a worst case scenario, which could potentially include having all your sensitive data stolen, existing data modified in ways that you won't notice, and a system put in place to do further malicious activities - all without you even knowing.

There are several approaches to fix this - mostly previously suggested.

1) Thoroughly validate all your input data. Use a whitelist where possible to specify valid input types, and trim out any code that is in the SQL. This includes server script, SQL, and client script code. This approach can be difficult to get right if you use it on its own.

2) As suggested, use parameterised queries.These are safer, as the DB server should not parse the parameter values for code to execute, however you should still be validating your code (or else you're going to be back here asking about cross site scripting attacks, junk data etc)

3) Use stored procedures. These are different to, but have some of the benefits of parametrised queries, though a lot of crap is talked about them... You still need to validate the data.

Hope that helps.
AnswerRe: i got sql injection attach from 1 month on my website help me plz. Pin
Paul Conrad27-Jul-08 11:39
professionalPaul Conrad27-Jul-08 11:39 
QuestionAvoid viewing source code Pin
sirisha guttikonda24-Jul-08 20:24
sirisha guttikonda24-Jul-08 20:24 
AnswerRe: Avoid viewing source code Pin
Johnny ²24-Jul-08 22:26
Johnny ²24-Jul-08 22:26 
AnswerRe: Avoid viewing source code Pin
L Viljoen25-Jul-08 2:46
professionalL Viljoen25-Jul-08 2:46 
AnswerRe: Avoid viewing source code Pin
stevio25-Jul-08 2:50
stevio25-Jul-08 2:50 
AnswerRe: Avoid viewing source code Pin
Perspx25-Jul-08 7:17
Perspx25-Jul-08 7:17 
AnswerRe: Avoid viewing source code Pin
Paul Conrad26-Jul-08 18:04
professionalPaul Conrad26-Jul-08 18:04 
QuestionSharepoint web part using DLL created with IKVMC (Java to C# compiler) [modified] Pin
kselman24-Jul-08 8:42
kselman24-Jul-08 8:42 
GeneralRe: Sharepoint web part using DLL created with IKVMC (Java to C# compiler) Pin
Shog924-Jul-08 11:25
sitebuilderShog924-Jul-08 11:25 
QuestionSetting style to a div's overflow scroll bar Pin
DeepToot24-Jul-08 4:14
DeepToot24-Jul-08 4:14 
GeneralRe: Setting style to a div's overflow scroll bar Pin
Shog924-Jul-08 7:39
sitebuilderShog924-Jul-08 7:39 
GeneralRe: Setting style to a div's overflow scroll bar Pin
DeepToot24-Jul-08 8:28
DeepToot24-Jul-08 8:28 
GeneralRe: Setting style to a div's overflow scroll bar Pin
Shog924-Jul-08 8:31
sitebuilderShog924-Jul-08 8:31 
QuestionWeb part nightmare Pin
L Viljoen23-Jul-08 23:14
professionalL Viljoen23-Jul-08 23:14 
GeneralRe: Web part nightmare Pin
Shog924-Jul-08 7:43
sitebuilderShog924-Jul-08 7:43 
GeneralRe: Web part nightmare Pin
L Viljoen24-Jul-08 8:38
professionalL Viljoen24-Jul-08 8:38 
QuestionDo you know of any good scalable web hosting service for ASP.NET? Pin
Waleed Eissa23-Jul-08 18:31
Waleed Eissa23-Jul-08 18:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.