阿π
专注于网络协议,系统底层,服务器软件
C++博客 | 首页 | 发新随笔 | 发新文章 | | | 管理

Application Compatibility - Session 0 Isolation

In Windows XP, Windows Server 2003, and earlier versions of the Windows operating system, all services run in the same session as the first user who logs on to the console.  This session is called Session 0. Running services and user applications together in Session 0 poses a security risk because services run at elevated privilege and therefore are targets for malicious agents who are looking for a means to elevate their own privilege level.

The Microsoft Windows Vista operating system mitigates this security risk by isolating services in Session 0 and making Session 0 non-interactive.  In Windows Vista (and Windows Longhorn Server), only system processes and services run in Session 0.  The user logs on to Session 1.  On Windows Longhorn Server, subsequent users log on to subsequent sessions (Session 2, Session 3 etc).  This means that services never run in the same session as users' applications and are therefore protected from attacks that originate in application code.

Specific examples of affected driver classes include:

  • Printer drivers, which are loaded by the spooler service
  • All drivers authored with the User Mode Driver Framework (UMDF), because these drivers are hosted by a process in Session 0

Application classes affected by this feature:

  • Services that create a UI
  • A service that tries to use window message functions such as SendMessage and PostMessage to communicate with an application
  • Applications creating globally named objects

Sessions in Windows XP / 2003
OK - so we've already mentioned that Session 0 poses a security risk because services run at elevated privilege.  The first user on the console also runs in Session 0 - which provides the most common attack vector used to target unsuspecting users.

Sessions in Windows Vista
In Windows Vista, Session 0 is created for services and user-mode drivers.  Session 1 is created for the first user who logs in.  Applications for this user run in Session 1.

  • Each time a user logs in, a session is created for that user
  • Each session contains a collection of windows stations
  • The only supported interactive window station is WinSta0, so each session gets one of these
  • WinSta0 contains the keyboard, mouse, and display device
  • Each window station can contain multiple desktops, which have logical display surfaces and can be used to manage windows
  • Messages can only be sent between processes that are on the same desktop (the hook procedure of a process can also only receive messages intended for windows created on the same desktop)
  • Only one desktop at a time is active
  • There are several default desktops – default, WinLogon (secure), and screen-saver

OK - so what could this actually look like in a real world scenario?  Consider the following example - if a service belonging to an application generates a UI element in Session 0 - for example a dialog box waiting for the user to click "OK" or "Cancel", the application is now waiting on the service, and the UI is not displayed in the user session.  From the user perspective, the application appears to be hung, when in actual fact it is performing quite normally, and patiently waiting for a user response that the user cannot see!

As you can imagine - this presents a problem for users, administrators and developers.  However, there are some quick mitigating factors to consider.

  • If the application's service uses a UI, a built-in mitigation in Windows Vista allows the user to interact with the Session 0 UI in a special desktop.  This will make the UI specific to the application available and not the entire Session 0 desktop.
  • If the application creates globally named objects, then use the Windows XP compatibility mode to ensure that the application will continue to work with the Session 0 services.

When testing applications for compatibility with Windows Vista, consider the following test scenarios:

  • Test and verify the application on Windows XP in a Terminal Server mode or a Fast User Switching (FUS) mode.  If the application works properly on Windows XP in these scenarios, then it is very likely to work under Windows Vista.
  • Verify that the application functions properly after applying the Window XP compatibility mode, which contains mitigation for some of the Session 0 issues.
  • Test the driver in Windows Vista to ensure that it runs properly.  If that is not possible, test the driver in Windows XP with FUS enabled and multiple users logged on.  If the driver works correctly for second and subsequent logged-on users, it is not likely to be affected by the Session 0 changes in Windows Vista.  The only issues that this test does not detect are those related to the absence of the video driver in Session 0 in Windows Vista.

Finally, you can leverage the following Windows Vista capability solutions:

  • Use client or server mechanisms such as remote procedure call (RPC) or named pipes to communicate between services and applications.
  • Use the WTSSendMessage function to create a simple message box on the user's desktop.  This allows the service to give the user a notification and request a simple response.
  • For more complex UI, use the CreateProcessAsUser function to create a process in the user's session.
  • Explicitly choose either the Local\ or Global\ namespace for any named objects, such as events or mapped memory, which the service makes available.

And that will do it for a quick look at how Session 0 isolation affects Application Compatibility in Windows Vista.  The links below contain more information on some of the concepts discussed above.  Until next time ...

发表于 2010-09-08 14:03 阿π 阅读(1324) 评论(0)  编辑 收藏 引用 所属分类: 其它
 

只有注册用户登录后才能发表评论。
【推荐】100%开源!大型工业跨平台软件C++源码提供,建模,组态!
相关文章:
  • Linux下makefile教程
  • c++ 中关于int,unsigned int , short的跨平台移植
  • C++中的四种强制类型转换的区别 [转]
  • c++ 枚举网页
  • [收藏]QQ_dll Function
  • [分享收藏]IP协议族协议头结构
  • atoi,atof实现
  • c++ web Kit简介
  • PE文件头的结构图
  • DLL在应用程序间共享数据
网站导航: 博客园   IT新闻   BlogJava   博问   Chat2DB   管理


随笔:64 文章:15 评论:65 引用:0
<2010年9月>
日一二三四五六
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789

留言簿(14)

  • 给我留言
  • 查看公开留言
  • 查看私人留言

随笔分类

  • 非技术(13) (rss)
  • 服务器开发(3) (rss)
  • 流媒体 (rss)
  • 其它(25) (rss)
  • 驱动编程 (rss)
  • 图形开发 (rss)
  • 网络编程(14) (rss)

随笔档案

  • 2012年6月 (1)
  • 2012年3月 (1)
  • 2011年4月 (1)
  • 2010年12月 (1)
  • 2010年11月 (13)
  • 2010年10月 (1)
  • 2010年9月 (10)
  • 2010年8月 (7)
  • 2010年7月 (5)
  • 2010年6月 (6)
  • 2010年5月 (9)
  • 2010年4月 (3)
  • 2010年2月 (1)
  • 2010年1月 (5)

收藏夹

  • 收藏(1) (rss)

最新随笔

  • 1. Linux下makefile教程
  • 2. Delete Gmail account
  • 3. c++ 中关于int,unsigned int , short的跨平台移植
  • 4. 【转帖】青年买不起房欲自杀折射四大悲哀
  • 5. C++中的四种强制类型转换的区别 [转]
  • 6. 成都地铁规划[图]
  • 7. linux makefile编写
  • 8. c++ 枚举网页
  • 9. 设计winsock服务器需要注意的几个问题
  • 10. CVC内部杂志

最新评论

  • 1. re: UNICODE与ANSI的区别
  • 内容简明扼要,适合我的理解,谢谢
  • --欣豆儿
  • 2. re: c++ 中关于int,unsigned int , short的跨平台移植
  • 跨平台移植写的很全面,学习了。
  • --poker
  • 3. re: 网络通讯协议图
  • 太好了!谢谢!
  • --雨
  • 4. re: 我常去的编程技术网站
  • 评论内容较长,点击标题查看
  • --home loans
  • 5. re: 我常去的编程技术网站
  • 评论内容较长,点击标题查看
  • --forum profile service

阅读排行榜

  • 1. 网络通讯协议图(18005)
  • 2. linux makefile编写(13984)
  • 3. C++中的四种强制类型转换的区别 [转](10832)
  • 4. 分享以前收藏的TCP状态转换图(9958)
  • 5.  Socket粘包问题(8818)

Powered by: 博客园
模板提供:沪江博客
Copyright ©2025 阿π