> For the complete documentation index, see [llms.txt](https://dizzzzy.gitbook.io/notebook/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dizzzzy.gitbook.io/notebook/fuzz/fuzzing-for-software-vulnerability-discovery.md).

# Fuzzing for software vulnerability discovery

原书作者：Toby Clark

Technical ReportRHUL-MA-2009-04 17 February 2009

根据软件开发阶段可分三个核心漏洞类

* 设计漏洞：当安全需求没有正确地收集或转换成规范，或者没有正确地识别威胁时，可能会出现设计漏洞
  * Perhaps the most significant source of vulnerabilities from the design phase occur because: “Design specifications miss important security details that occur only in code.”
* 实施漏洞**Implementation Vulnerabilities**
  * “These problems can happen if the implementation deviates from the design to solve technical discrepancies. Mostly, however, exploitable situations are caused by technical artefacts and nuances of the platform and language environment in which the software is constructed.”
  * **重点关注对象**
* 操作漏洞：由于软件部署到特定环境而产生的漏洞

Attack Surface Analysis (ASA) & Attack Surface Reduction (ASR)（攻击面分析（ASA）和攻击面减少（ASR））是安全开发生命周期的重要环节

许多漏洞是不可利用的漏洞，我们关注的是**可利用的漏洞**，**可达性**是一个关键区分因素。源于可达性的重要性的两个关键点是：

* Fuzzing：与其他漏洞发现方法不同，Fuzzing通常只会触发可到达的缺陷，因为它是基于向目标应用程序输入变异得到的畸形输入来触发crash。
* 无法通过输入访问的软件漏洞实际上不可利用的

也由此可见软件安全的一个核心——输入验证 *input validation*

* 书中有趣的例子

> 一家餐厅，一个顾客点了一顿饭，然后递给服务员一张给厨师的纸条。该纸条包含恶意指令。服务员把订单和纸条交给厨师，厨师立即放火烧了厨房。服务员从经验中吸取教训，拒绝再给厨师写笔记。他的方法是不接受任何笔记。第二天，一位顾客点了一个俱乐部三明治，并递给服务员一封密封的厨师信。这封信没有纸条的特点，所以服务员把它递给厨师。厨师又放火烧了厨房。服务员更新了他的方法：没有笔记，也没有信件。第二天，一位顾客说他有一封给厨师的电报，服务员把它拿去给了厨师。厨师说：“我已经厌倦了。从现在开始，客户只能从菜单中选择项目。如果它不在菜单上，就不要带给我。”
>
> &#x20;1.服务员**无法区分数据**（即“每日汤”）**和指令**（“点燃厨房”）。
>
> &#x20;2.厨师完全信任服务员，并会执行服务员传递给他的任何指示

“*From a certain perspective, \[buffer overruns, SQL injection, command injection] are all the same bug. Data in grammar A is interpreted in grammar B, e.g. a username becomes SQL, some string data becomes stack or heap. \[...] Much of what we do relies on our understanding of these underlying grammars and subsequent ability to create valid phrases in B that work in A.”*
