# 动态应用安全测试

**动态应用安全测试（DAST）**是一种黑盒安全测试方法，它从外部检查正在运行的应用，像攻击者那样发送精心构造的请求并观察响应，且无需访问源代码。DAST 工具通过 Web 前端与 Web 应用通信，以识别安全漏洞和架构弱点，通过实际执行攻击而非分析代码来检测缺陷。<sup>[1](https://owasp.github.io/DevSecOpsGuideline/2-Process/2-4-Test/2-4-2-Dynamic-Application-Security-Testing/)</sup><sup> • </sup><sup>[2](https://devguide.owasp.org/en/06-verification/02-tools/01-dast/)</sup>

| 关键事实 | 详情 |
|---|---|
| 方法 | 对已部署、正在运行的应用进行黑盒测试；无需源代码或框架知识<sup>[1](https://owasp.github.io/DevSecOpsGuideline/2-Process/2-4-Test/2-4-2-Dynamic-Application-Security-Testing/)</sup> |
| 能发现什么 | 注入缺陷（SQL、命令、XSS）、身份验证与会话弱点、安全配置错误、缺失的响应头（CSP、HSTS）、SSRF、开放重定向，以及暴露的敏感数据<sup>[1](https://owasp.github.io/DevSecOpsGuideline/2-Process/2-4-Test/2-4-2-Dynamic-Application-Security-Testing/)</sup> |
| 发现指向 | URL 和参数，而非文件和行号；误报率低于 SAST，但高于 IAST<sup>[3](https://appsecsanta.com/application-security/sast-vs-dast-vs-iast)</sup> |
| 覆盖范围限制 | 仅限于已爬取的页面；无法覆盖 100% 的源代码或应用本身<sup>[3](https://appsecsanta.com/application-security/sast-vs-dast-vs-iast)</sup><sup> • </sup><sup>[2](https://devguide.owasp.org/en/06-verification/02-tools/01-dast/)</sup> |
| 流水线位置 | 在部署之后针对预发布或测试环境运行；与在构建阶段运行的 SAST 不同，它需要先完成部署步骤<sup>[3](https://appsecsanta.com/application-security/sast-vs-dast-vs-iast)</sup> |
| 参考工具 | ZAP（原 OWASP ZAP，现为“ZAP by Checkmarx”），一款开源 DAST 工具，提供面向 GitHub Actions、Jenkins 和 GitLab CI 的 CI/CD 集成<sup>[1](https://owasp.github.io/DevSecOpsGuideline/2-Process/2-4-Test/2-4-2-Dynamic-Application-Security-Testing/)</sup> |
| 基准测试 | OWASP Benchmark 项目试图科学衡量漏洞检测工具（包括 DAST）的有效性<sup>[2](https://devguide.owasp.org/en/06-verification/02-tools/01-dast/)</sup> |

## 工作原理

DAST 工具会爬取应用以绘制其攻击面，然后对发现的内容发起攻击。美国国家标准与技术研究院（NIST）对 Web 应用扫描器的定义是：一种自动化程序，通过爬取其网页来探索应用并执行渗透测试，即通过生成恶意输入并评估应用响应来模拟攻击的主动分析。<sup>[4](https://tsapps.nist.gov/publication/get_pdf.cfm?pub_id=50874)</sup> 由于工具是在应用已部署、已集成的状态下对其进行检验，因此能够发现仅在软件运行时才显现的缺陷——配置错误、身份验证和会话处理中的弱点，以及组件协同工作方式引发的问题。<sup>[1](https://owasp.github.io/DevSecOpsGuideline/2-Process/2-4-Test/2-4-2-Dynamic-Application-Security-Testing/)</sup>

现代爬虫面临相当大的工程挑战。例如，Burp Scanner 会构建应用位置的有向图，按内容而非 URL 识别位置，从而能够处理 CSRF 令牌等临时参数；检测应用状态变化，使同一链接在不同状态下到达时能正确解析；并使用内嵌的 [Chromium](https://www.edgepedia.org/zh/chromium-web-browser) 浏览器爬取大量使用 JavaScript 的单页应用。<sup>[5](https://portswigger.net/burp/documentation/scanner/crawling)</sup>

## DAST 能发现什么

OWASP DevSecOps 指南列出了 DAST 擅长检测的漏洞类别：<sup>[1](https://owasp.github.io/DevSecOpsGuideline/2-Process/2-4-Test/2-4-2-Dynamic-Application-Security-Testing/)</sup>

- 响应中可观察到的注入缺陷（SQL、命令、XSS）
- 身份验证、会话管理和访问控制弱点
- 安全配置错误和缺失的安全响应头（CSP、HSTS、X-Frame-Options、Permissions-Policy）
- 暴露的敏感数据，以及泄露堆栈跟踪或内部路径的详细错误处理
- 服务器端问题，如 SSRF、开放重定向、路径遍历和不安全反序列化迹象
- 多步骤工作流中的业务逻辑缺陷（当扫描由测试脚本引导时）

OWASP 开发者指南补充说，有些缺陷会完全绕过自动化工具：业务逻辑错误、竞态条件检查以及某些零日漏洞通常需要人工评估。<sup>[2](https://devguide.owasp.org/en/06-verification/02-tools/01-dast/)</sup> OWASP Web 安全测试指南总体上表达了同样的观点：自动化工具擅长依据特征发现已知漏洞，但不理解业务逻辑或上下文。<sup>[6](https://wstg.owasp.org/latest/2-Introduction/)</sup>

## 优势与局限

**优势。** DAST 与语言无关，因为它测试行为而非代码，能发现运行时和配置问题，对已确认发现产生较低误报，并反映真实攻击者的视角。它适用于源代码不可用的第三方应用和编译型应用。<sup>[1](https://owasp.github.io/DevSecOpsGuideline/2-Process/2-4-Test/2-4-2-Dynamic-Application-Security-Testing/)</sup> 一个实际优势是，它回答了与静态分析不同的问题：不是是否存在不安全代码，而是漏洞是否真的能通过应用暴露的接口被触发。<sup>[7](https://www.techslang.com/sast-vs-dast-vs-iast-whats-the-difference/)</sup>

**局限。** DAST 在开发周期中运行较晚，因为它需要已部署的应用，无法精确定位源代码中确切的有漏洞行，可能漏掉扫描从未到达的代码路径中的缺陷，并且对于需要身份验证的流程或有状态的流程，需要显式配置。扫描速度与覆盖范围之间始终需要权衡。<sup>[1](https://owasp.github.io/DevSecOpsGuideline/2-Process/2-4-Test/2-4-2-Dynamic-Application-Security-Testing/)</sup> 覆盖范围受爬虫发现内容的限制，因此测试人员应检查 Web 应用或其攻击面的覆盖情况，以了解工具是否配置正确。<sup>[2](https://devguide.owasp.org/en/06-verification/02-tools/01-dast/)</sup>

## 与 SAST 和 IAST 的比较

三大自动化测试类别从不同视角分析同一个应用，发现的缺陷群体在很大程度上并不重叠。<sup>[8](https://www.graphnodesoftware.com/guides/dast-explained)</sup> SAST 读取从未运行的源代码，并指向文件和行号；DAST 证明从外部可利用什么；IAST（交互式应用安全测试）在测试期间于应用内部运行代理，报告发现时同时给出代码位置和运行时确认，因而在三者中误报率最低。<sup>[3](https://appsecsanta.com/application-security/sast-vs-dast-vs-iast)</sup> DAST 只需一个 URL 即可运行扫描，无需任何代理或修改代码，而 IAST 则要求在每一个应用中安装与语言绑定的代理。<sup>[9](https://appsecsanta.com/application-security/iast-vs-dast)</sup>

[经验证据](https://www.edgepedia.org/zh/empirical-evidence)支持将多种技术结合使用。2022 年，莎拉·埃尔德（Sarah Elder）、劳里·威廉姆斯（Laurie Williams）及[北卡罗来纳州立大学](https://www.edgepedia.org/zh/north-carolina-state-university)（North Carolina State University）的同事开展了一项研究，将系统性人工渗透测试、探索性人工渗透测试、DAST 和 SAST 应用于一个开源病历系统。SAST 发现的漏洞最多，探索性人工测试发现的漏洞更严重，每种技术都发现了其他技术遗漏的独特漏洞；人工技术在每小时发现漏洞数上的效率与自动化技术相当或更高。<sup>[10](https://arxiv.org/abs/2208.01595)</sup> 另一项针对大型 Java 系统的研究发现，IAST 检测出 OWASP Top 10 风险中的八项，而 DAST 和 SAST 各检测出七项。<sup>[11](https://arxiv.org/abs/2312.17726)</sup> OWASP 测试指南的结论是，没有任何单一方法足够，必须在开发生命周期的不同阶段使用不同工具。<sup>[4](https://tsapps.nist.gov/publication/get_pdf.cfm?pub_id=50874)</sup>

## 在实践中运行 DAST

**身份验证扫描**是影响最大的单项配置：从不进行身份验证的扫描只测试公开可访问的部分，而这部分可能仅占实际攻击面的约 10%。扫描器接受凭据、会话 Cookie 或 OAuth 令牌；对于复杂登录，ZAP 等工具通过其自动化框架在带版本控制的 YAML 计划中定义上下文、身份验证方法、用户和扫描作业。<sup>[1](https://owasp.github.io/DevSecOpsGuideline/2-Process/2-4-Test/2-4-2-Dynamic-Application-Security-Testing/)</sup> 商业工具已将这一能力扩展到现代身份验证：Burp Suite DAST 的 2026.3 版本新增支持扫描受 WebAuthn 通行密钥、生物识别和 TOTP 多因素身份验证保护的应用程序，并可在录制的登录序列中使用这些认证方式。<sup>[12](https://portswigger.net/burp/releases/dast-2026-3)</sup>

借助 API 感知测试，可将 OpenAPI 3.x、Swagger 或 GraphQL 内省模式提供给扫描器，使其自动理解现代 API 表面，而不必依赖爬取。<sup>[1](https://owasp.github.io/DevSecOpsGuideline/2-Process/2-4-Test/2-4-2-Dynamic-Application-Security-Testing/)</sup>

**CI/CD 集成**会在每个候选发布版本上针对临时测试或预发布环境运行 DAST，并抑制基线发现，使每次构建只暴露新问题。应调整范围和速率：将范围限制在受测应用路径内，避免在共享环境中执行诸如可删除表的 SQL 注入等破坏性测试，并遵守速率限制，以免扫描对自身的预发布环境造成拒绝服务。被动模式（爬取并观察）在共享环境中是安全的；带攻击载荷的主动模式应隔离运行。<sup>[1](https://owasp.github.io/DevSecOpsGuideline/2-Process/2-4-Test/2-4-2-Dynamic-Application-Security-Testing/)</sup> 有用的指标包括每个发布版本新增的高危或严重发现、扫描覆盖的页面和端点范围、发现问题的平均修复时间，以及误报率。<sup>[1](https://owasp.github.io/DevSecOpsGuideline/2-Process/2-4-Test/2-4-2-Dynamic-Application-Security-Testing/)</sup>

在敏捷环境中采用 DAST 会遇到阻力。一项行动研究案例研究记录了一家软件组织将 DAST 集成到看板工作流和 CI/CD 流水线中的挑战、缓解技术和开发者视角下的最佳实践；该研究已被 FSE 2026 的工业界轨道接收，反映了敏捷交付的迭代性与安全工程的顺序性之间的冲突。<sup>[13](https://arxiv.org/abs/2503.21947)</sup>

## 工具

开源选项包括 ZAP，一款功能完整的 Web 应用扫描器和拦截代理；Nikto，一款快速 Web 服务器扫描器，用于检测已知漏洞和配置错误；Nuclei，一款基于模板的扫描器，适合定向检查和针对 CVE 的验证；以及 Wapiti，一款面向脚本化环境的轻量级黑盒扫描器。<sup>[1](https://owasp.github.io/DevSecOpsGuideline/2-Process/2-4-Test/2-4-2-Dynamic-Application-Security-Testing/)</sup> 商业产品包括 PortSwigger 的 Burp Suite DAST、面向 API 优先应用的 Escape、通过基于证据的扫描确认可利用性以降低误报的 Invicti、Rapid7 InsightAppSec，以及为 CI/CD 中开发者自主扫描而构建的 StackHawk。<sup>[1](https://owasp.github.io/DevSecOpsGuideline/2-Process/2-4-Test/2-4-2-Dynamic-Application-Security-Testing/)</sup> OWASP Benchmark 项目维护面向 DAST 工具的评分卡生成器，包括 Arachni、Burp Suite Community Edition、HCL AppScan Standard、Micro Focus Fortify WebInspect、Netsparker、Qualys Web App Scanner 和 Rapid7 AppSpider。<sup>[14](https://owasp.github.io/www-project-benchmark/)</sup>

## 历史

Web 应用 DAST 的正式化方法、培训、团体和最佳实践形成于 2002 年至 2008 年之间；在 2010 年代中期网络安全学习平台开始成熟之前，静态出版的指南和社区知识一直是学习标准。<sup>[15](https://www.researchgate.net/publication/391327532_Historical_Evolution_of_Security_Testing_for_Web_Applications)</sup> 在标准领域，NIST 的《信息安全测试与评估技术指南》（*Technical Guide to Information Security Testing and Assessment*，SP 800-115）于 2008 年 9 月发布，取代 SP 800-42，为规划和执行技术安全测试提供建议，包括每种技术的优点和局限。<sup>[16](https://csrc.nist.gov/pubs/sp/800/115/final)</sup> NIST 后来根据第 14028 号行政令制定的开发者软件验证最低标准，在适用情况下将 Web 应用扫描器列为推荐技术之一。<sup>[17](https://arxiv.org/abs/2107.12850)</sup>

## References

1. [Dynamic Application Security Testing (DAST), OWASP DevSecOps Guideline](https://owasp.github.io/DevSecOpsGuideline/2-Process/2-4-Test/2-4-2-Dynamic-Application-Security-Testing/)
2. [DAST tools, OWASP Developer Guide](https://devguide.owasp.org/en/06-verification/02-tools/01-dast/)
3. [SAST vs DAST vs IAST: Differences & When to Use, AppSecSanta](https://appsecsanta.com/application-security/sast-vs-dast-vs-iast)
4. [Web Application Scanners: Definitions and Functions, NIST SAMATE (HICSS 2007)](https://tsapps.nist.gov/publication/get_pdf.cfm?pub_id=50874)
5. [Crawling, PortSwigger Burp Suite documentation](https://portswigger.net/burp/documentation/scanner/crawling)
6. [WSTG Introduction, OWASP Web Security Testing Guide](https://wstg.owasp.org/latest/2-Introduction/)
7. [SAST vs. DAST vs. IAST: What's the Difference?, Techslang](https://www.techslang.com/sast-vs-dast-vs-iast-whats-the-difference/)
8. [DAST Explained: Dynamic Application Security Testing, GraphNode Software](https://www.graphnodesoftware.com/guides/dast-explained)
9. [IAST vs DAST: Interactive vs Dynamic Testing, AppSecSanta](https://appsecsanta.com/application-security/iast-vs-dast)
10. [Elder, S. et al. (2022). Do I really need all this work to find vulnerabilities? arXiv:2208.01595](https://arxiv.org/abs/2208.01595)
11. [Comparing Effectiveness and Efficiency of IAST and RASP Tools in a Large Java-based System, arXiv:2312.17726](https://arxiv.org/abs/2312.17726)
12. [DAST 2026.3 release notes, PortSwigger](https://portswigger.net/burp/releases/dast-2026-3)
13. [Thool, A. and Brown, C. Integrating DAST in Kanban and CI/CD: A Real World Security Case Study, arXiv:2503.21947](https://arxiv.org/abs/2503.21947)
14. [OWASP Benchmark Project](https://owasp.github.io/www-project-benchmark/)
15. [Francis, M. Historical Evolution of Security Testing for Web Applications, International Journal of Computer Applications 186](https://www.researchgate.net/publication/391327532_Historical_Evolution_of_Security_Testing_for_Web_Applications)
16. [NIST SP 800-115, Technical Guide to Information Security Testing and Assessment (September 2008)](https://csrc.nist.gov/pubs/sp/800/115/final)
17. [Guidelines on Minimum Standards for Developer Verification of Software, arXiv:2107.12850](https://arxiv.org/abs/2107.12850)

---
*Initially written Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 软件与编程 › Software engineering and development process › Software testing and quality › Security testing and supply chain assurance

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/dynamic-application-security-testing

English original: https://www.edgepedia.org/dynamic-application-security-testing
