[论文解读] foREST: A Tree-based Approach for Fuzzing RESTful APIs
本文提出 foREST,一种新颖的基于树的模糊测试方法,用于 RESTful API,通过建模端点层次结构来提高依赖关系建模效率。通过从 OpenAPI/Swagger 规范构建 API 树并进行前序遍历,foREST 将依赖复杂度从二次方降低至线性,相较于 EvoMaster 和 RESTler,实现 11.5% 至 82.5% 更高的代码覆盖率,同时在真实服务中发现了 11 个新漏洞。
Representational state transfer (REST) is a widely employed architecture by web applications and cloud. Users can invoke such services according to the specification of their application interfaces, namely RESTful APIs. Existing approaches for fuzzing RESTful APIs are generally based on classic API-dependency graphs. However, such dependencies are inefficient for REST services due to the explosion of dependencies among APIs. In this paper, we propose a novel tree-based approach that can better capture the essential dependencies and largely improve the efficiency of RESTful API fuzzing. In particular, the hierarchical information of the endpoints across multiple APIs enables us to construct an API tree, and the relationships of tree nodes can indicate the priority of resource dependencies, extit{e.g.,} it's more likely that a node depends on its parent node rather than its offspring or siblings. In the evaluation part, we first confirm that such a tree-based approach is more efficient than traditional graph-based approaches. We then apply our tool to fuzz two real-world RESTful services and compare the performance with two state-of-the-art tools, EvoMaster and RESTler. Our results show that foREST can improve the code coverage in all experiments, ranging from 11.5\% to 82.5\%. Besides, our tool finds 11 new bugs previously unknown.
研究动机与目标
- 为解决基于图的依赖关系建模在 REST API 模糊测试中因 API 依赖关系呈指数级增长而导致的低效问题。
- 通过建模 API 端点之间的层次关系,提高生成有效且多样化测试用例的准确性和效率。
- 将依赖关系遍历的复杂度从图模型中的 O(n²) 降低至树模型中的 O(n),实现更快、更具可扩展性的模糊测试。
- 通过树遍历和动态依赖关系评估,提升资源管理与请求序列生成能力。
- 在真实服务上评估该方法,并与最先进工具如 RESTler 和 EvoMaster 进行对比。
提出的方法
- 解析 OpenAPI/Swagger 规范,提取端点 URL,并通过在'/'分隔符处分割 URL 来构建层次树。
- 将每个 URL 段表示为树中的一个节点,边构成从根节点到叶节点的路径,以捕获端点的层次结构。
- 为每个节点分配支持的 HTTP 方法属性,并维护一个缓冲区以存储资源,支持有状态测试。
- 采用基于模板的请求顺序策略:优先进行前序遍历,先执行 GET 请求,随后是多个 POST 请求,再执行 PUT 和 DELETE 请求,以保留后代节点所需的资源。
- 应用动态依赖对评估,优先考虑父节点依赖关系,而非兄弟节点或后代节点,以提高生成请求的有效性。
- 迭代遍历服务中的所有树以处理多个端点层次结构,同时保持与 API 数量成线性时间复杂度。
实验结果
研究问题
- RQ1与传统的基于图的方法相比,基于树的模型是否能降低 API 依赖关系建模的复杂度?
- RQ2建模端点层次结构是否能提高 REST API 模糊测试中测试用例生成的效率和有效性?
- RQ3在代码覆盖率和漏洞检测方面,基于树的方法相较于基于图的方法在多大程度上表现更优?
- RQ4在真实模糊测试场景中,foREST 与最先进工具如 RESTler 和 EvoMaster 相比表现如何?
- RQ5基于树的方法是否能有效处理复杂、多层级的 REST API 架构,同时保持高代码覆盖率?
主要发现
- 基于树的方法显著将依赖复杂度从图模型中的 O(n²) 降低至树模型中的 O(n),提升了遍历效率。
- 在所有实验中,foREST 的代码覆盖率均高于 EvoMaster 和 RESTler,提升幅度在 11.5% 至 82.5% 之间。
- 在对 WordPress 和 GitLab 的模糊测试中,foREST 发现了 11 个此前未知的漏洞,证明了其在真实世界漏洞检测中的有效性。
- 采用优先处理父节点依赖关系的前序遍历策略,提高了生成有效、有状态测试序列的可能性。
- foREST 的原型实现成功处理了多个端点树结构,并在与 API 数量的关系上保持了线性可扩展性。
- 与基于图的方法相比,基于树的模型生成了更准确的依赖关系,减少了无效或冗余的请求路径。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。