概要
如果 XOML (可扩展对象标记语言) 文件引用 某些类型,并且 在 Visual Studio 中打开文件时导致随机代码运行,那么在 Microsoft Visual Studio 2019 和 Visual Studio 2017 中存在远程执行代码漏洞。
现限制 .xoml 文件中允许使用的 类型。 如果打开包含 新未授权类型之一 的 .xoml 文件,你将收到一条说明该类型未授权的错误 消息。
若要了解有关漏洞的更多信息,请转到CVE-2019-1113。
替代方法
如果打开的.xoml 文件不会导致安全问题,则你可以禁用检查未授权类型的过程。 为此,向 devenv.exe.config 文件的<appSettings> 添加 一个节,如下所示:
...
<appSettings>
<add key="microsoft:WorkflowComponentModel:DisableXOMLSerializerTypeChecking" value="true"/>
</appSettings>
...
这个 appSetting值完全 禁止 在 XOML (可扩展对象标记语言)序列化器中进行类型检查。 如果该值被设置为 true,它将优先于以下新的 appSetting 值, 仅禁止特定类型。
如果你只想禁用某些特定类型,则必须对 devenv.exe.config 文件进行以下更改:
...
<appSettings>
<add key="microsoft:WorkflowComponentModel:DisableXOMLSerializerDefaultUnauthorizedTypes" value="true"/>
</appSettings>
...
此更改 允许默认情况下未授权的所有类型。 要想将特定类型标记为未授权类型,还必须对 devenv.exe.config 文件进行以下更改:
...
<configuration>
...
<configSections>
<sectionGroup name="System.Workflow.ComponentModel.WorkflowCompiler" type="System.Workflow.ComponentModel.Compiler.WorkflowCompilerConfigurationSectionGroup, System.Workflow.ComponentModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<section name="authorizedTypes" type="System.Workflow.ComponentModel.Compiler.AuthorizedTypesSectionHandler, System.Workflow.ComponentModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</sectionGroup>
</configSections>
...
<System.Workflow.ComponentModel.WorkflowCompiler>
<authorizedTypes>
<foo version="v4.0">
<authorizedType Assembly="System.Activities.Presentation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Activities.Presentation" TypeName="WorkflowDesigner" Authorized="false"/>
</foo>
</authorizedTypes>
</System.Workflow.ComponentModel.WorkflowCompiler>
...
</configuration>
...
这些更改仅将 System.Activities.Presentation中的 WorkflowDesigner 类型程序集标记为未授权,如下所示:
-
版本: 4.0.0.0
-
文化:中立
-
公钥令牌: 31bf3856ad364e35
要想将其他类型标记为未授权,你可以为这些类型添加类似的条目。