背景介紹

本文將探討如何將惡意Shellcode嵌入到 RDP 配置文件中,通過利用文件擴展名的固有屬性和特定 RDP 配置參數,成功注入惡意內容。

本內容深入探討了此類防御規避的技術細節,并促進了此類‘隱匿行動’的無縫執行。

觀察

隨著網絡釣魚技術的不斷發展,攻擊者獲取立足點的嘗試變得更加無情,通過觀察,攻擊者已經變得善于利用標準 Windows 功能來傳遞惡意Payloads,例如注入 PDF 文件或通過 LNK 攻擊將Payloads隱藏在 ISO 內。

雖然這看起來是一個聰明的舉動,但實際上此類技術可能會無意中暴露攻擊者,從而使防守方能夠發現他們的蹤跡并有效地做出響應。

在當今的環境中,尖端的防御技術已成為常態,在不發出警報的情況下,成功繞過防御機制傳遞惡意Payloads已成為一門真正的藝術。

有趣的是,RDP 連接文件及其內容注入相當具有吸引力,問題的核心在于如何成功植入Payloads并確保 RDP 連接文件的功能在嵌入內容的情況下完整可用,探索該過程也側面見證了網絡安全攻防對抗下的不斷發展。

RDP 連接文件結構

遠程桌面協議 (RDP) 連接文件通常以“.rdp”擴展名結尾,是一種配置文件,可與 Windows 系統的遠程桌面建立連接,該文件包含一個結構化布局,其中包含各種參數,每個參數都有助于遠程連接的設置和行為,雖然結構的具體細節可能因 RDP 客戶端版本和配置而有所不同,但通常都會存在以下組件:

1、Basic Settings: 基本設置:

  • full address: Specifies the target system’s IP address or hostname.
  • 完整地址:指定目標系統的 IP 地址或主機名。
  • username: Specifies the username for authentication.
  • username:指定用于認證的用戶名。
  • domain: Defines the domain or computer name for authentication.
  • 域:定義用于身份驗證的域或計算機名稱。
  • password: this field may contain the password, but it is not hardcoded inside the file.
  • 密碼:此字段可能包含密碼,但沒有硬編碼在文件內。

2、 Display Settings: 顯示設置:

  • screen mode id: Specifies the display mode (full screen, windowed, etc.).
  • screen mode id:指定顯示模式(全屏、窗口等)。
  • desktopwidth: Sets the width of the remote desktop window.
  • DesktopWidth:設置遠程桌面窗口的寬度。
  • desktopheight: Sets the height of the remote desktop window.
  • DesktopHeight:設置遠程桌面窗口的高度。
  • session bpp: Defines the session’s color depth (bits per pixel).
  • session bpp:定義會話的顏色深度(每像素位數)。

3、Connection Settings: 連接設置:

  • authentication level: Determines the level of authentication required.
  • 身份驗證級別:確定所需的身份驗證級別。
  • prompt for credentials: Specifies whether to prompt for credentials during connection.
  • 提示輸入憑據:指定在連接期間是否提示輸入憑據。
  • gatewayhostname: For Remote Desktop Gateway connections, specifies the gateway server’s hostname.
  • gatewayhostname:對于遠程桌面網關連接,指定網關服務器的主機名。

4、Experience Settings: 體驗設置:

  • bitmapcachepersistenable: Controls bitmap caching.
  • bitmapcachepersistenable:控制位圖緩存。
  • audiomode: Sets audio redirection settings.
  • audiomode:設置音頻重定向設置。

5、 Local Resources: 當地資源:

  • redirectclipboard: Enables or disables clipboard redirection.
  • redirectclipboard:啟用或禁用剪貼板重定向。
  • redirectprinters: Determines printer redirection.
  • redirectprinters:確定打印機重定向。
  • redirectotdrive: map local drive
  • redirectotdrive:映射本地驅動器。

6、Security Settings: 安全設定:

  • authentication level: Specifies the authentication method.
  • 認證級別:指定認證方式。
  • enablecredsspsupport: Enforces the use of Credential Security Support Provider (CredSSP).
  • enablecredsspsupport:強制使用憑據安全支持提供程序 (CredSSP)。
  • negotiate security layer: Specifies security negotiation settings.
  • 協商安全層:指定安全協商設置。

7、Advanced Settings: 高級設置:

  • enableworkspacereconnect: Controls the ability to reconnect to a disconnected session.
  • enableworkspacereconnect:控制重新連接到斷開連接的會話的能力。
  • promptcredentialonce: Prompts for credentials only once during the session.
  • promptcredentialonce:在會話期間僅提示一次憑據。
  • remoteapplicationmode: Enables RemoteApp mode.
  • Remoteapplicationmode:啟用 RemoteApp 模式。
  • kdcproxyname: configuration of Kerberos authentication
  • kdcproxyname:Kerberos身份驗證的配置

溫馨小貼士

在檢查了之前的 RDP 文件結構的所有參數后,當你嘗試超出特定參數允許的字符長度的限制或嘗試以非結構化方式放置Payloads時,RDP 連接文件將不再工作,并且被視為已損壞。

經過幾次嘗試,發現參數 kdcproxyname:s: 可以用來保存 base64 行,并且由于它位于高級類別選項下,因此可以重復或多次使用,且不會損壞文件功能。

kdcproxyname:s:<base64 line>
kdcproxyname:s:<base64 line>
kdcproxyname:s:<base64 line>
kdcproxyname:s:<base64 line>
kdcproxyname:s:<base64 line>
kdcproxyname:s:<base64 line>
generic
173 Bytes
? Guge's Blog