Register  Login  
  February 9, 2012  
Forum    
Forum Minimize
 
ForumForumDiscussionsDiscussionsSQLGridSelected...SQLGridSelected...Single quote in querystring parameterSingle quote in querystring parameter
Previous Previous
 
Next Next
New Post
 4/16/2010 2:47 PM
 

Hi Paul,

Do you see any way to either replace or delimit single quotes that are submitted in the [QUERY:Search] parameter below? I have tried several things without success. Any help much appreciated.

Select
'<a href="' + [LinkStart] + '[@ENCRYPT:' + CAST(FileId as varchar) + ']&File=' + FileName + '">' + [DocTitle] + '</a>
<br>' + Characterization AS Results
From
OPENQUERY(LOCALSERVER, 'EXECUTE [DNN5].[dbo].Files_SearchFiles_GetLinkFileID_tv_Debug [DNN:UserId], ''Documents/'', ''local'', ''DNN5'', ''shallow traversal'', ''c:\dnn5\portals\0\'', ''http://localserver/dnn5/LinkClick.aspx?fileticket='', ''[QUERY:Search]''') AS derivedtbl

New Post
 4/16/2010 4:22 PM
 

This is a classic problem and gets worst with any attempt to check for SQL injection. Frankly, I do not have a specific solution as it depends on the search data. In most cases I suggest using a lookup table where possible and then use a corresponding value to select the record. This not the best for large data sets.

If you could describe the data being requested in the Search, then I could possibly. One possibility would be to pass an alternate character string (%34;) and then handle that character sequence in your OPENQUERY Function. Still it's a kluge.

Paul.

New Post
 5/7/2010 2:08 PM
 
Hi Paul,

I also have a similar problem. I checked your samples site and it looks working to me.

The SQL you get is something like: Where LastName = 'O''Brien'


But when I do the same, I get the SQL query like: Where surname like 'O' Brien' and because there is one less "'" "(%34;)" I get an error message saying: Incorrect syntax near 'Brien'. Unclosed quotation mark after the character string '

Is there any way to fix the same?

I have both the SQLGridSelectedView v4 and v5 downloaded and installed.

Thanks & Best Regards,

Shabbir
New Post
 5/8/2010 5:50 PM
 

The issue is not really related to SQLGridSelectedView or DotNetNuke. This issue is between the Web and the MS-SQL. So there is no real answer for the best solution - one fix for all. You need to develop your own solution based on what level of security you need to maintain based on your audience.

The present of the single quote in a textbox being passed to query can just be data, or the indication of a SQL Injection attack.

You could disable the Check for SQL Injection, disable data entry checking, then pass the data into a store prodecure to verify it's data not an attack, then process accodingly.

Beware however, more and more companies are having site validated by third parties and SQL Injection attack is the very first series of test that will be applied. I've been there and watch for 16 hours as my site was systemically attacked - every data entry field was attacked repeatedly with several varitions of the well known attacks "vectors". DotNetNuke came through - and I had only a few minor issues regarding parameter passing in a IFrame. Not I do not allow single quoted character data into my site for search data. I replace it with a different character - but that's just me.

Paul.

Previous Previous
 
Next Next
ForumForumDiscussionsDiscussionsSQLGridSelected...SQLGridSelected...Single quote in querystring parameterSingle quote in querystring parameter

Print  

  Home | Blog | Forum | Subscriptions | Free Modules | Videos   Page generated in 0.2036333 seconds.
  Copyright 2010 by TressleWorks   Terms Of Use | Privacy Statement