Skip to main content
QUICK REVIEW

[论文解读] Deriving Semantics-Aware Fuzzers from Web API Schemas

Zac Hatfield-Dodds, Dmitry Dygalo|arXiv (Cornell University)|Dec 20, 2021
Software Testing and Debugging Techniques被引用 4
一句话总结

该论文提出 Schemathesis,一种基于属性的模糊测试工具,通过使用 Hypothesis 测试库,从 OpenAPI 和 GraphQL 模式自动生成语义感知、结构感知的模糊测试器。它在不发生致命错误的情况下处理了 100% 的真实网络服务,发现的唯一缺陷数量比次佳模糊测试器多出 1.4× 至 4.5×,同时支持可定制的输入生成和语义验证。

ABSTRACT

Fuzzing -- whether generating or mutating inputs -- has found many bugs and security vulnerabilities in a wide range of domains. Stateful and highly structured web APIs present significant challenges to traditional fuzzing techniques, as execution feedback is usually limited to a response code instead of code coverage and vulnerabilities of interest include silent information-disclosure in addition to explicit errors. Our tool, Schemathesis, derives structure- and semantics-aware fuzzers from web API schemas in the OpenAPI or GraphQL formats, using property-based testing tools. Derived fuzzers can be incorporated into unit-test suites or run directly, with or without end-user customisation of data generation and semantic checks. We construct the most comprehensive evaluation of web API fuzzers to date, running eight fuzzers against sixteen real-world open source web services. OpenAPI schemas found in the wild have a long tail of rare features and complex structures. Of the tools we evaluated, Schemathesis was the only one to handle more than two-thirds of our target services without a fatal internal error. Schemathesis finds 1.4 times to 4.5 times more unique defects than the respectively second-best fuzzer for each target, and is the only fuzzer to find defects in four targets.

研究动机与目标

  • 开发一种可扩展、可重用的方法,从 Web API 模式生成定制化、语义感知的模糊测试器。
  • 解决传统模糊测试在有状态、结构化 Web API 中的局限性,其反馈仅限于 HTTP 状态码。
  • 通过整合响应一致性、缺失请求头和静默信息泄露等语义检查,提升缺陷检测能力。
  • 使用全面的基准测试套件,在真实环境中评估并比较 Web API 模糊测试器的有效性。
  • 为未来研究提供可重用的开源评估数据集,包含真实网络服务、模式和模糊测试器。

提出的方法

  • 利用 Hypothesis 属性化测试库,基于 OpenAPI 或 GraphQL 模式定义生成结构化、有效的输入。
  • 使用模式定义的类型、约束和格式注解生成语义有效的测试输入和请求序列。
  • 将语义验证检查(如响应体一致性、请求头存在性、状态码正确性)集成到模糊测试工作流中。
  • 通过 ASGI/WSGI 集成支持进程内模糊测试,以实现代码覆盖率反馈和更深层次的代码插桩。
  • 采用 Hypothesis 的缩减和去重技术,最小化并报告唯一、可操作的缺陷。
  • 通过可扩展的测试框架,支持用户对数据生成策略和语义检查进行自定义。
Figure 1. Sorting unique defects by the number of runs detecting them, we see that Schemathesis (black) is less consistent but discovers more than other fuzzers. Defect IDs are consistent between runs but not between fuzzers.
Figure 1. Sorting unique defects by the number of runs detecting them, we see that Schemathesis (black) is less consistent but discovers more than other fuzzers. Defect IDs are consistent between runs but not between fuzzers.

实验结果

研究问题

  • RQ1属性化测试技术能否有效应用于从 Web API 模式派生语义感知模糊测试器?
  • RQ2与传统模糊测试相比,模式感知的模糊测试器在检测生产环境中真实缺陷方面表现如何?
  • RQ3模糊测试器在多大程度上能够处理真实世界 OpenAPI 和 GraphQL 模式中所有多样的特征,包括罕见或复杂的功能?
  • RQ4与纯粹的语法或结构模糊测试相比,语义验证的集成在缺陷检测方面能带来多大程度的提升?
  • RQ5属性化测试工作流对 Web API 模糊测试中缺陷一致性和报告质量有何影响?

主要发现

  • 在评估中,Schemathesis 是唯一一个在不发生致命内部错误的情况下处理全部 16 个真实网络服务的模糊测试器,其在模式鲁棒性方面优于其他工具。
  • 在所有目标中,它发现的唯一缺陷数量比第二佳的模糊测试器多出 1.4× 至 4.5×,且是唯一一个在 16 个服务中的 4 个中发现缺陷的工具。
  • 在大多数情况下,模糊测试器为每个缺陷报告了单一最小化输入,由于 Hypothesis 的缩减和去重能力,报告质量很高。
  • Schemathesis 在缺陷检测方面表现出比最先进工具更高的稳定性,尤其是在长时间运行时。
  • 评估数据集(包含 16 个真实网络服务和 8 个模糊测试器)已开源,可供未来研究使用。
  • 本研究证实,集成语义检查和基于模式的输入生成可显著提升缺陷检测能力,优于语法或黑盒方法。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。