IE11 Enhanced Protected Mode 解决BHO与高权限进程通信问题

第一篇文章,不能含糊!

        IE11 即将release, 但从Win8 IE10开始,为了安全,MS就给IE新增了Enhanced Protected Mode (EPM)这个选项,官方的说法在[这里]. 不过Win8那会还好,因为默认是Disabled的,然而到了Win8.1, 这个选项的默认值变为了Enabled,看上去小小改动,其实对我们这种安全厂商,那是极大的负担,大约花了近一个月的时间才找到最终的solution!

        直接入正题,当EPM这个选项Enable的时候,我们在BHO里的一些API,比如create global event / share memory / RPC等等,都会以Access denied失败而告终,究其原因就是EPM下面,IE运行在AppContainer的Integrity Level,可以从procexp里看到,EPM在Enable和Disable的情况下本质的区别。

        

        正是由于AppContainer的存在,IE就成了一个Metro Style的IE,很封闭,很多高权限的功能都会被Deny。

        根据官方的说法,

The way to security provide such access is to build a broker object that runs at Medium IL. In Vista and later, brokers were needed to write protected resources, and in EPM, they are required to read protected resources.  The general pattern is:

  1. Untrusted code (the add-on running in the Protected Mode tab) calls a method in the broker, passing zero or more arguments.
  2. The broker evaluates the request's arguments and its own security policy.
  3. The broker confirms with the user that the requested operation is acceptable (e.g. by showing a Save prompt or whatever).
  4. The broker undertakes the operation if allowed, or blocks it if denied.

Writing a broker is a significant undertaking, and requires a thorough security audit to ensure that the broker doesn’t allow malicious code to escape from the tab running in Protected Mode.


        我们需要一个broker,让BHO跟broker通信,接着broker再跟高权限的process通信。

        Broker本身非常简单,就是一个Local COM Server,抛出接口,让BHO CoCreateInstance 然后调用接口。最大的区别在于这个broker及相关文件需要有一定的权限。默认情况下,C:\Program Files在Win8/Win8.1下就已经有了,叫做:ALL_APPLICATION_PACKAGES这个group,这个group的SID是"S-1-15-2-1",可以通过

        ConvertStringSidToSid
        AddAceToObjectsSecurityDescriptor

        这两个API来给需要的文件或者目录加上这个权限(只在Win8+有效), 重点就是需要给哪些文件加。

        1. BHO 以及依赖的dll

        2. Broker.exe 以及依赖的dll

        只有给它们都加上这个权限,那么在BHO就可以通过Broker来与另一个高权限的(Service)进程通信。

        别急,当使用之后还是会有小问题,因为当CoCreateInstance之后,IE会跳出popup,提示调用broker不安全,

        

        第一就是没签名了,这个是小事,当签名后还是会出现,还好MS有[解决方案].把broker.exe注册到HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Low Rights\ElevationPolicy。

        BHO终于可以在IE11上为所欲为了!

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 15
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 15
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值