asp.net - ASP.Net 控件是否通过 View 状态公开 SQL 查询?

标签 asp.net security sql-injection viewstate

作为默认 ASP.Net 控件集的一部分的控件是否始终使用 viewstate 或 controlstate?

即,如果我将下面的代码放到一个全新的 Web 表单上,我的 SQL 字符串是否处于未加密的控制状态?

<asp:SqlDataSource ID="mobileData" runat="server" 
        DataSourceMode="DataReader" 
        SelectCommand="SELECT * from ma.bob WHERE Vendor IS NOT NULL" 
/>

我知道如何加密 View 状态和控制状态,但对我来说,这个常见的用例可能非常不安全,这似乎很疯狂。确实可以通过修改控制状态来执行 SQL 注入(inject)攻击吗?

我认为大多数人都会考虑为敏感应用程序加密控制状态,但实际上,如果我的假设是正确的——那么它应该总是这样做——并且 Visual Studio 应该默认启用它?

我是否正确地考虑了这一点,还是我有错误的一端?

最佳答案

要回答您的问题,没有 .
来自 MSDN

For security purposes, the SelectCommand property is not stored is view state. Because it is possible to decode the contents of view state on the client, storing sensitive information about the database structure in view state could result in an information disclosure vulnerability.

关于asp.net - ASP.Net 控件是否通过 View 状态公开 SQL 查询?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9400980/

相关文章:

c# - 在转发器中定义变量?

java - 查询jsf应用程序的版本信息

php - 如何处理 url 修改 php/mysql

c# - 阻止我的应用程序进行 sql 注入(inject)?

asp.net - 添加一个不存在的css类不好吗?

c# - 找不到方法 : 'System.String System.String.Format(System.IFormatProvider, System.String, System.Object)'

asp.net - 使用 SqlMetal 和 Visual Studio 时自动生成 DataContext 设计器文件

java - 如何限制 Java 应用程序关闭?

security - 需要 SQL 注入(inject)帮助

sql - Zend Db 避免 sql 注入(inject)