<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>ACE Team - Security, Performance &amp; Privacy - All Comments</title><link>http://blogs.msdn.com/b/ace_team/</link><description /><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Simple Rules To Stop Bad Guys</title><link>http://blogs.msdn.com/b/ace_team/archive/2009/12/16/simple-rules-to-stop-bad-guys.aspx#9938510</link><pubDate>Fri, 18 Dec 2009 01:42:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9938510</guid><dc:creator>Daniel</dc:creator><description>&lt;P&gt;Regarding the SharePoint stuff:&lt;/P&gt;
&lt;P&gt;Some of the SQL SharePoint generates against the content db is built on the fly (done properly with parameter substitution). Not any call from the Object model (or COM API) directly calls a sproc. It is mostly simple IF ELSE constructs.&lt;/P&gt;
&lt;P&gt;Just take a look using SQL Profiler when provisioning sites or pages to sharepoint sites.&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9938510" width="1" height="1"&gt;</description></item><item><title>re: Simple Rules To Stop Bad Guys</title><link>http://blogs.msdn.com/b/ace_team/archive/2009/12/16/simple-rules-to-stop-bad-guys.aspx#9938509</link><pubDate>Fri, 18 Dec 2009 01:37:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9938509</guid><dc:creator>Daniel</dc:creator><description>&lt;p&gt;I think anyone here agrees that stored procedures and parameterized queries are always a superior choice, because they offer &amp;quot;some&amp;quot; built-in validation for free(the stored proc still needs application level validation), are easier to maintain and - depends on the perspective - usually perform no worse.&lt;/p&gt;
&lt;p&gt;Maybe we are not on the same page regarding the definition of &amp;quot;dynamic&amp;quot; sql: Building the parameterized SQL dynamically and still using @Param-substituted parameters WITH the built-in validation, does that constitute &amp;quot;dynamic&amp;quot; SQL or just &amp;quot;parameterized&amp;quot; SQL? To me, the query is still &amp;quot;dynamic&amp;quot;.&lt;/p&gt;
&lt;p&gt;But actually, you simply cannot write _any_ database query (even when talking to SQL Server, my favorite relational DB) pre-built (see SharePoint 2007, which uses parameterized, but dynamically built/stitched together queries for some things) or even parameterized. Some of the SQL Server Service Broker statements simply _cannot_ be parameterized when using the ADO.NET interface to call them. You need to use fully &amp;quot;dynamic&amp;quot; SQL here.&lt;/p&gt;
&lt;p&gt;So, telling users to &amp;quot;get a new database&amp;quot; is not a good idea:-p SQL Server is still king of the hill.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9938509" width="1" height="1"&gt;</description></item><item><title>re: Simple Rules To Stop Bad Guys</title><link>http://blogs.msdn.com/b/ace_team/archive/2009/12/16/simple-rules-to-stop-bad-guys.aspx#9938156</link><pubDate>Thu, 17 Dec 2009 12:51:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9938156</guid><dc:creator>TheRockyH</dc:creator><description>&lt;p&gt;Someone else recently mentioned this to me as well. And after reading it in that light, perhaps you are correct. &lt;/p&gt;
&lt;p&gt;However, that sentiment is still incorrect. Securing dynamic SQL is much harder than securing parameterised stored procs. &lt;/p&gt;
&lt;p&gt;All things being equal, there are more likely to be mistakes in implementation and filtering with dynamic sql than there are with parameterised stored procs. &lt;/p&gt;
&lt;p&gt;So based on our team's 2000+ reviews, and identified bugs, and what we have seen is that dynamic sql is much more prone to error and consequently much more likely to be exploitable. So they are not the same. &lt;/p&gt;
&lt;p&gt;Additionally, along the lines of checking facts, SharePoint does not use dynamic sql. There is no dynamic sql created in the web application tier of SharePoint, and all of the database stored procs are parameterised stored procedures. &amp;nbsp;The only time you will have dynamic sql in SharePoint is if you create you own web part and you put it in there. SharePoint itself does not have any. &lt;/p&gt;
&lt;p&gt;He may be confused with SPQuery. SPQuery is it's own type of query for finding objects stored in SharePoint. It, like LDAP or XPATH, has its own type of query system. Again it is not Dynamic SQL because it is not SQL against a database. It is actually a thing called Collaborative Application Markup Language (CAML). Bottom line, you can't own an SQL box with SPQuery.&lt;/p&gt;
&lt;p&gt;If anyone is interested, here are the links to information about it:&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://blogs.msdn.com/sharepoint/default.aspx"&gt;http://blogs.msdn.com/sharepoint/default.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://msdn.microsoft.com/en-us/library/dd587370"&gt;http://msdn.microsoft.com/en-us/library/dd587370&lt;/a&gt;(office.11).aspx&lt;/p&gt;
&lt;p&gt;And the MS SharePoint team blog has a lot of good info too: &lt;a rel="nofollow" target="_new" href="http://blogs.msdn.com/sharepoint/default.aspx"&gt;http://blogs.msdn.com/sharepoint/default.aspx&lt;/a&gt;&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9938156" width="1" height="1"&gt;</description></item><item><title>re: Simple Rules To Stop Bad Guys</title><link>http://blogs.msdn.com/b/ace_team/archive/2009/12/16/simple-rules-to-stop-bad-guys.aspx#9938144</link><pubDate>Thu, 17 Dec 2009 12:13:09 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9938144</guid><dc:creator>Ronald</dc:creator><description>&lt;p&gt;I actually understood Daniel's comment as: the attack vector for stored procedures, parameterized queries and sp_executesql is equally big.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9938144" width="1" height="1"&gt;</description></item><item><title>re: Simple Rules To Stop Bad Guys</title><link>http://blogs.msdn.com/b/ace_team/archive/2009/12/16/simple-rules-to-stop-bad-guys.aspx#9938047</link><pubDate>Thu, 17 Dec 2009 07:22:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9938047</guid><dc:creator>TheRockyH</dc:creator><description>&lt;P&gt;Hello Daniel. Thank you for your passionate response. &lt;/P&gt;
&lt;P&gt;So just to be clear you said:&lt;/P&gt;
&lt;P&gt;" there is no bigger attach vector than with a parameterized sp." aside from the misspelling of attack I think you are trying to say that Parameterised Stored Procedures are the biggest attack vector. Then you immediately followed with:&lt;/P&gt;
&lt;P&gt;"If you write such articles about security, at least get the facts straight."&lt;/P&gt;
&lt;P&gt;Excellent advice, especially considering your previous statement. &lt;/P&gt;
&lt;P&gt;So just for the sake of getting facts straight, can you give me any examples of where a properly created (not using string concatenation and calling EXEC or sp_execsql which is vulnerable to SQL injection) parameterised stored procedure is exploited through SQL injection?&lt;/P&gt;
&lt;P&gt;Here are some of the many many examples that describe where and why you should not use dynamic sql.&lt;/P&gt;
&lt;P&gt;From: &lt;A href="http://cwe.mitre.org/data/definitions/564.html" rel=nofollow target=_new&gt;http://cwe.mitre.org/data/definitions/564.html&lt;/A&gt; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;Implement SQL strings using prepared statements that bind variables. Prepared statements that do not bind variables can be vulnerable to attack.&lt;/P&gt;
&lt;P&gt;Use vigorous white-list style checking on any user input that may be used in a SQL command. Rather than escape meta-characters, it is safest to disallow them entirely. Reason: Later use of data that have been entered in the database may neglect to escape meta-characters before use. Narrowly define the set of safe characters based on the expected value of the parameter in the request.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;From&lt;/STRONG&gt;: &lt;A href="http://cwe.mitre.org/data/definitions/89.html" rel=nofollow target=_new&gt;http://cwe.mitre.org/data/definitions/89.html&lt;/A&gt; &amp;lt;- This CWE definition is all about not using Dynamic SQL and properly validating input. &lt;/P&gt;
&lt;P&gt;Process SQL queries using prepared statements, parameterized queries, or stored procedures. These features should accept parameters or variables and support strong typing. Do not dynamically construct and execute query strings within these features using "exec" or similar functionality, since you may re-introduce the possibility of SQL injection.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;From&lt;/STRONG&gt;: &lt;A href="http://msdn.microsoft.com/en-us/library/ms161953.aspx" rel=nofollow target=_new&gt;http://msdn.microsoft.com/en-us/library/ms161953.aspx&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Never build Transact-SQL statements directly from user input. &lt;/P&gt;
&lt;P&gt;Use stored procedures to validate user input.&lt;/P&gt;
&lt;P&gt;Use Type-Safe SQL Parameters&lt;/P&gt;
&lt;P&gt;The Parameters collection in SQL Server provides type checking and length validation. If you use the Parameters collection, input is treated as a literal value instead of as executable code&lt;/P&gt;
&lt;P&gt;Use Parameterized Input with Stored Procedures&lt;/P&gt;
&lt;P&gt;Use the Parameters Collection with Dynamic SQL&lt;/P&gt;
&lt;P&gt;If you cannot use stored procedures, you can still use parameters, as shown in the following code example:&lt;/P&gt;
&lt;P&gt;SqlDataAdapter myCommand = new SqlDataAdapter(&lt;/P&gt;
&lt;P&gt;"SELECT au_lname, au_fname FROM Authors WHERE au_id = @au_id", conn);&lt;/P&gt;
&lt;P&gt;SQLParameter parm = myCommand.SelectCommand.Parameters.Add("@au_id", &lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;SqlDbType.VarChar, 11);&lt;/P&gt;
&lt;P&gt;Parm.Value = Login.Text;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;From&lt;/STRONG&gt;: &lt;A href="http://unixwiz.net/techtips/sql-injection.html#miti" rel=nofollow target=_new&gt;http://unixwiz.net/techtips/sql-injection.html#miti&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Use stored procedures for database access &lt;/P&gt;
&lt;P&gt;When the database server supports them, use stored procedures for performing access on the application's behalf, which can eliminate SQL [injection] entirely (assuming the stored procedures themselves are written properly).&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;From:&lt;/STRONG&gt; the Microsoft SDL documentation, and quoted on Michael Howard's blog: &lt;A href="http://blogs.msdn.com/sdl/archive/2008/05/15/giving-sql-injection-the-respect-it-deserves.aspx" rel=nofollow target=_new&gt;http://blogs.msdn.com/sdl/archive/2008/05/15/giving-sql-injection-the-respect-it-deserves.aspx&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;Applications accessing a database must do so only using parameterized queries. (RH This is a rule at Microsoft and dynamic SQL is considered a high severity bug if found)&lt;/P&gt;
&lt;P&gt;Creating dynamic queries using string concatenation potentially allows an attacker to execute an arbitrary query through the application. This vulnerability allows for unauthorized, interactive, logon to a SQL server which may result in the execution of malicious commands leading to the possible modification (or deletion) of Operating System or user data. &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;From:&lt;/STRONG&gt; the SDL documentation: (and Michael Howard's blog above)&lt;/P&gt;
&lt;P&gt;"Applications accessing databases should do so only using stored procedures. "&lt;/P&gt;
&lt;P&gt;-and-&lt;/P&gt;
&lt;P&gt;"Do not use "exec @sql" construct in your stored procedures.&lt;/P&gt;
&lt;P&gt;Using stored procedures helps to mitigate the SQL injection threat to a great extent since type checking is available for parameters. If the attacker supplies input that does not match the type constraints the stored procedures will throw an exception. In the vast majority of the cases, this should be properly handled within the application. &lt;/P&gt;
&lt;P&gt;However, if the stored procedures perform string manipulation in their code and then execute that query using the "exec @sql" construct incorrect handling of user input can produce the same SQL injection vulnerability as would be seen at the application layer."&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;From&lt;/STRONG&gt;: &lt;A href="http://capec.mitre.org/data/definitions/66.html" rel=nofollow target=_new&gt;http://capec.mitre.org/data/definitions/66.html&lt;/A&gt; (SQL Injection)&lt;/P&gt;
&lt;P&gt;Mitigations&lt;/P&gt;
&lt;P&gt;Strong input validation - All user-controllable input must be validated and filtered for illegal characters as well as SQL content. Keywords such as UNION, SELECT or INSERT must be filtered in addition to characters such as a single-quote(') or SQL-comments (--) based on the context in which they appear.&lt;/P&gt;
&lt;P&gt;Use of parameterized queries or stored procedures - Parameterization causes the input to be restricted to certain domains, such as strings or integers, and any input outside such domains is considered invalid and the query fails. Note that SQL Injection is possible even in the presence of stored procedures if the eventual query is constructed dynamically.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;From&lt;/STRONG&gt;: &lt;A href="http://msdn.microsoft.com/en-us/magazine/cc163917.aspx#S4" rel=nofollow target=_new&gt;http://msdn.microsoft.com/en-us/magazine/cc163917.aspx#S4&lt;/A&gt; Stop SQL Injection Attacks Before They Stop You&lt;/P&gt;
&lt;P&gt;"Avoid Dynamic SQL&lt;/P&gt;
&lt;P&gt;The SQL injection attacks I have demonstrated in this article are all dependent on the execution of dynamic SQL—that is, SQL statements constructed by the concatenation of SQL with user-entered values. Using parameterized SQL, however, greatly reduces the hacker's ability to inject SQL into your code."&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;From&lt;/STRONG&gt;: &lt;A href="http://www.owasp.org/index.php/SQL_Injection" rel=nofollow target=_new&gt;http://www.owasp.org/index.php/SQL_Injection&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;SQL injection errors occur when: &lt;/P&gt;
&lt;P&gt;1.Data enters a program from an untrusted source. &lt;/P&gt;
&lt;P&gt;2.The data used to dynamically construct a SQL query &lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;From&lt;/STRONG&gt;: &lt;A href="http://www.owasp.org/index.php/SQL_Injection" rel=nofollow target=_new&gt;http://www.owasp.org/index.php/SQL_Injection&lt;/A&gt;_Prevention_Cheat_Sheet &lt;/P&gt;
&lt;P&gt;Primary Defenses&lt;/P&gt;
&lt;P&gt;Defense Option 1: Prepared Statements (Parameterized Queries)&lt;/P&gt;
&lt;P&gt;Defense Option 2: Stored Procedures&lt;/P&gt;
&lt;P&gt;Defense Option 3: Escaping All User Supplied Input&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;From&lt;/STRONG&gt;: &lt;A href="http://www.owasp.org/index.php/Reviewing_Code_for_SQL_Injection" rel=nofollow target=_new&gt;http://www.owasp.org/index.php/Reviewing_Code_for_SQL_Injection&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Best Practices when Dealing with Databases &lt;/P&gt;
&lt;P&gt;Use Database stored procedures, but even stored procedures can be vulnerable. Use parameterized queries instead of dynamic SQL statements. Data validate all external input: Ensure that all SQL statements recognize user inputs as variables, and that statements are precompiled before the actual inputs are substituted for the variables in Java. &lt;/P&gt;
&lt;P&gt;Daniel here are some books I've read that you may want to take a look at:&lt;/P&gt;
&lt;P&gt;"&lt;STRONG&gt;Writing Secure Code&lt;/STRONG&gt;". 2nd Edition. M. Howard and D. LeBlanc. Microsoft. 2003.&lt;/P&gt;
&lt;P&gt;"&lt;STRONG&gt;The Database Hacker's Handbook: Defending Database Servers&lt;/STRONG&gt;". David Litchfield, Chris Anley, John Heasman and Bill Grindlay. &amp;nbsp;Wiley. 2005-07-14. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;"&lt;STRONG&gt;The Oracle Hacker's Handbook: Hacking and Defending Oracle&lt;/STRONG&gt;". David Litchfield. &amp;nbsp;Wiley. 2007-01-30. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Gray Hat Hacking, Second Edition: The Ethical Hacker's Handbook&lt;/STRONG&gt; by Shon Harris, Allen Harper, Chris Eagle, and Jonathan Ness (Dec 20, 2007)&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Chained Exploits: Advanced Hacking Attacks from Start to Finish&lt;/STRONG&gt; by Andrew Whitaker, Keatron Evans, and Jack B. Voth (Mar 9, 2009)&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;The CISSP Prep Guide: Mastering the Ten Domains of Computer Security&lt;/STRONG&gt; by Ronald L. Krutz and Russell Dean Vines (Sep 10, 2001)&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Hacking: The Art of Exploitation, 2nd Edition&lt;/STRONG&gt; by Jon Erickson (Jan 11, 2008)&lt;/P&gt;
&lt;P&gt;There are many others but these will help you get started. &lt;/P&gt;
&lt;P&gt;Over the past 5 years, I've seen a lot of SQL injection vulnerabilities, and properly constructed stored procedures accessed through parameterised queries always fix it. Hopefully we have alleviated your belief that "there is no bigger attach vector than with a parameterized sp"&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9938047" width="1" height="1"&gt;</description></item><item><title>re: Simple Rules To Stop Bad Guys</title><link>http://blogs.msdn.com/b/ace_team/archive/2009/12/16/simple-rules-to-stop-bad-guys.aspx#9937642</link><pubDate>Wed, 16 Dec 2009 14:03:39 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9937642</guid><dc:creator>Daniel</dc:creator><description>&lt;p&gt;Alastair Upton is right, RockyH is wrong. &amp;quot;Abandon Dynamic SQL&amp;quot; is a superficial and wrong statement.&lt;/p&gt;
&lt;p&gt;For example SharePoint uses dynamic SQL excessively, and as long as you do it right (and if you do it only when you HAVE to do it, because it also may hurt perf and maintainability), with parameterized queries and optionally sp_executesql, there is no bigger attach vector than with a parameterized sp.&lt;/p&gt;
&lt;p&gt;If you write such articles about security, at least get the facts straight.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9937642" width="1" height="1"&gt;</description></item><item><title>re: Simple Rules To Stop Bad Guys</title><link>http://blogs.msdn.com/b/ace_team/archive/2009/12/16/simple-rules-to-stop-bad-guys.aspx#9937637</link><pubDate>Wed, 16 Dec 2009 13:53:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9937637</guid><dc:creator>TheRockyH</dc:creator><description>&lt;p&gt;Sorry Richard, I fixed the link. You will have to login/register on Microsoft Connect, then download it from there. &lt;a rel="nofollow" target="_new" href="https://connect.microsoft.com/site734/Downloads"&gt;https://connect.microsoft.com/site734/Downloads&lt;/a&gt; &lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9937637" width="1" height="1"&gt;</description></item><item><title>re: Simple Rules To Stop Bad Guys</title><link>http://blogs.msdn.com/b/ace_team/archive/2009/12/16/simple-rules-to-stop-bad-guys.aspx#9937621</link><pubDate>Wed, 16 Dec 2009 13:16:40 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9937621</guid><dc:creator>Richard</dc:creator><description>&lt;p&gt;Where's the missing link to download WACA?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9937621" width="1" height="1"&gt;</description></item><item><title>re: Simple Rules To Stop Bad Guys</title><link>http://blogs.msdn.com/b/ace_team/archive/2009/12/16/simple-rules-to-stop-bad-guys.aspx#9937597</link><pubDate>Wed, 16 Dec 2009 12:20:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9937597</guid><dc:creator>TheRockyH</dc:creator><description>&lt;p&gt;Hi Alistair,&lt;/p&gt;
&lt;p&gt;Not really. Dynamic SQL by definition is not fine. It depends on how you are considering 'parameterized' SQL. If you are referring to parameterized stored procedures, then yes, that is the way to go but that is not dynamic SQL. &lt;/p&gt;
&lt;p&gt;Essentially, dynamic SQL is when you build the SQL up as a string and do all of your variable/parameter substitution (either in code, or in the stored proc itself) before you send the SQL statement to the DB engine to be processed as a command string. &lt;/p&gt;
&lt;p&gt;Now, that being said, ORMs, and NHibernate, etc. can produce good SQL, that is technically dynamic, but with proper and extensive input validation. &lt;/p&gt;
&lt;p&gt;However these rules are aimed at developers writing code and the code that they write. Not necessarily the libraries they use. Your point is taken though. Thanks for the comment.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9937597" width="1" height="1"&gt;</description></item><item><title>re: Simple Rules To Stop Bad Guys</title><link>http://blogs.msdn.com/b/ace_team/archive/2009/12/16/simple-rules-to-stop-bad-guys.aspx#9937591</link><pubDate>Wed, 16 Dec 2009 11:58:33 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9937591</guid><dc:creator>Alastair Upton</dc:creator><description>&lt;p&gt;Shouldn't Rule #4 read 'Use parameterized SQL?' Dynamic SQL is perfectly fine (and it is what most ORMs use) provided that it is parameterized. It is not the use of stored procedures that protect you (as you have shown in the example) but the additional protection of parameter validation over string concatenation.&lt;/p&gt;
&lt;p&gt;It is also important to protect the various layers of your application (e.g. implementing security on the database tier to make sure minimal rights are granted on objects).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9937591" width="1" height="1"&gt;</description></item></channel></rss>