zoukankan      html  css  js  c++  java
  • 利用安装程序完成程序初始化

    对于开启了UAC保护的Windows系统,一种常见的绕过UAC保护的方法就是:

    很多应用软件在安装结束前通常都会给出一个选项(默认选中),让你可以方便的在安装完成后直接启动应用。

    安装程序作为一类特殊的程序,一般都会要求用户赋予其管理员权限以完成正常的安装动作。这样其启动的应用软件自身作为安装程序的一个子进程启动,便会继承其父进程的全部既得权限。

    这样启动的应用程序可以利用管理员权限完成一些初始化工作。

    这个方法适用于:比较方便的自注册,但外部完成注册则较麻烦或者冗余

    • COM类插件:通过宿主应用注册比较简单,但通过写注册表,则相对麻烦。

    这些内容源于一片文章——《当心应用软件借安装程序绕过UAC》,但换个角度思考问题也许会更好


    Q:
    Windows 7, C++, VS2008 I have a COM DLL that needs to be registered using "runas administrator" (it is a legacy app that writes to the registry) The DLL is used by a reports app which instantiates it using CoCreateInstance. This failed unless I also ran the reports app as administrator; until I changed the linker setting from /MANIFESTUAC to /MANIFESTUAC:NO

    Can anyone tell me why this works? Does it mean that I can write apps that bypass the UAC using this setting?

    A:
    If your installer/registerer app has a manifest, and it says "don't run elevated", when you try to write to HKLM it fails. If you have a manifest and it says "run elevated", when you try to write to HKLM it succeeds. If you have no manifest (which you request with /MANIFESTUAC:NO), when you try to write to HKLM it writes to a virtualized location instead.

    When you run the reports app, a similar triple applies although it it can read HKLM. Therefore if the reports app has a manifest, whether elevated or not, it reads HKLM. Without a manifest it reads the virtualized location. This is why you have success when both apps have a manifest or don't have a manifest.

    It would probably be preferably to have your installer app with a manifest that requests elevation, and your reports app have a manifest that does not request elevation. That way all your apps are telling the truth and everything works. Plus you know why it's happening.

  • 相关阅读:
    列举 spring 支持的事务管理类型?
    memcached 能够更有效地使用内存吗?
    Redis 集群方案什么情况下会导致整个集群不可用?
    详细描述一下 Elasticsearch 更新和删除文档的过程?
    Redis 常见性能问题和解决方案?
    如果有大量的 key 需要设置同一时间过期,一般需要注意什么?
    synchronized 和 ReentrantLock 的区别?
    Redis 支持的 Java 客户端都有哪些?官方推荐用哪个?
    memcached 最大的优势是什么?
    memcached 是原子的吗?
  • 原文地址:https://www.cnblogs.com/kevinzhwl/p/3884228.html
Copyright © 2011-2022 走看看