访问控制测试
这个插件使用户能够比较Web应用程序(Web-application)的哪些部分可用于某些用户,进行访问控制测试并识别潜在的访问控制问题。 它允许配置访问规则,并进行全面攻击,目的是帮助识别Web应用程序中可被未经授权的客户端访问的部分。
与这个插件相关的两个主要概念解释如下: 访问规则和测试过程.
访问规则
为了确定潜在的访问控制问题,ZAP需要知道Web应用程序的哪些部分应该由哪个用户访问。 在 ZAP 中,这些规则的名称是: 访问规则,通常具有以下含义: “PageA应该/不应该由UserX访问”。
规则是为上下文配置的,对于该上下文的每个用户,每个站点节点(Web页面)将与下列值之一相关联:
- 允许-该规则所引用的用户可以访问该资源。
- 拒绝-该规则所引用的用户不应该访问该资源
- 未知-对于该规则所引用的用户应该或不应该访问该资源,无明确信息进行说明。
为了简化访问规则的定义过程,ZAP利用了基于树的URL结构。
在分析规则时,如果没有定义特定的规则,推理算法将根据URL中的父节点检测每个节点的匹配规则。 这意味着,在配置访问规则时,只需要为整个子树显式设置一个规则,而对于其它节点规则则可以进行推断得出 有关详细信息,请参阅访问控制上下文选项帮助页面。
测试过程
作为一个整体,为了充分执行Web应用程序的访问控制测试,请您遵循如下所示的步骤:
- 测试人员定义一组用户以及他们如何进行身份验证;
- 测试人员定义ZAP如何识别未经授权的请求(通过会话属性中的授权面板);
- Web应用程序的探索要么手动要么通过Spider;
- 测试人员定义与上下文相关的每个用户的访问规则,让ZAP基本上知道Web应用程序的哪些部分应该被哪些用户访问;
- ZAP通过尝试从每个用户的角度访问Web应用程序的每个URL来执行“攻击”;
- 在相应的“状态”选项卡中,显示结果,显示哪些用户成功访问哪些页面,并标记未遵循访问规则的情况。
Note: Access control testing is not allowed in Safe mode nor Protected if the context is not in scope.
API
The Addon exposes the following API endpoints:
Actions
scan
Starts an Access Control scan with the given context ID and user ID (can be comma separated list of IDs).
(Optional parameters: boolean identifying if an unauthenticated user should be included (default false), boolean
identifying whether or not Alerts are raised (default true), and the Risk level for the Alerts (default High).)
[Note:This assumes the Access Control rules were previously established via ZAP gui and the necessary Context exported/imported.]
writeHTMLreport
Generates an Access Control report for the given context ID and saves it based on the provided filename (path).
Views
getScanProgress
Gets the Access Control scan progress (percentage integer) for the given context ID.
getScanStatus
Gets the Access Control scan status (description string) for the given context ID.
See also