翻译|其它|编辑:郝浩|2004-02-06 15:28:00.000|阅读 1527 次
概述:
# 界面/图表报表/文档/IDE等千款热门软控件火热销售中 >>
Any Microsoft? ActiveX? control should be conceived and designed with security in mind.
An ActiveX control can be an extremely insecure way to provide a feature. Because it is a Component Object Model (COM) object, it can do anything the user can do from that computer. It can read from and write to the registry, and it has access to the local file system. From the moment a user downloads an ActiveX control, the control may be vulnerable to attack because any Web application on the Internet can repurpose it, that is, use the control for its own ends whether sincere or malicious. But, you can take precautions when you write a control to help avert an attack.
You have a responsibility to users to provide the most secure controls. Do not assume that your control is secure until it has gone through a rigorous security review. This article contains some guidelines you can incorporate into your security review process.
This article contains information about the following topics:
Designing for security is important because an ActiveX control is particularly vulnerable to attack. An application running on any Web site can use the control; all that it needs is the control's class identifier (CLSID). The control may be repurposed, that is, used in ways that you did not intend. The repurposing might be friendly or a malicious attack on the computer running the control. As you design a control, think about what specific measures you should take to protect it.
Before you implement a feature as an ActiveX control, consider whether you can achieve the same functionality through other means. If you do not need access to system resources, you can write the control as a Dynamic HTML (DHTML) behavior.
Because an ActiveX control is a Microsoft Win32? component, there is no sandboxing, that is, it can run without restrictions. You should think about how you can restrict functionality to prevent others from repurposing your control to possibly malicious ends.
You should digitally sign every ActiveX control. Digital signing tells users where the control came from and verifies that the control has not been tampered with since its publication.
Be sure the control doesn't loop infinitely or stop responding when given bad data or arguments. An attacker might tie up a user's computer using your ActiveX control.
It is important for a secure ActiveX control to check all inputs and guard against buffer overrun. If a control receives an input string into a fixed-length buffer without checking its length first, it is possible for a malicious caller to provide a string that is longer than the allocated buffer, overwriting other information in an unintended way. In some cases, these bugs can be exploited to make the control perform unsafe operations it was not designed to do. As the author of an ActiveX control, you need to be vigilant. Never assume that a certain input conforms to certain requirements. Always check the data to avoid these attacks. All inputs should have maximum sizes, and controls should be tested to perform safely, even with inputs that are beyond specifications. See Fix Those Buffer Overruns for more information.
The following questions are designed to help you build a more secure ActiveX control. You can use them as part of your larger security review. Think about how to answer each question and how you might design your control more securely. The security of a control is ultimately a subjective judgment. As a general rule, if you answer yes to any of these questions you should probably not mark the control as safe for scripting or safe for data initialization, or you should implement some type of lock down security, that is, restrict the use of the control to within a specific set of domains.
These are some other general questions that you should consider as you design your control.
In addition, it is a good idea to document the following information about your control for reference.
If you don't take precautions when you develop the control, an ActiveX control has virtually unlimited access to the computer it resides on. It can change registry settings, can manipulate the local file system, and can provide security rights not normally available to an external Web site. An attacker can repurpose an ActiveX control and use it to gain access to the computer.
Marking an ActiveX control as safe for scripting can leave you open to attack. Do not mark a control as safe for scripting unless you absolutely have to. You can use the list of questions in How to Judge Control Security while designing your control to help you decide.
If you decide that your control must be marked as safe for scripting, then you can protect the control by restricting the domains in which the control can be scripted. This is referred to as "locking down your control" and should make it harder for a control to be maliciously repurposed.
You can download and use the SiteLock template. This template includes instructions to help you write a secure control that restricts the domains in which it can be scripted.
本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@evget.com