【问题标题】:Bypassing Session 0 Isolation in Windows Server 2008 -- successful, but still not visible绕过 Windows Server 2008 中的会话 0 隔离 - 成功,但仍然不可见
【发布时间】:2011-07-29 05:59:58
【问题描述】:

我基本上使用位于here 的代码来启动一个进程。此代码在 Vista/7 中完美运行——如果我使用 System.Diagnostics.Process.Start() 启动一个进程,我看到它启动了,但由于它位于会话 0 中而不可见。使用此代码,我看到进程在会话 1 中启动(我在 Vista/7 中手动启动程序的同一会话)。

现在,在 Server 2008 中,当我手动启动程序时,它会打开到 Session 2。当我不使用此代码时,我看到进程仍会启动到 Session 0。当我使用此代码时,它会启动到 Session 1 - 但不可见。大概这是因为它没有在与我相同的会话中启动,因此存在于其他地方的“不可见”桌面上。

以前有人遇到过这个问题吗?该博客似乎比较受欢迎,所以我很难相信这个问题还没有得到解决。我正在使用的服务器是 64 位架构的,我的 win 7 机器是 32 位的。我不认为这有什么不同,博客表明该解决方案适用于两种架构。

【问题讨论】:

    标签: .net windows-server-2008 session-0-isolation


    【解决方案1】:

    如果您尝试通过远程桌面绕过 UAC,则需要使用 ID 覆盖。其原因是因为 Microsoft API 方法 WTSGetActiveConsoleSessionId 在使用远程桌面时无法提供正确的信息:

    附加到物理控制台的会话的会话标识符。

    因此,要绕过 Vista/Win7/2k8 UAC,您只需使用基本的 Ping 功能——它将在 LOCAL SYSTEM 下以正确的 SID 启动进程,以便用户可见。

    如果您发现没有发生这种情况,您可以进入进程管理器,检查 SID,然后使用 ping w/userIDOverride 来指定正确的 SID。

    private static readonly ILog Logger
        = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
    
    String applicationName = String.Empty;
    bool result; 
    
    public Access()
    {
        Logger.Debug("I am now in Access Constructor");
    }
    
    public void Ping(string address)
    {
        Logger.Debug("I am now in Ping");
    
        applicationName = @"C:\Windows\System32\ping.exe " + address + " -t";
        Logger.Debug(String.Format("Application Name: {0} ", applicationName));
    
        ApplicationLoader.PROCESS_INFORMATION procInfo;
        result = ApplicationLoader.StartProcessAndBypassUAC(
            applicationName,
            out procInfo,
            null);
    
        Logger.Debug(String.Format(
            "Result of StartProcessAndBypassUAC: {0} ", result.ToString()));
    }
    
    public void Ping(string address, int userIDOverride)
    {
        Logger.Debug("I am now in Ping w/ override");
    
        applicationName = @"C:\Windows\System32\ping.exe " + address + " -t";
        Logger.Debug(String.Format("Application Name: {0} ", applicationName));
    
        ApplicationLoader.PROCESS_INFORMATION procInfo;
        result = ApplicationLoader.StartProcessAndBypassUAC(
            applicationName,
            out procInfo,
            userIDOverride);
    
        Logger.Debug(String.Format(
            "Result of StartProcessAndBypassUAC: {0} ", result.ToString()));
    }
    

    【讨论】:

      猜你喜欢
      • 2011-01-28
      • 1970-01-01
      • 1970-01-01
      • 2023-04-08
      • 2014-11-01
      • 2013-04-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多