<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>moyaoxueの小屋</title>
        <link>https://moyaoxue.de/</link>
        <description>moyaoxueの小屋</description>
        <lastBuildDate>Sun, 12 Oct 2025 02:29:49 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <language>zh-CN</language>
        <copyright>All rights reserved 2025, moyaoxue</copyright>
        <item>
            <title><![CDATA[间接跳转混淆去除]]></title>
            <link>https://moyaoxue.de/article/26d25ac9-6ea8-80ee-9ec5-d1a210b5f432</link>
            <guid>https://moyaoxue.de/article/26d25ac9-6ea8-80ee-9ec5-d1a210b5f432</guid>
            <pubDate>Sat, 13 Sep 2025 00:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-26d25ac96ea880ee9ec5d1a210b5f432"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-26d25ac96ea880e080aaf521398b0ed9" data-id="26d25ac96ea880e080aaf521398b0ed9"><span><div id="26d25ac96ea880e080aaf521398b0ed9" class="notion-header-anchor"></div><a class="notion-hash-link" href="#26d25ac96ea880e080aaf521398b0ed9" title="原理"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">原理</span></span></h3><div class="notion-text notion-block-26d25ac96ea880cca716f10996e5917d">找了个demo练手
大概结构有：
① 调用函数混淆</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-26d25ac96ea880f48032e67f6d68f8b4"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:634.9553833007812px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A542f1551-4642-405b-b3f3-b52163c13408%3Aimage.png?table=block&amp;id=26d25ac9-6ea8-80f4-8032-e67f6d68f8b4&amp;t=26d25ac9-6ea8-80f4-8032-e67f6d68f8b4" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-26d25ac96ea880e29659d0c2047b953b">② 检查zf位，实现jz jnz的条件跳转</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-26d25ac96ea880b1a60bebf233d55e8e"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:636.949462890625px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3Ae851d54b-68f9-4db8-bfe1-2b2f5576acbc%3Aimage.png?table=block&amp;id=26d25ac9-6ea8-80b1-a60b-ebf233d55e8e&amp;t=26d25ac9-6ea8-80b1-a60b-ebf233d55e8e" alt="notion image" loading="lazy" decoding="async"/></div></figure><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-26d25ac96ea880dcbf2cec3c64cea4cd" data-id="26d25ac96ea880dcbf2cec3c64cea4cd"><span><div id="26d25ac96ea880dcbf2cec3c64cea4cd" class="notion-header-anchor"></div><a class="notion-hash-link" href="#26d25ac96ea880dcbf2cec3c64cea4cd" title="过程"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">过程</span></span></h3><div class="notion-text notion-block-26d25ac96ea88043b4f5de2facef52ca">（包括一些失败的心路历程，很久没写了，可以直接跳过看代码）</div><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-26d25ac96ea88066ae8acfb7a2a0f7fc" data-id="26d25ac96ea88066ae8acfb7a2a0f7fc"><span><div id="26d25ac96ea88066ae8acfb7a2a0f7fc" class="notion-header-anchor"></div><a class="notion-hash-link" href="#26d25ac96ea88066ae8acfb7a2a0f7fc" title="打印"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">打印</span></span></h4><div class="notion-text notion-block-26d25ac96ea880d2bb3ef12039207723">第一步，是先匹配并把这些值计算出来。</div><div class="notion-text notion-block-26d25ac96ea88086a76ac3f2693b8130">找了若干个跳转的混淆，发现有两个非常固定的特征：间接跳转使用的寄存器都是rax，这个特点就很方便我们匹配，还有一个无关紧要的，这里都是用rax + rcx来寻址</div><div class="notion-text notion-block-26d25ac96ea880aa9c78fba5c34fd96a">那么，第一思路其实很简单，利用angr模拟执行，执行到call rax的位置，这时候rax的值是收敛的，可以直接拿到；在jmp rax的地址，rax应该是有两解的符号表示，分开记录为jz jnz就行。</div><div class="notion-text notion-block-26d25ac96ea8801bb6adc50bfdc6c7be">于是直接开始模拟，还不错，直接就算出来了</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-26d25ac96ea8802996cfc77efe4a2580"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:653.9732666015625px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A31a6088c-02e0-40ec-a20c-1399cfe7ff6f%3Aimage.png?table=block&amp;id=26d25ac9-6ea8-8029-96cf-c77efe4a2580&amp;t=26d25ac9-6ea8-8029-96cf-c77efe4a2580" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-26d25ac96ea880c1ba07e10d389e7b05">然后就开始遇到模拟执行最常见的问题：陷入系统函数：
</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-26d25ac96ea8801985e7d3cf7cc28810"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A00bf9249-6728-49fd-8cf9-d44070c3b521%3Aimage.png?table=block&amp;id=26d25ac9-6ea8-8019-85e7-d3cf7cc28810&amp;t=26d25ac9-6ea8-8019-85e7-d3cf7cc28810" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-26d25ac96ea8806391aedafda6375afa">
只有个jmp，不能直接跳下条指令，那模拟一下退栈给他弹出来</div><div class="notion-text notion-block-26d25ac96ea880c1a419c2239e284b59">跳过了也不对，掉read里面了，考虑到这是间接跳转，函数边界不好确定，连直接hook跳外层read都不好搞</div><div class="notion-text notion-block-26d25ac96ea8808c84b8fcb1dbc1eb38">那第一反应也不对了，没办法很漂亮的一口气把main里面全去干净，先退而求其次，把call的地址拿到就不进去了，继续执行。</div><div class="notion-text notion-block-26d25ac96ea880f5a825f67ee638e001">于是call这部分算解决了，然后jmp，首先jmp存在两种情况，但无非根据rax为0/1来判别，这里的想法是手动加判别：</div><div class="notion-text notion-block-26d25ac96ea88005949ed7e44ac094e8">然后jmp就会有相应的两条路径了，加了个小剪枝防止路径爆炸，得到结果</div><div class="notion-blank notion-block-26d25ac96ea88031947ff2de368f77e2"> </div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-26d25ac96ea880f09443f5eead586732"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A6895650b-40ec-4536-9cbe-957fdf1c2808%3Aimage.png?table=block&amp;id=26d25ac9-6ea8-80f0-9443-f5eead586732&amp;t=26d25ac9-6ea8-80f0-9443-f5eead586732" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-blank notion-block-26d25ac96ea8807fa834c43357c95197"> </div><div class="notion-text notion-block-26d25ac96ea8806d8494ea8e766c142f">
下一步就是把这些东西patch回去</div><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-26d25ac96ea880d0ad22f240fce7a920" data-id="26d25ac96ea880d0ad22f240fce7a920"><span><div id="26d25ac96ea880d0ad22f240fce7a920" class="notion-header-anchor"></div><a class="notion-hash-link" href="#26d25ac96ea880d0ad22f240fce7a920" title="还原"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">还原</span></span></h4><div class="notion-text notion-block-26d25ac96ea88050abcfcfccbf9248f3">第二步，将计算出来的值重新写入源文件</div><div class="notion-text notion-block-26d25ac96ea880f5b632c23db7821e8e">当然，针对这个附件而言，直接做模式匹配是比较容易的，但是这样感觉是很没意思</div><div class="notion-text notion-block-26d25ac96ea880c0a6a1e51b657b07ad">这里得想想方案，call前面很有可能有函数参数，rcx在最后一次参与rax的计算后也有可能再走一个值，那合理的想法就是从这些地址倒推回去，找到rax最后一次改变的地址，再往上找到用于生成这个值的点，将这几个修改值的位置拿出来，做写入</div><div class="notion-text notion-block-26d25ac96ea8803ebee5de5c0a6cc566">查了一下，这个思路比较接近我想要的效果：Liveness Analysis
参考了这个人的方法：感觉实现上没有用到高级的东西，但整体效果挺好的，可惜存在不足之处，下面这段先看看他的做法：
<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://gal2xy.github.io/2024/07/07/LLVM%20and%20OLLVM/%E5%8E%BB%E9%99%A4%E5%8F%8D%E6%B7%B7%E6%B7%86%E5%90%8E%E7%A8%8B%E5%BA%8F%E4%B8%AD%E7%9A%84%E5%86%97%E4%BD%99%E6%B1%87%E7%BC%96%E4%BB%A3%E7%A0%81/">去除反混淆后程序中的冗余汇编代码 - gla2xy&#x27;s blog</a></div><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-26d25ac96ea88047b261fe015a4e712e" data-id="26d25ac96ea88047b261fe015a4e712e"><span><div id="26d25ac96ea88047b261fe015a4e712e" class="notion-header-anchor"></div><a class="notion-hash-link" href="#26d25ac96ea88047b261fe015a4e712e" title="Liveness Analysiss"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Liveness Analysiss</span></span></h4><div class="notion-text notion-block-26d25ac96ea88093a725cfeaf2c301c4">Liveness Analysis是一种数据流分析技术，用于确定程序中每个变量在程序的不同点上是否”活跃“。”活跃“意为该变量在这之前没有被重新定义且在这之后将被使用。</div><ul class="notion-list notion-list-disc notion-block-26d25ac96ea880da88ace2decb0c2a9c"><li><code class="notion-inline-code">def</code>集合：当前汇编指令显式和隐式改变的寄存器、内存的集合。</li></ul><ul class="notion-list notion-list-disc notion-block-26d25ac96ea88033a5cfe6cc6aa59977"><li><code class="notion-inline-code">use</code>集合：当前汇编指令显式和隐式使用的寄存器、内存的集合。</li></ul><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-26d25ac96ea880549f86f4a422349cd1"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A63e5fa67-4e5e-4957-9684-f87132bf30ee%3Aimage.png?table=block&amp;id=26d25ac9-6ea8-8054-9f86-f4a422349cd1&amp;t=26d25ac9-6ea8-8054-9f86-f4a422349cd1" alt="notion image" loading="lazy" decoding="async"/></div></figure><ul class="notion-list notion-list-disc notion-block-26d25ac96ea8801086ddd417664073f8"><li>这份代码全用的正则匹配，光是表就用了两三百行，主要就是想依此将复杂的汇编结构先分析为def和use集，而优点在于，它将rflags等寄存器加入考虑范围内，更好解决了一些分支跳转的问题
分析示例：</li></ul><div class="notion-text notion-block-26d25ac96ea8804c8370dacfd92fecea">跟踪策略是：</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-26d25ac96ea880da9fbcc434e132de2e"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3Aedb20e70-5209-44f2-86e6-b9aba086401f%3Aimage.png?table=block&amp;id=26d25ac9-6ea8-80da-9fbc-c434e132de2e&amp;t=26d25ac9-6ea8-80da-9fbc-c434e132de2e" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-26d25ac96ea88068b789ed1957bc454c">可以拿到：</div><div class="notion-text notion-block-26d25ac96ea88011addecaf16d2003f4">操作数解析策略：</div><ul class="notion-list notion-list-disc notion-block-26d25ac96ea880aabe03ccb8a6ba322f"><li>寄存器类型直接放入def和use集中</li></ul><ul class="notion-list notion-list-disc notion-block-26d25ac96ea880dcadbbcb7510da9d6b"><li>内存需要直接放入def和use集中，其表达式中的寄存器也要放入def和use集合中</li></ul><ul class="notion-list notion-list-disc notion-block-26d25ac96ea880e0a98ed31e8d9c1831"><li>立即数不应当放入def和use集合中，应认为是某一寄存器跟踪结束的标志</li></ul><div class="notion-text notion-block-26d25ac96ea8804fbca9d08f2fc71be7">[-] 这里的算法需要，对cmov特判了一下，针对其执行和不执行两种结果分别向上扫一轮</div><div class="notion-text notion-block-26d25ac96ea880a4bf62fed3c310f879">最终算法：</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-26d25ac96ea88044a1f0dc79d8e3a9eb"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A97a7ca6b-96d5-490a-bcb3-761f1f4755f7%3Aimage.png?table=block&amp;id=26d25ac9-6ea8-8044-a1f0-dc79d8e3a9eb&amp;t=26d25ac9-6ea8-8044-a1f0-dc79d8e3a9eb" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-26d25ac96ea88025b787ffeee1547513">源代码是直接匹配的，这里借助ai搞了个现代一点的版本：
加入了feature:</div><ul class="notion-list notion-list-disc notion-block-26d25ac96ea880a18367d1d04add4884"><li>用ida的函数边界识别，更加准确</li></ul><ul class="notion-list notion-list-disc notion-block-26d25ac96ea88057ae65e8d98b647dc3"><li>支持输入特定汇编，用该汇编作为上边界（call rax这类必须进去）</li></ul><ul class="notion-list notion-list-disc notion-block-26d25ac96ea88053a284d8fba0e39e42"><li>主要对sp bp 和cmov做了特判，对是否执行了该mov递归两次取交集</li></ul><div class="notion-text notion-block-26d25ac96ea880a58989fc3c9daa99a1">效果：</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-26d25ac96ea88075885fc304c559c227"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A5726f931-83a1-4cb6-9b49-1801959e9966%3Aimage.png?table=block&amp;id=26d25ac9-6ea8-8075-885f-c304c559c227&amp;t=26d25ac9-6ea8-8075-885f-c304c559c227" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-26d25ac96ea88088b4e4cf3bf24997e6">注意，这里有</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-26d25ac96ea8808baa8ce73ab6152741"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3Acf856c05-656c-49b8-a263-2c40b5e3fcd0%3Aimage.png?table=block&amp;id=26d25ac9-6ea8-808b-aa8c-e73ab6152741&amp;t=26d25ac9-6ea8-808b-aa8c-e73ab6152741" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-26d25ac96ea8800eb207fe97153dc0c2">代码：</div><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-26d25ac96ea880d082dacfc5b7544e57" data-id="26d25ac96ea880d082dacfc5b7544e57"><span><div id="26d25ac96ea880d082dacfc5b7544e57" class="notion-header-anchor"></div><a class="notion-hash-link" href="#26d25ac96ea880d082dacfc5b7544e57" title="合成"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">合成</span></span></h4><div class="notion-text notion-block-26d25ac96ea880ebb9b1d84515a49907">那么，现在混淆定位完成了，patch的方案也出来了，就该把代码合一下了，还没弄特别方便，要手动运行两个代码</div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[brunnerCTF]]></title>
            <link>https://moyaoxue.de/article/25925ac9-6ea8-8063-8c33-e7ce9cd0eda7</link>
            <guid>https://moyaoxue.de/article/25925ac9-6ea8-8063-8c33-e7ce9cd0eda7</guid>
            <pubDate>Sun, 24 Aug 2025 00:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-25925ac96ea880638c33e7ce9cd0eda7"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><div class="notion-text notion-block-25925ac96ea880018796d27c87d895e6">很久没一次打久一点比赛，近期做一个小的复建， 赛中7/9，最难俩都没出，赛后做做</div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-25925ac96ea88073b370e697ca7036c7" data-id="25925ac96ea88073b370e697ca7036c7"><span><div id="25925ac96ea88073b370e697ca7036c7" class="notion-header-anchor"></div><a class="notion-hash-link" href="#25925ac96ea88073b370e697ca7036c7" title="TrippiTroppaChaos"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">TrippiTroppaChaos</span></span></h4><div class="notion-text notion-block-25925ac96ea880068708f602697f9ed9">python代码，现在这种贴近源码的逆向都是ai一把梭了</div><div class="notion-blank notion-block-25925ac96ea880648904ffe2d26e9d5a"> </div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-25925ac96ea880e5bb26d38002d955a6" data-id="25925ac96ea880e5bb26d38002d955a6"><span><div id="25925ac96ea880e5bb26d38002d955a6" class="notion-header-anchor"></div><a class="notion-hash-link" href="#25925ac96ea880e5bb26d38002d955a6" title="Grandma’s Predictable Cookies"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Grandma’s Predictable Cookies</span></span></h4><div class="notion-text notion-block-25925ac96ea88070ae80d32e481cb780">爆破一下时间戳</div><div class="notion-blank notion-block-25925ac96ea8802cac10d468b6f7a041"> </div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-25925ac96ea880ceb591cd96290f0f6a" data-id="25925ac96ea880ceb591cd96290f0f6a"><span><div id="25925ac96ea880ceb591cd96290f0f6a" class="notion-header-anchor"></div><a class="notion-hash-link" href="#25925ac96ea880ceb591cd96290f0f6a" title="Bakeware"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Bakeware</span></span></h4><div class="notion-text notion-block-25925ac96ea88066bf51d66a319ae330">动调拿key然后解aes就行</div><div class="notion-blank notion-block-25925ac96ea880b38c85f11571b3032b"> </div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-25925ac96ea880f3a771cbfa51c41699" data-id="25925ac96ea880f3a771cbfa51c41699"><span><div id="25925ac96ea880f3a771cbfa51c41699" class="notion-header-anchor"></div><a class="notion-hash-link" href="#25925ac96ea880f3a771cbfa51c41699" title="Un-Pirateable Baking Game"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Un-Pirateable Baking Game</span></span></h4><div class="notion-text notion-block-25925ac96ea8804eb3f9ca1869b3583d">GameMaker逆向，data.bin进UndertaleModTool就是源码了</div><div class="notion-blank notion-block-25925ac96ea880e4ae31d8d6ccaa9188"> </div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-25925ac96ea88079b7c5caea03447570" data-id="25925ac96ea88079b7c5caea03447570"><span><div id="25925ac96ea88079b7c5caea03447570" class="notion-header-anchor"></div><a class="notion-hash-link" href="#25925ac96ea88079b7c5caea03447570" title="bake and forth"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">bake and forth</span></span></h4><div class="notion-text notion-block-25925ac96ea880718795c29fa9ee30b0">唯一一个一血，还挺好玩的smc，main里面11+5共计16个字节会被反复修改，如下框内分两次异或8字节修改main，main前11个字节为有效字节，后5个字节是对下一步smc的寻址</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-25925ac96ea8802bbfa9ecb9f25d6c9c"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A90bc29b3-056b-4365-8ba9-75ccd062b88e%3Aimage.png?table=block&amp;id=25925ac9-6ea8-802b-bfa9-ecb9f25d6c9c&amp;t=25925ac9-6ea8-802b-bfa9-ecb9f25d6c9c" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-25925ac96ea8804c8efce7970f7ab83d">赛中正则匹配写的，后面加难版这个题用的unicorn，hook main函数开头然后记录所有前11字节就行（<s>这题不知道为什么，gdb和ida都会识别出错，调试是会运行炸的，手动算或者unicorn反而准，</s>破案了，打的断点会被改，改成乱七八糟的bytes就炸了）</div><div class="notion-blank notion-block-25925ac96ea880fa95a5f823c8b98fb6"> </div><div class="notion-blank notion-block-25925ac96ea880c7a40ac9a1d31d91dc"> </div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-25925ac96ea8803799f9f1d6e70681ac" data-id="25925ac96ea8803799f9f1d6e70681ac"><span><div id="25925ac96ea8803799f9f1d6e70681ac" class="notion-header-anchor"></div><a class="notion-hash-link" href="#25925ac96ea8803799f9f1d6e70681ac" title="timming is everything"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">timming is everything</span></span></h4><div class="notion-text notion-block-25925ac96ea8802a964af315f5cd7d5d">好像遇到过几次了这种套娃，匹配一下模式然后递归反编译就行</div><div class="notion-blank notion-block-25925ac96ea8800d9a21fe7255518ff0"> </div><div class="notion-text notion-block-25925ac96ea880359789edb5739dd87a">exp</div><div class="notion-blank notion-block-25925ac96ea88002a148d796092fc286"> </div><div class="notion-blank notion-block-25925ac96ea880d6be2bd8aa8fe4ea21"> </div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-25925ac96ea880aea987f79ef627a2d1" data-id="25925ac96ea880aea987f79ef627a2d1"><span><div id="25925ac96ea880aea987f79ef627a2d1" class="notion-header-anchor"></div><a class="notion-hash-link" href="#25925ac96ea880aea987f79ef627a2d1" title="CompSci Bakery"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">CompSci Bakery</span></span></h4><div class="notion-text notion-block-25925ac96ea8802a9dafe09e10e66d26">这题属于是本来不太好做，给蒙出来的</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-25925ac96ea88056bbd9ed72854a1f3a"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A0141e29f-064a-4fb7-b851-f0321bb5e7d5%3Aimage.png?table=block&amp;id=25925ac9-6ea8-8056-bbd9-ed72854a1f3a&amp;t=25925ac9-6ea8-8056-bbd9-ed72854a1f3a" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-25925ac96ea880dc8455cdde15a04e0d">做题过程没留了，记录一下思路</div><div class="notion-text notion-block-25925ac96ea88050a90edef550822f5c">首先是这个Uiua语言，基于栈的，输入类似于x a b，就相当于bxa（a b为数字，x为操作）可以有多个参数，参数可以为数组，操作可以把栈上的东西复制或者删除，x a b → x b 这样是删掉了一个；?字符可以打印当前栈，虽然没太看懂</div><div class="notion-text notion-block-25925ac96ea880269d9ac158e397a37e">这题的每一句话就相当于一个函数，可以通过在后面输入数字测试，如果输入的数字直接被打印说明参数超了（实际上就是打印剩下的数字栈）</div><div class="notion-text notion-block-25925ac96ea88046b38de7665b792151">里面只有E不好理解，L是斐波那契数列，P是将数组每一个数循环向右移动一个下标，然后修改值为整个数组和-当前数字</div><div class="notion-text notion-block-25925ac96ea880f48a3ef4e694911154">我是把E打表出来然后搜索引擎发现这是一个数列fibbinary，大意是所有没有相邻1的数字的数列，具有一些斐波那契数列的性质（1 10 100 101 1000 1001大概这样）这个数列有没有什么通项真不懂了，但是这个数列的检测很简单，直接O(n)上去就ok，然后还要知道这个C函数要先E后P，这块也卡了一阵</div><div class="notion-blank notion-block-25a25ac96ea880b28a4ec289ac8a422b"> </div><div class="notion-blank notion-block-25a25ac96ea88081a541c552e7fe9a2e"> </div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-25a25ac96ea88045a284d74927ccc102" data-id="25a25ac96ea88045a284d74927ccc102"><span><div id="25a25ac96ea88045a284d74927ccc102" class="notion-header-anchor"></div><a class="notion-hash-link" href="#25a25ac96ea88045a284d74927ccc102" title="back to future"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">back to future</span></span></h2><div class="notion-blank notion-block-25a25ac96ea8809d883fe77c5211c890"> </div><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-25a25ac96ea880b78d2cf3e6d5373e46" data-id="25a25ac96ea880b78d2cf3e6d5373e46"><span><div id="25a25ac96ea880b78d2cf3e6d5373e46" class="notion-header-anchor"></div><a class="notion-hash-link" href="#25a25ac96ea880b78d2cf3e6d5373e46" title="修复"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">修复</span></span></h4><div class="notion-blank notion-block-25a25ac96ea880099632cc5dd2ef6dd3"> </div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-25a25ac96ea88097a0fdf2fd8ba2ece3"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A328770d6-04c0-4039-a704-d3e1d168791c%3Aimage.png?table=block&amp;id=25a25ac9-6ea8-8097-a0fd-f2fd8ba2ece3&amp;t=25a25ac9-6ea8-8097-a0fd-f2fd8ba2ece3" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-25a25ac96ea8801fa01fde3f86b1f1d9">这个字节代换是比较简洁的：</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-25a25ac96ea8800cb891c7478da99ef6"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3Adbe50ded-0eb9-40a1-9859-3f59f8f87f84%3Aimage.png?table=block&amp;id=25a25ac9-6ea8-800c-b891-c7478da99ef6&amp;t=25a25ac9-6ea8-800c-b891-c7478da99ef6" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-25a25ac96ea880c68dfedb220224487e">这里短短几行汇编就是shift rows了：怕错画了一遍汇编确实是这样子的</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-25a25ac96ea8808496fbf5781c362b08"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A7f7e1c73-9721-40bd-b1d2-9bd0b14c4d51%3Aimage.png?table=block&amp;id=25a25ac9-6ea8-8084-96fb-f5781c362b08&amp;t=25a25ac9-6ea8-8084-96fb-f5781c362b08" alt="notion image" loading="lazy" decoding="async"/></div></figure><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-25a25ac96ea88076baffd6343d1157e9"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A6f6a5d59-7cf4-43e0-a188-3535a17960a9%3Aimage.png?table=block&amp;id=25a25ac9-6ea8-8076-baff-d6343d1157e9&amp;t=25a25ac9-6ea8-8076-baff-d6343d1157e9" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-25a25ac96ea880408390d8541ecefdff">这两部分还是标准的，后面明显就改了一些了：</div><div class="notion-blank notion-block-25a25ac96ea880039783c15004d44cef"> </div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[das202311]]></title>
            <link>https://moyaoxue.de/article/14425ac9-6ea8-803f-9575-efe69134e06b</link>
            <guid>https://moyaoxue.de/article/14425ac9-6ea8-803f-9575-efe69134e06b</guid>
            <pubDate>Sun, 26 Nov 2023 00:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-14425ac96ea8803f9575efe69134e06b"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-14425ac96ea880a59cfaf1272ce553f9" data-id="14425ac96ea880a59cfaf1272ce553f9"><span><div id="14425ac96ea880a59cfaf1272ce553f9" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea880a59cfaf1272ce553f9" title="misc"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">misc</span></span></h3><div class="notion-text notion-block-14425ac96ea880b2ba3fff128bfdd020">帮着看了一眼，有一道题提出来的是一个upx打包的elf，简单分析发现用的<code class="notion-inline-code">upx-4.2.1-amd64_linux</code>版本，直接官网找了再upx -d即可，里面base64变表，解出来即可</div><h3 class="notion-h notion-h2 notion-h-indent-0 notion-block-14425ac96ea880119b5be63577537ac6" data-id="14425ac96ea880119b5be63577537ac6"><span><div id="14425ac96ea880119b5be63577537ac6" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea880119b5be63577537ac6" title="re"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">re</span></span></h3><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-14425ac96ea880f5916cf7bb438778d1" data-id="14425ac96ea880f5916cf7bb438778d1"><span><div id="14425ac96ea880f5916cf7bb438778d1" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea880f5916cf7bb438778d1" title="letsgo"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">letsgo</span></span></h4><div class="notion-text notion-block-14425ac96ea88018963fdf1dba48d66e">dll里面upx 3.94，自己<code class="notion-inline-code">upx file</code>加一个dll壳，发现了三四个被修改了的标志位，修复即可<code class="notion-inline-code">upx -d</code></div><div class="notion-text notion-block-14425ac96ea880969699d09109152594">主程序没东西，有两个地方加载了dll，断点查看，这里是抽卡用的逻辑</div><div class="notion-text notion-block-14425ac96ea8808a9163d45cf940606f">里面有解压图片的操作</div><div class="notion-text notion-block-14425ac96ea880aeb224cce7e7fae94f"><s>你们二次元差不多得了</s></div><div class="notion-text notion-block-14425ac96ea880bd83e4edada69be57c">于是发现前面做的没有意义</div><div class="notion-text notion-block-14425ac96ea8803d992fe42eab38bd6e">那就只有这里了：</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-14425ac96ea88087b09bcc69c2b1c93d"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Fec8fd2f2-1649-4985-8970-ff7b57d45517%2F4b240762-ab64-47cd-8e3c-0302ea0ae6ba%2Fimage.png?table=block&amp;id=14425ac9-6ea8-8087-b09b-cc69c2b1c93d&amp;t=14425ac9-6ea8-8087-b09b-cc69c2b1c93d&amp;width=709.9603271484375&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-14425ac96ea880db8b97fc17878a8b2d">这里拿到key：</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-14425ac96ea8806e9eb3dc873f897515"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Fec8fd2f2-1649-4985-8970-ff7b57d45517%2Fccd05036-7a2b-4d3a-9c06-1fcf82e12dbe%2Fimage.png?table=block&amp;id=14425ac9-6ea8-806e-9eb3-dc873f897515&amp;t=14425ac9-6ea8-806e-9eb3-dc873f897515&amp;width=461.7658996582031&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-14425ac96ea880928dc2fda82cc3b175">这里是啥呢：</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-14425ac96ea880018b2ff9eba1d1d45b"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Fec8fd2f2-1649-4985-8970-ff7b57d45517%2F8f0aa424-629e-4e5e-b4ff-9dc13d86baa0%2Fimage.png?table=block&amp;id=14425ac9-6ea8-8001-8b2f-f9eba1d1d45b&amp;t=14425ac9-6ea8-8001-8b2f-f9eba1d1d45b&amp;width=709.9801635742188&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-14425ac96ea8803d9d8be731ee522fbb">画一下图发现是蒙特卡罗模拟π，下面<code class="notion-inline-code">COERCE_UNSIGNED_INT64</code>强制将π解释为整数，然后作为seed生成一组xor用的随机数</div><div class="notion-text notion-block-14425ac96ea8805b8656efffbc58579c">下面就是一个aes192，这里ida反编译不出来，看看汇编即可找到key和密文</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-14425ac96ea880e4bf27ef282349ae6b"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Fec8fd2f2-1649-4985-8970-ff7b57d45517%2F1aba5c73-4d7c-4aa4-b2df-1b638175e51b%2Fimage.png?table=block&amp;id=14425ac9-6ea8-80e4-bf27-ef282349ae6b&amp;t=14425ac9-6ea8-80e4-bf27-ef282349ae6b&amp;width=461.7559814453125&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-14425ac96ea880a3a873d5769f97ba45">最搞心态的一点是，这里的蒙特卡罗模拟是跑不出来的（而且本身模拟golang也是一个相当麻烦的操作），首先你得猜这里就是π，以及四舍五入的情况，进行一定量的爆破操作，结果这地方魔改源码在rand里面多加了一个异或！</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-14425ac96ea8807e8548d27bcb0b147c"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Fec8fd2f2-1649-4985-8970-ff7b57d45517%2Fc2493f8d-31e7-43e0-bfbe-63f2fde9dbd1%2Fimage.png?table=block&amp;id=14425ac9-6ea8-807e-8548-d27bcb0b147c&amp;t=14425ac9-6ea8-807e-8548-d27bcb0b147c&amp;width=709.9702758789062&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-14425ac96ea88090b008c8dcb7a1afc9">给你逆天逆完了</div><div class="notion-text notion-block-14425ac96ea880a8b2d5deb43b7ecf65">脚本：</div><h4 class="notion-h notion-h3 notion-h-indent-1 notion-block-14425ac96ea880d492defe26924b6993" data-id="14425ac96ea880d492defe26924b6993"><span><div id="14425ac96ea880d492defe26924b6993" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea880d492defe26924b6993" title="ezpython"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">ezpython</span></span></h4><div class="notion-text notion-block-14425ac96ea880e2bf10e2bc761eeeb2">...</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-14425ac96ea8805bb999ffb84f989a80"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Fec8fd2f2-1649-4985-8970-ff7b57d45517%2F6fea03ed-ac68-416c-9a22-812955119df9%2Fimage.png?table=block&amp;id=14425ac9-6ea8-805b-b999-ffb84f989a80&amp;t=14425ac9-6ea8-805b-b999-ffb84f989a80&amp;width=461.7559814453125&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-14425ac96ea88062997edd848bd2c9da">反编译拿到：</div><div class="notion-text notion-block-14425ac96ea88017b87fe88bb067fa89">反编译有问题，iv拿不到，但是就差八位</div><div class="notion-text notion-block-14425ac96ea880a9b82ec46358dcd216">晚点出个完整的python各个版本应对策略（立flag&amp;鸽）dis一下自己看</div><div class="notion-text notion-block-14425ac96ea880f09ef1f57e0fde3cd3">结合一下就加上<code class="notion-inline-code">DASCTF{</code>呗，给他爆一位：<code class="notion-inline-code">DASCTF{D0_U_4ls0_l1k3_7uansH3n}</code></div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[angr初探]]></title>
            <link>https://moyaoxue.de/article/14425ac9-6ea8-8086-9af4-ef813c01ce17</link>
            <guid>https://moyaoxue.de/article/14425ac9-6ea8-8086-9af4-ef813c01ce17</guid>
            <pubDate>Tue, 24 Oct 2023 00:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-14425ac96ea880869af4ef813c01ce17"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><div class="notion-callout notion-gray_background_co notion-block-14425ac96ea8819a85e5fc6042d24f69"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="😀">😀</span></div><div class="notion-callout-text">angr的文档还是写的比较有意思而且详细的，适合当睡前读物，点名批评某二进制分析工具的文档...…</div></div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea880178b02c9371a4b024c" data-id="14425ac96ea880178b02c9371a4b024c"><span><div id="14425ac96ea880178b02c9371a4b024c" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea880178b02c9371a4b024c" title="参考链接："><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">参考链接：</span></span></h4><div class="notion-text notion-block-14425ac96ea880eba6e0ef7f79057f69"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://docs.angr.io/en/latest/">angr documentation</a></div><div class="notion-text notion-block-14425ac96ea8805a9499d44b566ccf16"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://github.com/jakespringer/angr_ctf">jakespringer/angr_ctf (github.com)</a></div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea8806cbe18fb8e8f966e17" data-id="14425ac96ea8806cbe18fb8e8f966e17"><span><div id="14425ac96ea8806cbe18fb8e8f966e17" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea8806cbe18fb8e8f966e17" title="虚拟环境"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">虚拟环境</span></span></h4><div class="notion-text notion-block-14425ac96ea8800d829afbc710cc7d94"><code class="notion-inline-code">angr</code>官方推荐在虚拟环境中运行，防止与外部包冲突（例如<code class="notion-inline-code">keystone</code>和<code class="notion-inline-code">keystone-engine</code>冲突，这里用的是<code class="notion-inline-code">keystone-engine</code>）</div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea880999129c5558f805107" data-id="14425ac96ea880999129c5558f805107"><span><div id="14425ac96ea880999129c5558f805107" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea880999129c5558f805107" title="使用样例"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">使用样例</span></span></h4><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea880a2a746e416b2e6eeda" data-id="14425ac96ea880a2a746e416b2e6eeda"><span><div id="14425ac96ea880a2a746e416b2e6eeda" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea880a2a746e416b2e6eeda" title="导入模块"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">导入模块</span></span></h4><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea880768995fe94e6edfc71" data-id="14425ac96ea880768995fe94e6edfc71"><span><div id="14425ac96ea880768995fe94e6edfc71" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea880768995fe94e6edfc71" title="命令行使用时可以导入monkeyhex转化为十六进制输出"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">命令行使用时可以导入<code class="notion-inline-code">monkeyhex</code>转化为十六进制输出</span></span></h4><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea880cebc5fed2d7ec387dc" data-id="14425ac96ea880cebc5fed2d7ec387dc"><span><div id="14425ac96ea880cebc5fed2d7ec387dc" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea880cebc5fed2d7ec387dc" title="project的基础属性"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">project的基础属性</span></span></h4><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea880f0b210d6b483683e9b" data-id="14425ac96ea880f0b210d6b483683e9b"><span><div id="14425ac96ea880f0b210d6b483683e9b" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea880f0b210d6b483683e9b" title="对基本块的操作"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">对基本块的操作</span></span></h4><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea880759417e3c5cb804cc8" data-id="14425ac96ea880759417e3c5cb804cc8"><span><div id="14425ac96ea880759417e3c5cb804cc8" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea880759417e3c5cb804cc8" title="模拟状态 SimState"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">模拟状态 <code class="notion-inline-code">SimState</code></span></span></h4><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea8805e87d9f03996f2619f" data-id="14425ac96ea8805e87d9f03996f2619f"><span><div id="14425ac96ea8805e87d9f03996f2619f" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea8805e87d9f03996f2619f" title="模拟管理器 Simulation Managers"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">模拟管理器 <code class="notion-inline-code">Simulation Managers</code></span></span></h4><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea880dcbb2bd9d0f2c6847d" data-id="14425ac96ea880dcbb2bd9d0f2c6847d"><span><div id="14425ac96ea880dcbb2bd9d0f2c6847d" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea880dcbb2bd9d0f2c6847d" title="Analyses"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Analyses</span></span></h4><div class="notion-text notion-block-14425ac96ea8808a879ec93c533b04c9">（未必准确的解释，后续慢慢验证）</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-14425ac96ea880dbb25ed3c06954d959"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Fec8fd2f2-1649-4985-8970-ff7b57d45517%2F238f65c0-fcfb-4e76-8b2c-fbc0d3b5d677%2Fimage.png?table=block&amp;id=14425ac9-6ea8-80db-b25e-d3c06954d959&amp;t=14425ac9-6ea8-80db-b25e-d3c06954d959&amp;width=461.7658996582031&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-14425ac96ea88055b368c1ec64a210b1"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Fec8fd2f2-1649-4985-8970-ff7b57d45517%2F2d6d49ce-d71f-448e-a57a-a9e9143495c2%2Fimage.png?table=block&amp;id=14425ac9-6ea8-8055-b368-c1ec64a210b1&amp;t=14425ac9-6ea8-8055-b368-c1ec64a210b1&amp;width=461.7658996582031&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea88083aaacf3b393794221" data-id="14425ac96ea88083aaacf3b393794221"><span><div id="14425ac96ea88083aaacf3b393794221" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea88083aaacf3b393794221" title="The Loader"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">The Loader</span></span></h4><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea88038b007c6960d7ef6d6" data-id="14425ac96ea88038b007c6960d7ef6d6"><span><div id="14425ac96ea88038b007c6960d7ef6d6" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea88038b007c6960d7ef6d6" title="Symbols and Relocations"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Symbols and Relocations</span></span></h4><div class="notion-text notion-block-14425ac96ea880cb93c9c537d7e240e3">CLE寻找符号地址</div><div class="notion-text notion-block-14425ac96ea8801e8f9df145e1b5e4d4">The Symbol object has three ways of reporting its address:</div><ul class="notion-list notion-list-disc notion-block-14425ac96ea880308b73d202005498de"><li><code class="notion-inline-code">.rebased_addr</code> is its address in the global address space. This is what is shown in the print output.</li></ul><ul class="notion-list notion-list-disc notion-block-14425ac96ea88064b635c9de467ea68a"><li><code class="notion-inline-code">.linked_addr</code> is its address relative to the prelinked base of the binary. This is the address reported in, for example, <code class="notion-inline-code">readelf(1)</code>.</li></ul><ul class="notion-list notion-list-disc notion-block-14425ac96ea880baab59da0f9f1e5b0c"><li><code class="notion-inline-code">.relative_addr</code> is its address relative to the object base. This is known in the literature (particularly the Windows literature) as an RVA (relative virtual address).</li></ul><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea88053bc8aebd943582378" data-id="14425ac96ea88053bc8aebd943582378"><span><div id="14425ac96ea88053bc8aebd943582378" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea88053bc8aebd943582378" title="Loading Options"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Loading Options</span></span></h4><div class="notion-text notion-block-14425ac96ea880dda4fee05c18c3d590">If you are loading something with <code class="notion-inline-code">angr.Project</code> and you want to pass an option to the <code class="notion-inline-code">cle.Loader</code> instance that Project implicitly creates, you can just pass the keyword argument directly to the Project constructor, and it will be passed on to CLE. You should look at the <a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://docs.angr.io/projects/cle/en/latest/api.html">CLE API docs.</a> if you want to know everything that could possibly be passed in as an option, but we will go over some important and frequently used options here.</div><div class="notion-text notion-block-14425ac96ea88093a48ecd430f0c8878">We’ve discussed <code class="notion-inline-code">auto_load_libs</code> already - it enables or disables CLE’s attempt to automatically resolve shared library dependencies, and is on by default. Additionally, there is the opposite, <code class="notion-inline-code">except_missing_libs</code>, which, if set to true, will cause an exception to be thrown whenever a binary has a shared library dependency that cannot be resolved.</div><div class="notion-text notion-block-14425ac96ea88016b09ceaebd418ef44">You can pass a list of strings to <code class="notion-inline-code">force_load_libs</code> and anything listed will be treated as an unresolved shared library dependency right out of the gate, or you can pass a list of strings to <code class="notion-inline-code">skip_libs</code> to prevent any library of that name from being resolved as a dependency. Additionally, you can pass a list of strings (or a single string) to <code class="notion-inline-code">ld_path</code>, which will be used as an additional search path for shared libraries, before any of the defaults: the same directory as the loaded program, the current working directory, and your system libraries.</div><div class="notion-text notion-block-14425ac96ea88076b2a0ff2c30e0c859">If you want to specify some options that only apply to a specific binary object, CLE will let you do that too. The parameters <code class="notion-inline-code">main_opts</code> and <code class="notion-inline-code">lib_opts</code> do this by taking dictionaries of options. <code class="notion-inline-code">main_opts</code> is a mapping from option names to option values, while <code class="notion-inline-code">lib_opts</code> is a mapping from library name to dictionaries mapping option names to option values.</div><div class="notion-text notion-block-14425ac96ea88099af7aeba59c1fe032">The options that you can use vary from backend to backend, but some common ones are:</div><ul class="notion-list notion-list-disc notion-block-14425ac96ea880379cd6e42a6681a382"><li><code class="notion-inline-code">backend</code> - which backend to use, as either a class or a name</li></ul><ul class="notion-list notion-list-disc notion-block-14425ac96ea880779b0cebcf840df27e"><li><code class="notion-inline-code">base_addr</code> - a base address to use</li></ul><ul class="notion-list notion-list-disc notion-block-14425ac96ea880319541f893734838ab"><li><code class="notion-inline-code">entry_point</code> - an entry point to use</li></ul><ul class="notion-list notion-list-disc notion-block-14425ac96ea880c285e2fb7cd3139415"><li><code class="notion-inline-code">arch</code> - the name of an architecture to use</li></ul><div class="notion-text notion-block-14425ac96ea880c5b585c09d6c0487c7">Example:</div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea8808d86b1d0913dad1a93" data-id="14425ac96ea8808d86b1d0913dad1a93"><span><div id="14425ac96ea8808d86b1d0913dad1a93" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea8808d86b1d0913dad1a93" title="Symbolic Function Summaries"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Symbolic Function Summaries</span></span></h4><div class="notion-text notion-block-14425ac96ea880ca8889f5a016e6d76a"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://github.com/angr/angr/tree/master/angr/procedures">angr/angr/procedures at master · angr/angr (github.com)</a></div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea880e1b759c2ecca591558" data-id="14425ac96ea880e1b759c2ecca591558"><span><div id="14425ac96ea880e1b759c2ecca591558" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea880e1b759c2ecca591558" title="hook"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">hook</span></span></h4><div class="notion-text notion-block-14425ac96ea880579f17e55d3831a0f0">可以尝试</div><div class="notion-text notion-block-14425ac96ea880dbac34f6fac012f869">然后可以进行hook修改寄存器等操作</div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea880efb41fd27e5f51b9d0" data-id="14425ac96ea880efb41fd27e5f51b9d0"><span><div id="14425ac96ea880efb41fd27e5f51b9d0" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea880efb41fd27e5f51b9d0" title="符号样例"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">符号样例</span></span></h4><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea880ec8ab1c8319be77876" data-id="14425ac96ea880ec8ab1c8319be77876"><span><div id="14425ac96ea880ec8ab1c8319be77876" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea880ec8ab1c8319be77876" title="Bitvectors"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Bitvectors</span></span></h4><div class="notion-text notion-block-14425ac96ea8806aa12ef7364cfd7dba">可以通过ASTs分析</div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea8807f8cc4e161bb54c815" data-id="14425ac96ea8807f8cc4e161bb54c815"><span><div id="14425ac96ea8807f8cc4e161bb54c815" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea8807f8cc4e161bb54c815" title="Symbolic Constraints"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Symbolic Constraints</span></span></h4><div class="notion-text notion-block-14425ac96ea880c3b98bf6763fe4dae3">Performing comparison operations between any two similarly-typed ASTs will yield another AST - not a bitvector, but now a symbolic boolean.</div><div class="notion-text notion-block-14425ac96ea880e5a637ed954663632e">判断</div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea880789a93e12cf5f11337" data-id="14425ac96ea880789a93e12cf5f11337"><span><div id="14425ac96ea880789a93e12cf5f11337" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea880789a93e12cf5f11337" title="Constraint Solving"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Constraint Solving</span></span></h4><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea880db9142e26402a13d66" data-id="14425ac96ea880db9142e26402a13d66"><span><div id="14425ac96ea880db9142e26402a13d66" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea880db9142e26402a13d66" title="Floating point numbers"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Floating point numbers</span></span></h4><div class="notion-text notion-block-14425ac96ea880afac8ae849bcdca501">This is nice, but sometimes we need to be able to work directly with the representation of the float as a bitvector. You can interpret bitvectors as floats and vice versa, with the methods <code class="notion-inline-code">raw_to_bv</code> and <code class="notion-inline-code">raw_to_fp</code>:</div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea8801991f7f6570689c730" data-id="14425ac96ea8801991f7f6570689c730"><span><div id="14425ac96ea8801991f7f6570689c730" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea8801991f7f6570689c730" title="More Solving Methods"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">More Solving Methods</span></span></h4><div class="notion-text notion-block-14425ac96ea880ab90d7f07fc045c6f0"><code class="notion-inline-code">eval</code> will give you one possible solution to an expression, but what if you want several? What if you want to ensure that the solution is unique? The solver provides you with several methods for common solving patterns:</div><ul class="notion-list notion-list-disc notion-block-14425ac96ea88092a19fca60f8a26036"><li><code class="notion-inline-code">solver.eval(expression)</code> will give you one possible solution to the given expression.</li></ul><ul class="notion-list notion-list-disc notion-block-14425ac96ea88074a509f881f711ada0"><li><code class="notion-inline-code">solver.eval_one(expression)</code> will give you the solution to the given expression, or throw an error if more than one solution is possible.</li></ul><ul class="notion-list notion-list-disc notion-block-14425ac96ea88048b3a8fc11795ab98a"><li><code class="notion-inline-code">solver.eval_upto(expression, n)</code> will give you up to n solutions to the given expression, returning fewer than n if fewer than n are possible.</li></ul><ul class="notion-list notion-list-disc notion-block-14425ac96ea880578126e436c461d896"><li><code class="notion-inline-code">solver.eval_atleast(expression, n)</code> will give you n solutions to the given expression, throwing an error if fewer than n are possible.</li></ul><ul class="notion-list notion-list-disc notion-block-14425ac96ea88043a20fff519163730e"><li><code class="notion-inline-code">solver.eval_exact(expression, n)</code> will give you n solutions to the given expression, throwing an error if fewer or more than are possible.</li></ul><ul class="notion-list notion-list-disc notion-block-14425ac96ea880cdab48f5c16e810eec"><li><code class="notion-inline-code">solver.min(expression)</code> will give you the minimum possible solution to the given expression.</li></ul><ul class="notion-list notion-list-disc notion-block-14425ac96ea8803fada3f5b2f6602a78"><li><code class="notion-inline-code">solver.max(expression)</code> will give you the maximum possible solution to the given expression.</li></ul><div class="notion-text notion-block-14425ac96ea88009b9f5d05fd4ef8832">Additionally, all of these methods can take the following keyword arguments:</div><ul class="notion-list notion-list-disc notion-block-14425ac96ea880ab8e63cb1b67fe315f"><li><code class="notion-inline-code">extra_constraints</code> can be passed as a tuple of constraints. These constraints will be taken into account for this evaluation, but will not be added to the state.</li></ul><ul class="notion-list notion-list-disc notion-block-14425ac96ea88022896acbdeb5097ece"><li><code class="notion-inline-code">cast_to</code> can be passed a data type to cast the result to. Currently, this can only be <code class="notion-inline-code">int</code> and <code class="notion-inline-code">bytes</code>, which will cause the method to return the corresponding representation of the underlying data. For example, <code class="notion-inline-code">state.solver.eval(state.solver.BVV(0x41424344, 32), cast_to=bytes)</code> will return <code class="notion-inline-code">b&#x27;ABCD&#x27;</code>.</li></ul><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea880afaaf1d5450b3fadf1" data-id="14425ac96ea880afaaf1d5450b3fadf1"><span><div id="14425ac96ea880afaaf1d5450b3fadf1" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea880afaaf1d5450b3fadf1" title="Machine State - memory, registers, and so on"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Machine State - memory, registers, and so on</span></span></h4><div class="notion-text notion-block-14425ac96ea880c08898f5aee24ea43c">quick examples:</div><div class="notion-text notion-block-14425ac96ea880129d09f38593b6696c">这里开始使用更简单的执行方法：<code class="notion-inline-code">state.step()</code>，其会进行一步符号执行并且返回名为<code class="notion-inline-code"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://docs.angr.io/en/latest/api.html#angr.engines.successors.SimSuccessors">angr.engines.successors.SimSuccessors</a></code>的对象，并且会提供若干可以被分类成不同执行路径的继承状态，关注该对象的 <code class="notion-inline-code">.successors</code> 属性，其是一个包含所有“normal” successors of a given step的list。</div><div class="notion-text notion-block-14425ac96ea8803dae42ddd074464ec7">该list会包含所有constraint的正误状态作为新的constraint</div><div class="notion-text notion-block-14425ac96ea880c48228cf99d5c7d97f">(这里的example应该是用一个strcmp作为constraint)</div><div class="notion-text notion-block-14425ac96ea88043b649ee3650886fc3">可以use <code class="notion-inline-code">state.posix.stdin.load(0, state.posix.stdin.size)</code> to retrieve a bitvector representing all the content read from stdin so far</div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea880bbaf0dfff13fd7c2f2" data-id="14425ac96ea880bbaf0dfff13fd7c2f2"><span><div id="14425ac96ea880bbaf0dfff13fd7c2f2" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea880bbaf0dfff13fd7c2f2" title="State Presets"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">State Presets</span></span></h4><div class="notion-text notion-block-14425ac96ea880728637f91c2f8d22c4"><code class="notion-inline-code">project.factory.</code></div><ul class="notion-list notion-list-disc notion-block-14425ac96ea880fc917fed213bd208a3"><li><code class="notion-inline-code">.blank_state()</code> constructs a “blank slate” blank state, with most of its data left uninitialized. When accessing uninitialized data, an unconstrained symbolic value will be returned.</li></ul><ul class="notion-list notion-list-disc notion-block-14425ac96ea8802bbbf2f356748a1f44"><li><code class="notion-inline-code">.entry_state()</code> constructs a state ready to execute at the main binary’s entry point.</li></ul><ul class="notion-list notion-list-disc notion-block-14425ac96ea880d38b67d1803ee252c2"><li><code class="notion-inline-code">.full_init_state()</code> constructs a state that is ready to execute through any initializers that need to be run before the main binary’s entry point, for example, shared library constructors or preinitializers. When it is finished with these it will jump to the entry point.</li></ul><ul class="notion-list notion-list-disc notion-block-14425ac96ea88064800ff2677d61f545"><li><code class="notion-inline-code">.call_state()</code> constructs a state ready to execute a given function.</li></ul><div class="notion-text notion-block-14425ac96ea880348effea2b061066cb">使用方法：</div><ul class="notion-list notion-list-disc notion-block-14425ac96ea880f0a80eff3f6c347ffa"><li>传入起始地址：</li></ul><div class="notion-text notion-block-14425ac96ea88091a8e1f2ff8aeb483d">​	All of these constructors can take an <code class="notion-inline-code">addr</code> argument to specify the exact address to start.</div><ul class="notion-list notion-list-disc notion-block-14425ac96ea880228153e746fba37eae"><li>传入参数：</li></ul><div class="notion-text notion-block-14425ac96ea88068a6fae203806e0974">​	If you’re executing in an environment that can take command line arguments or an environment, you can pass a list of arguments through <code class="notion-inline-code">args</code> and a dictionary of environment variables through <code class="notion-inline-code">env</code> into <code class="notion-inline-code">entry_state</code> and <code class="notion-inline-code">full_init_state</code>. The values in these structures can be strings or bitvectors, and will be serialized into the state as the arguments and environment to the simulated execution. The default <code class="notion-inline-code">args</code> is an empty list, so if the program you’re analyzing expects to find at least an <code class="notion-inline-code">argv[0]</code>, you should always provide that!</div><ul class="notion-list notion-list-disc notion-block-14425ac96ea88010b30cc198c431e372"><li>可以传入符号</li></ul><div class="notion-text notion-block-14425ac96ea880d4b371e315ef37b311">​	If you’d like to have <code class="notion-inline-code">argc</code> be symbolic, you can pass a symbolic bitvector as <code class="notion-inline-code">argc</code> to the <code class="notion-inline-code">entry_state</code> and <code class="notion-inline-code">full_init_state</code> constructors. Be careful, though: if you do this, you should also add a constraint to the resulting state that your value for argc cannot be larger than the number of args you passed into <code class="notion-inline-code">args</code>.</div><ul class="notion-list notion-list-disc notion-block-14425ac96ea880c09747cbd478b5726e"><li>传入函数参数</li></ul><div class="notion-text notion-block-14425ac96ea88012b818da688c463ed0">​	To use the call state, you should call it with <code class="notion-inline-code">.call_state(addr, arg1, arg2, ...)</code>, where <code class="notion-inline-code">addr</code> is the address of the function you want to call and <code class="notion-inline-code">argN</code> is the Nth argument to that function, either as a Python integer, string, or array, or a bitvector. If you want to have memory allocated and actually pass in a pointer to an object, you should wrap it in an PointerWrapper, i.e. <code class="notion-inline-code">angr.PointerWrapper(&quot;point to me!&quot;)</code>. The results of this API can be a little unpredictable, but we’re working on it.</div><div class="notion-text notion-block-14425ac96ea880578d19c8d71131195b">​	To specify the calling convention used for a function with <code class="notion-inline-code">call_state</code>, you can pass a <code class="notion-inline-code"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://docs.angr.io/en/latest/api.html#angr.calling_conventions.SimCC">SimCC</a></code> instance as the <code class="notion-inline-code">cc</code> argument.:raw-html-m2r: We try to pick a sane default, but for special cases you will need to help angr out.</div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea880c79cecd8df77d11abb" data-id="14425ac96ea880c79cecd8df77d11abb"><span><div id="14425ac96ea880c79cecd8df77d11abb" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea880c79cecd8df77d11abb" title="对内存操作"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">对内存操作</span></span></h4><div class="notion-text notion-block-14425ac96ea880b1915ce5edfc183111">对内存地址批量操作</div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea8807aa68cf185a042b4bf" data-id="14425ac96ea8807aa68cf185a042b4bf"><span><div id="14425ac96ea8807aa68cf185a042b4bf" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea8807aa68cf185a042b4bf" title="对寄存器操作"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">对寄存器操作</span></span></h4><div class="notion-text notion-block-14425ac96ea8803fbb18cc47636b06a9"><code class="notion-inline-code">state.registers</code> ： <a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://docs.angr.io/en/latest/advanced-topics/ir.html#intermediate-representation">Intermediate Representation - angr documentation</a></div><div class="notion-text notion-block-14425ac96ea880f486b1c66140c96ca3"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://github.com/angr/archinfo">angr/archinfo: Classes with architecture-specific information useful to other projects. (github.com)</a></div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea880538e84c9ca4ea2f991" data-id="14425ac96ea880538e84c9ca4ea2f991"><span><div id="14425ac96ea880538e84c9ca4ea2f991" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea880538e84c9ca4ea2f991" title="State Options"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">State Options</span></span></h4><div class="notion-text notion-block-14425ac96ea880f0badfefab7f6e99f7"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://docs.angr.io/en/latest/appendix/options.html#list-of-state-options">https://docs.angr.io/en/latest/appendix/options.html#list-of-state-options</a></div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea8800bb913d9a3ceb5cbc0" data-id="14425ac96ea8800bb913d9a3ceb5cbc0"><span><div id="14425ac96ea8800bb913d9a3ceb5cbc0" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea8800bb913d9a3ceb5cbc0" title="Plugins"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Plugins</span></span></h4><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea8805b914dffda5307ab30" data-id="14425ac96ea8805b914dffda5307ab30"><span><div id="14425ac96ea8805b914dffda5307ab30" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea8805b914dffda5307ab30" title="State Plugins"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">State Plugins</span></span></h4><div class="notion-text notion-block-14425ac96ea880779a6ff7637b66da4e"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://docs.angr.io/en/latest/extending-angr/state_plugins.html#state-plugins">implement new kinds of data storage</a></div><div class="notion-text notion-block-14425ac96ea8805e8ca2c50f6d41dbac">For example, the normal <code class="notion-inline-code">memory</code> plugin simulates a flat memory space, but analyses can choose to enable the “abstract memory” plugin, which uses alternate data types for addresses to simulate free-floating memory mappings independent of address, to provide <code class="notion-inline-code">state.memory</code>. Conversely, plugins can reduce code complexity: <code class="notion-inline-code">state.memory</code> and <code class="notion-inline-code">state.registers</code> are actually two different instances of the same plugin, since the registers are emulated with an address space as well.</div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea8801f9793e3f55ecbf974" data-id="14425ac96ea8801f9793e3f55ecbf974"><span><div id="14425ac96ea8801f9793e3f55ecbf974" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea8801f9793e3f55ecbf974" title="The globals plugin"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">The globals plugin</span></span></h4><div class="notion-text notion-block-14425ac96ea880b48e29c3c7a9e95776"><code class="notion-inline-code">state.globals</code> is an extremely simple plugin: it implements the interface of a standard Python dict, allowing you to store arbitrary data on a state.</div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea880c29d1ec50991771fb8" data-id="14425ac96ea880c29d1ec50991771fb8"><span><div id="14425ac96ea880c29d1ec50991771fb8" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea880c29d1ec50991771fb8" title="The history plugin"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">The history plugin</span></span></h4><div class="notion-text notion-block-14425ac96ea8807ebbddd13ce5aa61f3"><code class="notion-inline-code">state.history</code> is a very important plugin storing historical data about the path a state has taken during execution. It is actually a linked list of several history nodes, each one representing a single round of execution—you can traverse this list with <code class="notion-inline-code">state.history.parent.parent</code> etc.</div><div class="notion-text notion-block-14425ac96ea880878971c0e0b4f0dcbc">To make it more convenient to work with this structure, the history also provides several efficient iterators over the history of certain values. In general, these values are stored as <code class="notion-inline-code">history.recent_NAME</code> and the iterator over them is just <code class="notion-inline-code">history.NAME</code>. For example, <code class="notion-inline-code">for addr in state.history.bbl_addrs: print hex(addr)</code> will print out a basic block address trace for the binary, while <code class="notion-inline-code">state.history.recent_bbl_addrs</code> is the list of basic blocks executed in the most recent step, <code class="notion-inline-code">state.history.parent.recent_bbl_addrs</code> is the list of basic blocks executed in the previous step, etc. If you ever need to quickly obtain a flat list of these values, you can access <code class="notion-inline-code">.hardcopy</code>, e.g. <code class="notion-inline-code">state.history.bbl_addrs.hardcopy</code>. Keep in mind though, index-based accessing is implemented on the iterators.</div><div class="notion-text notion-block-14425ac96ea88036a14cec30c48b444a">Here is a brief listing of some of the values stored in the history:</div><ul class="notion-list notion-list-disc notion-block-14425ac96ea880cbb665ff06012cbb83"><li><code class="notion-inline-code">history.descriptions</code> is a listing of string descriptions of each of the rounds of execution performed on the state.</li></ul><ul class="notion-list notion-list-disc notion-block-14425ac96ea8800ba6cbdb4b9de9fc23"><li><code class="notion-inline-code">history.bbl_addrs</code> is a listing of the basic block addresses executed by the state. There may be more than one per round of execution, and not all addresses may correspond to binary code - some may be addresses at which SimProcedures are hooked.</li></ul><ul class="notion-list notion-list-disc notion-block-14425ac96ea880f68542d790eb7f02bb"><li><code class="notion-inline-code">history.jumpkinds</code> is a listing of the disposition of each of the control flow transitions in the state’s history, as VEX enum strings.</li></ul><ul class="notion-list notion-list-disc notion-block-14425ac96ea880bc9273c0b698e3537e"><li><code class="notion-inline-code">history.jump_guards</code> is a listing of the conditions guarding each of the branches that the state has encountered.</li></ul><ul class="notion-list notion-list-disc notion-block-14425ac96ea88065a77fc750df9ac5a3"><li><code class="notion-inline-code">history.events</code> is a semantic listing of “interesting events” which happened during execution, such as the presence of a symbolic jump condition, the program popping up a message box, or execution terminating with an exit code.</li></ul><ul class="notion-list notion-list-disc notion-block-14425ac96ea8806e8491c9793134c04f"><li><code class="notion-inline-code">history.actions</code> is usually empty, but if you add the <code class="notion-inline-code">angr.options.refs</code> options to the state, it will be populated with a log of all the memory, register, and temporary value accesses performed by the program.</li></ul><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea88040becec8d01edf6175" data-id="14425ac96ea88040becec8d01edf6175"><span><div id="14425ac96ea88040becec8d01edf6175" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea88040becec8d01edf6175" title="The callstack plugin"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">The callstack plugin</span></span></h4><div class="notion-text notion-block-14425ac96ea880428db5fc40f62cd262">angr will track the call stack for the emulated program. On every call instruction, a frame will be added to the top of the tracked callstack, and whenever the stack pointer drops below the point where the topmost frame was called, a frame is popped. This allows angr to robustly store data local to the current emulated function.</div><div class="notion-text notion-block-14425ac96ea8805bb19cc9291874c55b">Similar to the history, the callstack is also a linked list of nodes, but there are no provided iterators over the contents of the nodes - instead you can directly iterate over <code class="notion-inline-code">state.callstack</code> to get the callstack frames for each of the active frames, in order from most recent to oldest. If you just want the topmost frame, this is <code class="notion-inline-code">state.callstack</code>.</div><ul class="notion-list notion-list-disc notion-block-14425ac96ea8803ea7bbf95cc463b147"><li><code class="notion-inline-code">callstack.func_addr</code> is the address of the function currently being executed</li></ul><ul class="notion-list notion-list-disc notion-block-14425ac96ea8804b84bcf951e35a6f3b"><li><code class="notion-inline-code">callstack.call_site_addr</code> is the address of the basic block which called the current function</li></ul><ul class="notion-list notion-list-disc notion-block-14425ac96ea8800e88a8f8de79250f9b"><li><code class="notion-inline-code">callstack.stack_ptr</code> is the value of the stack pointer from the beginning of the current function</li></ul><ul class="notion-list notion-list-disc notion-block-14425ac96ea88002bf0ff3452facf792"><li><code class="notion-inline-code">callstack.ret_addr</code> is the location that the current function will return to if it returns</li></ul><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea8803a8453ddf8aa6472dd" data-id="14425ac96ea8803a8453ddf8aa6472dd"><span><div id="14425ac96ea8803a8453ddf8aa6472dd" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea8803a8453ddf8aa6472dd" title="I/O"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">I/O</span></span></h4><div class="notion-text notion-block-14425ac96ea880a38a08db77016e594e"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://docs.angr.io/en/latest/advanced-topics/file_system.html#working-with-file-system-sockets-and-pipes">Working with File System, Sockets, and Pipes</a></div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea880818010f80bdbd6ccd4" data-id="14425ac96ea880818010f80bdbd6ccd4"><span><div id="14425ac96ea880818010f80bdbd6ccd4" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea880818010f80bdbd6ccd4" title="Copying and Merging"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Copying and Merging</span></span></h4><div class="notion-text notion-block-14425ac96ea880d5840ac7829f90c38b">A state supports very fast copies, so that you can explore different possibilities:</div><div class="notion-text notion-block-14425ac96ea8800e9912f6b9e2f5cccf">States can also be merged together.</div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea88027af3df5119b993093" data-id="14425ac96ea88027af3df5119b993093"><span><div id="14425ac96ea88027af3df5119b993093" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea88027af3df5119b993093" title="Simulation Managers"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Simulation Managers</span></span></h4><div class="notion-text notion-block-14425ac96ea880d590c9d4ccb0d4e1b8">描述：</div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea880409169dcac48c88832" data-id="14425ac96ea880409169dcac48c88832"><span><div id="14425ac96ea880409169dcac48c88832" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea880409169dcac48c88832" title="Stepping"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Stepping</span></span></h4><div class="notion-text notion-block-14425ac96ea8804ea764de5e8df27dd8"><code class="notion-inline-code">.step()</code>： 前进一个basic block</div><div class="notion-text notion-block-14425ac96ea880a9b679e3424d9afeac"><code class="notion-inline-code">.run()</code>：执行到所有deadended，并且获得所有deadended states（例如到达exit syscall，此时该state会被从<code class="notion-inline-code">active stash</code>中移除并放入<code class="notion-inline-code">deadended states</code>）</div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea880f28fe9d16c33849423" data-id="14425ac96ea880f28fe9d16c33849423"><span><div id="14425ac96ea880f28fe9d16c33849423" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea880f28fe9d16c33849423" title="Stash Management"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Stash Management</span></span></h4><div class="notion-text notion-block-14425ac96ea88094ad10df96c61f7d70"><code class="notion-inline-code">.move()</code>：<code class="notion-inline-code">from_stash</code> <code class="notion-inline-code">to_stash</code> <code class="notion-inline-code">filter_func (optional, default:everything)</code></div><div class="notion-text notion-block-14425ac96ea880dc8890e41d0d2a48dd">stash的类型为list，可以通过如下方式访问：</div><div class="notion-text notion-block-14425ac96ea880c4988dcd1d49935f1a">所以link呢</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-14425ac96ea880d8bf37cdc565fc6c81"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Fec8fd2f2-1649-4985-8970-ff7b57d45517%2F0155adcc-c721-40e1-9615-abcbe7d98827%2Fimage.png?table=block&amp;id=14425ac9-6ea8-80d8-bf37-cdc565fc6c81&amp;t=14425ac9-6ea8-80d8-bf37-cdc565fc6c81&amp;width=709.9702758789062&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea880a4897adec731de18de" data-id="14425ac96ea880a4897adec731de18de"><span><div id="14425ac96ea880a4897adec731de18de" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea880a4897adec731de18de" title="Stash types"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Stash types</span></span></h4><table class="notion-simple-table notion-block-14425ac96ea880f78204d8472059c96b"><tbody><tr class="notion-simple-table-row notion-block-14425ac96ea880fca7e9d18c4a053791"><td class="" style="width:120px"><div class="notion-simple-table-cell">Stash</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">Description</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880598405f65c1cc2ea66"><td class="" style="width:120px"><div class="notion-simple-table-cell">active</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">This stash contains the states that will be stepped by default, unless an alternate stash is specified.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea88062b188eeb47db51a69"><td class="" style="width:120px"><div class="notion-simple-table-cell">deadended</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">A state goes to the deadended stash when it cannot continue the execution for some reason, including no more valid instructions, unsat state of all of its successors, or an invalid instruction pointer.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea8804fb421df49982b6838"><td class="" style="width:120px"><div class="notion-simple-table-cell">pruned</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">When using <code class="notion-inline-code">LAZY_SOLVES</code>, states are not checked for satisfiability unless absolutely necessary. When a state is found to be unsat in the presence of <code class="notion-inline-code">LAZY_SOLVES</code>, the state hierarchy is traversed to identify when, in its history, it initially became unsat. All states that are descendants of that point (which will also be unsat, since a state cannot become un-unsat) are pruned and put in this stash.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea8808c94fcf7613cffb815"><td class="" style="width:120px"><div class="notion-simple-table-cell">unconstrained</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">If the <code class="notion-inline-code">save_unconstrained</code> option is provided to the SimulationManager constructor, states that are determined to be unconstrained (i.e., with the instruction pointer controlled by user data or some other source of symbolic data) are placed here.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea88042ab92c07faeadb628"><td class="" style="width:120px"><div class="notion-simple-table-cell">unsat</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">If the <code class="notion-inline-code">save_unsat</code> option is provided to the SimulationManager constructor, states that are determined to be unsatisfiable (i.e., they have constraints that are contradictory, like the input having to be both “AAAA” and “BBBB” at the same time) are placed here.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880c18bfcd6aa27744572"><td class="" style="width:120px"><div class="notion-simple-table-cell">errored</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">If, during execution, an error is raised, then the state will be wrapped in an <code class="notion-inline-code">ErrorRecord</code> object, which contains the state and the error it raised, and then the record will be inserted into <code class="notion-inline-code">errored</code>.                launch a debug shell at the site of the error with <code class="notion-inline-code">record.debug()</code>.</div></td></tr></tbody></table><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea88042ac5dda4a7adb8e15" data-id="14425ac96ea88042ac5dda4a7adb8e15"><span><div id="14425ac96ea88042ac5dda4a7adb8e15" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea88042ac5dda4a7adb8e15" title="Exploration"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Exploration</span></span></h4><div class="notion-text notion-block-14425ac96ea88003b312dc28e2e0b326"><code class="notion-inline-code">.explore()</code>：<code class="notion-inline-code">find</code> argument(指令的结束地址或结束地址列表,或函数根据某种标准的返回状态)</div><div class="notion-text notion-block-14425ac96ea88020a6bcf2de3a5b97b4">当满足后，放入<code class="notion-inline-code">found</code> stash，然后结束符号执行，可以同样声明<code class="notion-inline-code">avoid</code> condition（格式与<code class="notion-inline-code">find</code>相同）</div><div class="notion-text notion-block-14425ac96ea880ba837ec8d575ec8c37"><code class="notion-inline-code">num_find</code>指定return前找到多少数量的<code class="notion-inline-code">find</code>（default = 1，如果所有active stash的state被全部执行则同样return）</div><div class="notion-text notion-block-14425ac96ea880db9bebd43460f816c9">eg.</div><div class="notion-text notion-block-14425ac96ea8803eb047cc9f7ee90c9a">其他样例：<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://docs.angr.io/en/latest/examples.html#angr-examples">angr examples - angr documentation</a></div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea8807a8c31d6449efe6a37" data-id="14425ac96ea8807a8c31d6449efe6a37"><span><div id="14425ac96ea8807a8c31d6449efe6a37" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea8807a8c31d6449efe6a37" title="Exploration Techniques"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Exploration Techniques</span></span></h4><div class="notion-text notion-block-14425ac96ea880f183e3efc197505fe1">angr ships with several pieces of canned functionality that let you customize the behavior of a simulation manager, called <em>exploration techniques</em>. The archetypical example of why you would want an exploration technique is to modify the pattern in which the state space of the program is explored - the default “step everything at once” strategy is effectively breadth-first search, but with an exploration technique you could implement, for example, depth-first search. However, the instrumentation power of these techniques is much more flexible than that - you can totally alter the behavior of angr’s stepping process. Writing your own exploration techniques will be covered in a later chapter.</div><div class="notion-text notion-block-14425ac96ea88078b304f569832867eb">To use an exploration technique, call <code class="notion-inline-code">simgr.use_technique(tech)</code>, where tech is an instance of an ExplorationTechnique subclass. angr’s built-in exploration techniques can be found under <code class="notion-inline-code">angr.exploration_techniques</code>.</div><div class="notion-text notion-block-14425ac96ea880f18a6ef8e674d13b15">Here’s a quick overview of some of the built-in ones:</div><ul class="notion-list notion-list-disc notion-block-14425ac96ea88097b577c10bb1888cd1"><li><em>DFS</em>: Depth first search, as mentioned earlier. Keeps only one state active at once, putting the rest in the <code class="notion-inline-code">deferred</code> stash until it deadends or errors.</li></ul><ul class="notion-list notion-list-disc notion-block-14425ac96ea8808db25dfa1a51078843"><li><em>Explorer</em>: This technique implements the <code class="notion-inline-code">.explore()</code> functionality, allowing you to search for and avoid addresses.</li></ul><ul class="notion-list notion-list-disc notion-block-14425ac96ea88065a296da533132a0e5"><li><em>LengthLimiter</em>: Puts a cap on the maximum length of the path a state goes through.</li></ul><ul class="notion-list notion-list-disc notion-block-14425ac96ea880f4b966c4fa8898a413"><li><em>LoopSeer</em>: Uses a reasonable approximation of loop counting to discard states that appear to be going through a loop too many times, putting them in a <code class="notion-inline-code">spinning</code> stash and pulling them out again if we run out of otherwise viable states.</li></ul><ul class="notion-list notion-list-disc notion-block-14425ac96ea880edbf3de1ca9b958340"><li><em>ManualMergepoint</em>: Marks an address in the program as a merge point, so states that reach that address will be briefly held, and any other states that reach that same point within a timeout will be merged together.</li></ul><ul class="notion-list notion-list-disc notion-block-14425ac96ea8806e8a87cffc5dad4a08"><li><em>MemoryWatcher</em>: Monitors how much memory is free/available on the system between simgr steps and stops exploration if it gets too low.</li></ul><ul class="notion-list notion-list-disc notion-block-14425ac96ea8808da7def4d6037eebf7"><li><em>Oppologist</em>: The “operation apologist” is an especially fun gadget - if this technique is enabled and angr encounters an unsupported instruction, for example a bizzare and foreign floating point SIMD op, it will concretize all the inputs to that instruction and emulate the single instruction using the unicorn engine, allowing execution to continue.</li></ul><ul class="notion-list notion-list-disc notion-block-14425ac96ea88092b775d6617b60023d"><li><em>Spiller</em>: When there are too many states active, this technique can dump some of them to disk in order to keep memory consumption low.</li></ul><ul class="notion-list notion-list-disc notion-block-14425ac96ea880d58025e7e5597d6783"><li><em>Threading</em>: Adds thread-level parallelism to the stepping process. This doesn’t help much because of Python’s global interpreter locks, but if you have a program whose analysis spends a lot of time in angr’s native-code dependencies (unicorn, z3, libvex) you can seem some gains.</li></ul><ul class="notion-list notion-list-disc notion-block-14425ac96ea88080bd51ede0a122a34b"><li><em>Tracer</em>: An exploration technique that causes execution to follow a dynamic trace recorded from some other source. The <a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://github.com/angr/tracer">dynamic tracer repository</a> has some tools to generate those traces.</li></ul><ul class="notion-list notion-list-disc notion-block-14425ac96ea880b2a647e47ec9669615"><li><em>Veritesting</em>: An implementation of a [CMU paper](<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://users.ece.cmu.edu/~dbrumley/pdf/Avgerinos">https://users.ece.cmu.edu/~dbrumley/pdf/Avgerinos</a> et al._2014_Enhancing Symbolic Execution with Veritesting.pdf) on automatically identifying useful merge points. This is so useful, you can enable it automatically with <code class="notion-inline-code">veritesting=True</code> in the SimulationManager constructor! Note that it frequenly doesn’t play nice with other techniques due to the invasive way it implements static symbolic execution.</li></ul><div class="notion-text notion-block-14425ac96ea880d7bd5ef75b595306de">Look at the API documentation for the <code class="notion-inline-code"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://docs.angr.io/en/latest/api.html#angr.sim_manager.SimulationManager">SimulationManager</a></code> and <code class="notion-inline-code"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://docs.angr.io/en/latest/api.html#angr.exploration_techniques.ExplorationTechnique">ExplorationTechnique</a></code> classes for more information.</div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea88025977bf95348c43ae6" data-id="14425ac96ea88025977bf95348c43ae6"><span><div id="14425ac96ea88025977bf95348c43ae6" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea88025977bf95348c43ae6" title="Simulation and Instrumentation"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Simulation and Instrumentation</span></span></h4><table class="notion-simple-table notion-block-14425ac96ea8802ca2bef0f7751d73db"><tbody><tr class="notion-simple-table-row notion-block-14425ac96ea880dda3a5deeba30b6a8f"><td class="" style="width:120px"><div class="notion-simple-table-cell">Attribute</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">Guard Condition</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">Instruction Pointer</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">Description</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea8806f8a3cc5c3487e8a0a"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">successors</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">True (can be symbolic, but constrained to True)</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">Can be symbolic (but 256 solutions or less; see <code class="notion-inline-code">unconstrained_successors</code>).</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">A normal, satisfiable successor state to the state processed by the engine. The instruction pointer of this state may be symbolic (i.e., a computed jump based on user input), so the state might actually represent <em>several</em> potential continuations of execution going forward.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea8807fab6cf541c7a2a6b8"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">unsat_successors</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">False (can be symbolic, but constrained to False).</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">Can be symbolic.</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">Unsatisfiable successors. These are successors whose guard conditions can only be false (i.e., jumps that cannot be taken, or the default branch of jumps that <em>must</em> be taken).</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880b59916d7a82343d5f0"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">flat_successors</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">True (can be symbolic, but constrained to True).</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">Concrete value.</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">As noted above, states in the <code class="notion-inline-code">successors</code> list can have symbolic instruction pointers. This is rather confusing, as elsewhere in the code (i.e., in <code class="notion-inline-code">SimEngineVEX.process</code>, when it’s time to step that state forward), we make assumptions that a single program state only represents the execution of a single spot in the code. To alleviate this, when we encounter states in <code class="notion-inline-code">successors</code> with symbolic instruction pointers, we compute all possible concrete solutions (up to an arbitrary threshold of 256) for them, and make a copy of the state for each such solution. We call this process “flattening”. These <code class="notion-inline-code">flat_successors</code> are states, each of which has a different, concrete instruction pointer. For example, if the instruction pointer of a state in <code class="notion-inline-code">successors</code> was <code class="notion-inline-code">X+5</code>, where <code class="notion-inline-code">X</code> had constraints of <code class="notion-inline-code">X &gt; 0x800000</code> and <code class="notion-inline-code">X &lt;= 0x800010</code>, we would flatten it into 16 different <code class="notion-inline-code">flat_successors</code> states, one with an instruction pointer of <code class="notion-inline-code">0x800006</code>, one with <code class="notion-inline-code">0x800007</code>, and so on until <code class="notion-inline-code">0x800015</code>.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea8808d9722cf2bc13f8fe5"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">unconstrained_successors</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">True (can be symbolic, but constrained to True).</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">Symbolic (with more than 256 solutions).</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">During the flattening procedure described above, if it turns out that there are more than 256 possible solutions for the instruction pointer, we assume that the instruction pointer has been overwritten with unconstrained data (i.e., a stack overflow with user data). <em>This assumption is not sound in general</em>. Such states are placed in <code class="notion-inline-code">unconstrained_successors</code> and not in <code class="notion-inline-code">successors</code>.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880b99bf1ddb9c6e87b90"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">all_successors</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">Anything</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">Can be symbolic.</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">This is <code class="notion-inline-code">successors + unsat_successors + unconstrained_successors</code>.</div></td></tr></tbody></table><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea880fe9b1fff3e76dd36c8" data-id="14425ac96ea880fe9b1fff3e76dd36c8"><span><div id="14425ac96ea880fe9b1fff3e76dd36c8" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea880fe9b1fff3e76dd36c8" title="Breakpoints"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Breakpoints</span></span></h4><table class="notion-simple-table notion-block-14425ac96ea880c1b5b9e9bd1e55ef34"><tbody><tr class="notion-simple-table-row notion-block-14425ac96ea8804892f7f1fd3cf1b2a8"><td class="" style="width:120px"><div class="notion-simple-table-cell">Event type</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">Event meaning</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880b2a72ecd2571372808"><td class="" style="width:120px"><div class="notion-simple-table-cell">mem_read</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">Memory is being read.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea88011a7d9e144d85289e5"><td class="" style="width:120px"><div class="notion-simple-table-cell">mem_write</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">Memory is being written.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880a09b0cf04dd5573c27"><td class="" style="width:120px"><div class="notion-simple-table-cell">address_concretization</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">A symbolic memory access is being resolved.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880a8beb1c1a1dca2a3ff"><td class="" style="width:120px"><div class="notion-simple-table-cell">reg_read</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">A register is being read.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880d6bbb7fe844dbb2add"><td class="" style="width:120px"><div class="notion-simple-table-cell">reg_write</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">A register is being written.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea8808cb5adf82af609d61e"><td class="" style="width:120px"><div class="notion-simple-table-cell">tmp_read</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">A temp is being read.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea88091b66cd3290dd16e7b"><td class="" style="width:120px"><div class="notion-simple-table-cell">tmp_write</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">A temp is being written.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880dc8ad2dcd87fcee2a7"><td class="" style="width:120px"><div class="notion-simple-table-cell">expr</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">An expression is being created (i.e., a result of an arithmetic operation or a constant in the IR).</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880a9a7eff40a704aefc1"><td class="" style="width:120px"><div class="notion-simple-table-cell">statement</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">An IR statement is being translated.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea8801ca800c872d396db38"><td class="" style="width:120px"><div class="notion-simple-table-cell">instruction</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">A new (native) instruction is being translated.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea88087ac13d5fd9da297a9"><td class="" style="width:120px"><div class="notion-simple-table-cell">irsb</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">A new basic block is being translated.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880e6a66be4fb4487240f"><td class="" style="width:120px"><div class="notion-simple-table-cell">constraints</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">New constraints are being added to the state.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea88075a5e5db4f57e7d8d1"><td class="" style="width:120px"><div class="notion-simple-table-cell">exit</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">A successor is being generated from execution.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea88053a62cf3879aab990a"><td class="" style="width:120px"><div class="notion-simple-table-cell">fork</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">A symbolic execution state has forked into multiple states.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea8804bbed0d6ba7c97720a"><td class="" style="width:120px"><div class="notion-simple-table-cell">symbolic_variable</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">A new symbolic variable is being created.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880ffb071d9b3d0286da6"><td class="" style="width:120px"><div class="notion-simple-table-cell">call</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">A call instruction is hit.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880d7bdc6ec0f0b1da653"><td class="" style="width:120px"><div class="notion-simple-table-cell">return</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">A ret instruction is hit.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880b894c8f46d31d0efc8"><td class="" style="width:120px"><div class="notion-simple-table-cell">simprocedure</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">A simprocedure (or syscall) is executed.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea8802589a2c2c41df059d3"><td class="" style="width:120px"><div class="notion-simple-table-cell">dirty</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">A dirty IR callback is executed.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880efb195e6f0d3ca4c89"><td class="" style="width:120px"><div class="notion-simple-table-cell">syscall</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">A syscall is executed (called in addition to the simprocedure event).</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880c09ed7d83ad634850e"><td class="" style="width:120px"><div class="notion-simple-table-cell">engine_process</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">A SimEngine is about to process some code.</div></td></tr></tbody></table><div class="notion-text notion-block-14425ac96ea8803ea968ee36cd4a00ba">These events expose different attributes:</div><table class="notion-simple-table notion-block-14425ac96ea880e0927ff4ec2b05393d"><tbody><tr class="notion-simple-table-row notion-block-14425ac96ea880d3ab89d78d5c9d1c28"><td class="" style="width:120px"><div class="notion-simple-table-cell">Event type</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">Attribute name</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">Attribute availability</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">Attribute meaning</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880ecba6cdfb277f99f70"><td class="" style="width:120px"><div class="notion-simple-table-cell">mem_read</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">mem_read_address</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_BEFORE or BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The address at which memory is being read.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880c3999ded73e4d951da"><td class="" style="width:120px"><div class="notion-simple-table-cell">mem_read</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">mem_read_expr</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The expression at that address.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880f9acdddb4d228638b5"><td class="" style="width:120px"><div class="notion-simple-table-cell">mem_read</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">mem_read_length</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_BEFORE or BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The length of the memory read.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea8809fa15beb76533357c9"><td class="" style="width:120px"><div class="notion-simple-table-cell">mem_read</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">mem_read_condition</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_BEFORE or BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The condition of the memory read.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea88084aabacbdb94b1c9b0"><td class="" style="width:120px"><div class="notion-simple-table-cell">mem_write</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">mem_write_address</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_BEFORE or BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The address at which memory is being written.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880529a5adafed23dba90"><td class="" style="width:120px"><div class="notion-simple-table-cell">mem_write</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">mem_write_length</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_BEFORE or BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The length of the memory write.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea88053a773d5991d4608a7"><td class="" style="width:120px"><div class="notion-simple-table-cell">mem_write</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">mem_write_expr</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_BEFORE or BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The expression that is being written.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880a78ebae7ab3f2be8ff"><td class="" style="width:120px"><div class="notion-simple-table-cell">mem_write</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">mem_write_condition</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_BEFORE or BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The condition of the memory write.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880c68644def5cd893fc2"><td class="" style="width:120px"><div class="notion-simple-table-cell">reg_read</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">reg_read_offset</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_BEFORE or BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The offset of the register being read.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea8808b861edbaacc9f5d51"><td class="" style="width:120px"><div class="notion-simple-table-cell">reg_read</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">reg_read_length</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_BEFORE or BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The length of the register read.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea8806fbb88fc45fa7bcea8"><td class="" style="width:120px"><div class="notion-simple-table-cell">reg_read</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">reg_read_expr</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The expression in the register.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880bf861cc5c890ea7b55"><td class="" style="width:120px"><div class="notion-simple-table-cell">reg_read</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">reg_read_condition</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_BEFORE or BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The condition of the register read.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880fb9919fb6e95da7535"><td class="" style="width:120px"><div class="notion-simple-table-cell">reg_write</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">reg_write_offset</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_BEFORE or BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The offset of the register being written.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880a28d00da20327a855e"><td class="" style="width:120px"><div class="notion-simple-table-cell">reg_write</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">reg_write_length</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_BEFORE or BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The length of the register write.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880519cc6c81d10081805"><td class="" style="width:120px"><div class="notion-simple-table-cell">reg_write</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">reg_write_expr</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_BEFORE or BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The expression that is being written.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880da847bd7f7bc6fc33a"><td class="" style="width:120px"><div class="notion-simple-table-cell">reg_write</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">reg_write_condition</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_BEFORE or BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The condition of the register write.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880009024dc58c900b871"><td class="" style="width:120px"><div class="notion-simple-table-cell">tmp_read</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">tmp_read_num</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_BEFORE or BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The number of the temp being read.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880fb8c1af703a9fddf43"><td class="" style="width:120px"><div class="notion-simple-table-cell">tmp_read</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">tmp_read_expr</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The expression of the temp.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880708909e85b9a02b92c"><td class="" style="width:120px"><div class="notion-simple-table-cell">tmp_write</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">tmp_write_num</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_BEFORE or BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The number of the temp written.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880c69635efc703cc9641"><td class="" style="width:120px"><div class="notion-simple-table-cell">tmp_write</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">tmp_write_expr</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The expression written to the temp.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea8806aa73fe744be056ac2"><td class="" style="width:120px"><div class="notion-simple-table-cell">expr</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">expr</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_BEFORE or BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The IR expression.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880cfa4c1db3d30aaee77"><td class="" style="width:120px"><div class="notion-simple-table-cell">expr</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">expr_result</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The value (e.g. AST) which the expression was evaluated to.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea88031b3ccfe7ddff8c40a"><td class="" style="width:120px"><div class="notion-simple-table-cell">statement</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">statement</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_BEFORE or BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The index of the IR statement (in the IR basic block).</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880a18768e1f7744ac29c"><td class="" style="width:120px"><div class="notion-simple-table-cell">instruction</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">instruction</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_BEFORE or BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The address of the native instruction.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea88065ac6bec8d6229ffba"><td class="" style="width:120px"><div class="notion-simple-table-cell">irsb</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">address</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_BEFORE or BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The address of the basic block.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea8808f8a55f0ba75e2dc05"><td class="" style="width:120px"><div class="notion-simple-table-cell">constraints</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">added_constraints</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_BEFORE or BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The list of constraint expressions being added.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880c7acc4cf41d48e5e6f"><td class="" style="width:120px"><div class="notion-simple-table-cell">call</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">function_address</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_BEFORE or BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The name of the function being called.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880e1af32e6d315007c12"><td class="" style="width:120px"><div class="notion-simple-table-cell">exit</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">exit_target</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_BEFORE or BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The expression representing the target of a SimExit.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880d7bcfcffdd8ccb1604"><td class="" style="width:120px"><div class="notion-simple-table-cell">exit</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">exit_guard</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_BEFORE or BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The expression representing the guard of a SimExit.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea88098b117ef25666bb2f0"><td class="" style="width:120px"><div class="notion-simple-table-cell">exit</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">exit_jumpkind</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_BEFORE or BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The expression representing the kind of SimExit.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880acbd50f4e6dea73b5b"><td class="" style="width:120px"><div class="notion-simple-table-cell">symbolic_variable</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">symbolic_name</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The name of the symbolic variable being created. The solver engine might modify this name (by appending a unique ID and length). Check the symbolic_expr for the final symbolic expression.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea8801d998fd5cd8326b8fb"><td class="" style="width:120px"><div class="notion-simple-table-cell">symbolic_variable</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">symbolic_size</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The size of the symbolic variable being created.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880d68442c9c821caac67"><td class="" style="width:120px"><div class="notion-simple-table-cell">symbolic_variable</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">symbolic_expr</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The expression representing the new symbolic variable.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea88042bc89d1e92185dc1b"><td class="" style="width:120px"><div class="notion-simple-table-cell">address_concretization</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">address_concretization_strategy</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_BEFORE or BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The SimConcretizationStrategy being used to resolve the address. This can be modified by the breakpoint handler to change the strategy that will be applied. If your breakpoint handler sets this to None, this strategy will be skipped.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880db8566c06793bb45d7"><td class="" style="width:120px"><div class="notion-simple-table-cell">address_concretization</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">address_concretization_action</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_BEFORE or BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The SimAction object being used to record the memory action.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880788744db1c6a7a9081"><td class="" style="width:120px"><div class="notion-simple-table-cell">address_concretization</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">address_concretization_memory</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_BEFORE or BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The SimMemory object on which the action was taken.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880dc81c5d081f80efc7c"><td class="" style="width:120px"><div class="notion-simple-table-cell">address_concretization</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">address_concretization_expr</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_BEFORE or BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The AST representing the memory index being resolved. The breakpoint handler can modify this to affect the address being resolved.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea88044ae7bfacd5b148788"><td class="" style="width:120px"><div class="notion-simple-table-cell">address_concretization</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">address_concretization_add_constraints</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_BEFORE or BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">Whether or not constraints should/will be added for this read.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880ab8efbcd115e04d702"><td class="" style="width:120px"><div class="notion-simple-table-cell">address_concretization</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">address_concretization_result</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The list of resolved memory addresses (integers). The breakpoint handler can overwrite these to effect a different resolution result.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea88033bf51c853059ed174"><td class="" style="width:120px"><div class="notion-simple-table-cell">syscall</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">syscall_name</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_BEFORE or BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The name of the system call.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea88078a442e3e3c25267ea"><td class="" style="width:120px"><div class="notion-simple-table-cell">simprocedure</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">simprocedure_name</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_BEFORE or BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The name of the simprocedure.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea8800584e6d653d6c83b2b"><td class="" style="width:120px"><div class="notion-simple-table-cell">simprocedure</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">simprocedure_addr</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_BEFORE or BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The address of the simprocedure.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880408047e1e3e507c174"><td class="" style="width:120px"><div class="notion-simple-table-cell">simprocedure</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">simprocedure_result</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The return value of the simprocedure. You can also <em>override</em> it in BP_BEFORE, which will cause the actual simprocedure to be skipped and for your return value to be used instead.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea8807e900ff954fc1394ca"><td class="" style="width:120px"><div class="notion-simple-table-cell">simprocedure</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">simprocedure</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_BEFORE or BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The actual SimProcedure object.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea8800d8fd4eea4cbc8854e"><td class="" style="width:120px"><div class="notion-simple-table-cell">dirty</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">dirty_name</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_BEFORE or BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The name of the dirty call.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880d5bbb7eb8fce4e39db"><td class="" style="width:120px"><div class="notion-simple-table-cell">dirty</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">dirty_handler</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_BEFORE</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The function that will be run to handle the dirty call. You can override this.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880318010c2e919c576df"><td class="" style="width:120px"><div class="notion-simple-table-cell">dirty</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">dirty_args</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_BEFORE or BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The address of the dirty.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea88095bac6cd4ffaa88db3"><td class="" style="width:120px"><div class="notion-simple-table-cell">dirty</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">dirty_result</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The return value of the dirty call. You can also <em>override</em> it in BP_BEFORE, which will cause the actual dirty call to be skipped and for your return value to be used instead.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880fdb2b6e88224887f48"><td class="" style="width:120px"><div class="notion-simple-table-cell">engine_process</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">sim_engine</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_BEFORE or BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The SimEngine that is processing.</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea8802c95dbdbcee99a3602"><td class="" style="width:120px"><div class="notion-simple-table-cell">engine_process</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">successors</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">BP_BEFORE or BP_AFTER</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">The SimSuccessors object defining the result of the engine.</div></td></tr></tbody></table><div class="notion-text notion-block-14425ac96ea880fb92dff835ea9524c4">eg. 每当程序状态<code class="notion-inline-code">s</code>执行内存读取时，<code class="notion-inline-code">angr</code>都会在读取完成后立即调用<code class="notion-inline-code">track_reads</code>，打印出读取的值和发生读取的内存地址。</div><div class="notion-text notion-block-14425ac96ea8809b958ffc626fb9034e">声明函数作为condition</div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea88042901bd0e73b116829" data-id="14425ac96ea88042901bd0e73b116829"><span><div id="14425ac96ea88042901bd0e73b116829" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea88042901bd0e73b116829" title="Caution about mem_read breakpoint"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Caution about <code class="notion-inline-code">mem_read</code> breakpoint</span></span></h4><div class="notion-text notion-block-14425ac96ea880538624ed5236624874">The <code class="notion-inline-code">mem_read</code> breakpoint gets triggered anytime there are memory reads by either the executing program or the binary analysis. If you are using breakpoint on <code class="notion-inline-code">mem_read</code> and also using <code class="notion-inline-code">state.mem</code> to load data from memory addresses, then know that the breakpoint will be fired as you are technically reading memory.</div><div class="notion-text notion-block-14425ac96ea8805e9542e7d67aff47ce">So if you want to load data from memory and not trigger any <code class="notion-inline-code">mem_read</code> breakpoint you have had set up, then use <code class="notion-inline-code">state.memory.load</code> with the keyword arguments <code class="notion-inline-code">disable_actions=True</code> and <code class="notion-inline-code">inspect=False</code>.</div><div class="notion-text notion-block-14425ac96ea88031bc22e5e1ab455c9d">This is also true for <code class="notion-inline-code">state.find</code> and you can use the same keyword arguments to prevent <code class="notion-inline-code">mem_read</code> breakpoints from firing.</div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea880219b3ad91a7882763f" data-id="14425ac96ea880219b3ad91a7882763f"><span><div id="14425ac96ea880219b3ad91a7882763f" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea880219b3ad91a7882763f" title="Analyses"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Analyses</span></span></h4><div class="notion-text notion-block-14425ac96ea880da8710e59a88084006"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://docs.angr.io/en/latest/extending-angr/analysis_writing.html#writing-analyses">Writing Analyses - angr documentation</a></div><div class="notion-text notion-block-14425ac96ea880e7804fddc1a05d71a5">the idea is that all the analyses appear under <code class="notion-inline-code">project.analyses</code> (for example, <code class="notion-inline-code">project.analyses.CFGFast()</code>) and can be called as functions, returning analysis result instances.</div><table class="notion-simple-table notion-block-14425ac96ea880c3bca9dd1813d3fda3"><tbody><tr class="notion-simple-table-row notion-block-14425ac96ea880818f8cefbf0c681b6b"><td class="" style="width:120px"><div class="notion-simple-table-cell">Name</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">Description</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea88032a4d7cac279ddca60"><td class="" style="width:120px"><div class="notion-simple-table-cell">CFGFast</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">Constructs a fast <em>Control Flow Graph</em> of the program</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea88075a240f5f1149e2f06"><td class="" style="width:120px"><div class="notion-simple-table-cell">CFGEmulated</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">Constructs an accurate <em>Control Flow Graph</em> of the program</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea880e1b8cafea0c1b796ea"><td class="" style="width:120px"><div class="notion-simple-table-cell">VFG</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">Performs VSA on every function of the program, creating a <em>Value Flow Graph</em> and detecting stack variables</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea88052b160eb3866b64070"><td class="" style="width:120px"><div class="notion-simple-table-cell">DDG</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">Calculates a <em>Data Dependency Graph</em>, allowing one to determine what statements a given value depends on</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea8803e9b15e29505510ebc"><td class="" style="width:120px"><div class="notion-simple-table-cell">BackwardSlice</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">Computes a <em>Backward Slice</em> of a program with respect to a certain target</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea88027ae43c744d5b9438e"><td class="" style="width:120px"><div class="notion-simple-table-cell">Identifier</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">Identifies common library functions in CGC binaries</div></td></tr><tr class="notion-simple-table-row notion-block-14425ac96ea88045bae8c75313a8a38d"><td class="" style="width:120px"><div class="notion-simple-table-cell">More!</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">angr has quite a few analyses, most of which work! If you’d like to know how to use one, please submit an issue requesting documentation.</div></td></tr></tbody></table><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea880f78a97f4a33c5d2b09" data-id="14425ac96ea880f78a97f4a33c5d2b09"><span><div id="14425ac96ea880f78a97f4a33c5d2b09" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea880f78a97f4a33c5d2b09" title="Resilience"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Resilience</span></span></h4><div class="notion-text notion-block-14425ac96ea8806cb0bbcfe5c71fc7f1">Analyses can be written to be resilient, and catch and log basically any error. These errors, depending on how they’re caught, are logged to the <code class="notion-inline-code">errors</code> or <code class="notion-inline-code">named_errors</code> attribute of the analysis. However, you might want to run an analysis in “fail fast” mode, so that errors are not handled. To do this, the argument <code class="notion-inline-code">fail_fast=True</code> can be passed into the analysis constructor.</div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea88039a2a0ed521789dd44" data-id="14425ac96ea88039a2a0ed521789dd44"><span><div id="14425ac96ea88039a2a0ed521789dd44" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea88039a2a0ed521789dd44" title="Symbolic Execution"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Symbolic Execution</span></span></h4><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea880ecaad3d571af0fc1e1" data-id="14425ac96ea880ecaad3d571af0fc1e1"><span><div id="14425ac96ea880ecaad3d571af0fc1e1" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea880ecaad3d571af0fc1e1" title="为什么这里是todo..."><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">为什么这里是todo...</span></span></h4><div class="notion-text notion-block-14425ac96ea8808d90ebe8a883d79e5f"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://docs.angr.io/en/latest/core-concepts/symbolic.html">Symbolic Execution - angr documentation</a></div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea8804585d3c0fbd1fcb5af" data-id="14425ac96ea8804585d3c0fbd1fcb5af"><span><div id="14425ac96ea8804585d3c0fbd1fcb5af" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea8804585d3c0fbd1fcb5af" title="angr_ctf"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">angr_ctf</span></span></h4><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea880128fedcc0ad727ea98" data-id="14425ac96ea880128fedcc0ad727ea98"><span><div id="14425ac96ea880128fedcc0ad727ea98" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea880128fedcc0ad727ea98" title="官方给的样例，文档里还有很多真实ctf比赛的例题orz，初探就做到这里吧"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">官方给的样例，文档里还有很多真实ctf比赛的例题orz，初探就做到这里吧</span></span></h4><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea8806190b5c31e9bbb4016" data-id="14425ac96ea8806190b5c31e9bbb4016"><span><div id="14425ac96ea8806190b5c31e9bbb4016" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea8806190b5c31e9bbb4016" title="环境配置"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">环境配置</span></span></h4><div class="notion-text notion-block-14425ac96ea8803d9537e9ff71dd866a">添加环境变量：</div><div class="notion-text notion-block-14425ac96ea88012a529c974c8806cb0">支持编译32位程序包：</div><div class="notion-text notion-block-14425ac96ea880e78b9be9dcae347a1a">生成可执行程序</div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea880c5a197efeab54c63b3" data-id="14425ac96ea880c5a197efeab54c63b3"><span><div id="14425ac96ea880c5a197efeab54c63b3" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea880c5a197efeab54c63b3" title="00_angr_find"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">00_angr_find</span></span></h4><div class="notion-text notion-block-14425ac96ea880a2b3b3f39cd5d4a622">直接找对应标准输出的输入即可</div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea880a980b2eff2625323a1" data-id="14425ac96ea880a980b2eff2625323a1"><span><div id="14425ac96ea880a980b2eff2625323a1" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea880a980b2eff2625323a1" title="01_angr_avoid"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">01_angr_avoid</span></span></h4><div class="notion-text notion-block-14425ac96ea880faa630e481e5620aa8">main函数的节点过多</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-14425ac96ea880c4b15ae9a846e2adbc"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Fec8fd2f2-1649-4985-8970-ff7b57d45517%2F958dbeec-637a-4273-80b4-873786684514%2Fimage.png?table=block&amp;id=14425ac9-6ea8-80c4-b15a-e9a846e2adbc&amp;t=14425ac9-6ea8-80c4-b15a-e9a846e2adbc&amp;width=461.74603271484375&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-14425ac96ea880f28a2dc599711ddb39">可以看到<code class="notion-inline-code">avoid_me</code>函数被大量调用</div><div class="notion-text notion-block-14425ac96ea8802391c0e0cc27d81c0d">这里需要让angr走到<code class="notion-inline-code">avoid_me</code>函数后就剪枝</div><div class="notion-text notion-block-14425ac96ea880869936f2bbe517b716">可以使用函数传入所有需要avoid的状态</div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea88045b02be2ae34cf3f31" data-id="14425ac96ea88045b02be2ae34cf3f31"><span><div id="14425ac96ea88045b02be2ae34cf3f31" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea88045b02be2ae34cf3f31" title="02_angr_find_condition"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">02_angr_find_condition</span></span></h4><div class="notion-text notion-block-14425ac96ea88072896ef989c8166283">和上面一样</div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea8800ca644d67822fe603d" data-id="14425ac96ea8800ca644d67822fe603d"><span><div id="14425ac96ea8800ca644d67822fe603d" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea8800ca644d67822fe603d" title="03_angr_symbolic_registers"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">03_angr_symbolic_registers</span></span></h4><div class="notion-text notion-block-14425ac96ea880ae96cee9db6892490c">和上面一样可以打通</div><div class="notion-text notion-block-14425ac96ea88018a3aef262e22100dc">不过官方exp是打算让分段打（yysy，看起来没啥用，也就是省去了初始化的一些时间，不会优化太多）：</div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea8807baeccd366b3903777" data-id="14425ac96ea8807baeccd366b3903777"><span><div id="14425ac96ea8807baeccd366b3903777" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea8807baeccd366b3903777" title="04_angr_symbolic_stack"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">04_angr_symbolic_stack</span></span></h4><div class="notion-text notion-block-14425ac96ea880e4a10cf1fd2e63bd4f">老exp还是可以打通.....不过官方exp是要求把栈模拟一下的，贴一下先</div><div class="notion-text notion-block-14425ac96ea880048782e7aacc76a6be">分析一下：</div><div class="notion-text notion-block-14425ac96ea8806c8b02d376e13ac5f7">主要是这里：</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-14425ac96ea88003a8eeed86d5a399f3"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Fec8fd2f2-1649-4985-8970-ff7b57d45517%2Fb188b4e7-53ea-49db-b63d-a20c97536b03%2Fimage.png?table=block&amp;id=14425ac9-6ea8-8003-a8ee-ed86d5a399f3&amp;t=14425ac9-6ea8-8003-a8ee-ed86d5a399f3&amp;width=709.9801635742188&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-14425ac96ea88036898ae13fe7a7a4f6">实际上就是找到栈上的参数，用于做初始化状态，再进行符号执行</div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea8805590d6eb0a2ef83b1a" data-id="14425ac96ea8805590d6eb0a2ef83b1a"><span><div id="14425ac96ea8805590d6eb0a2ef83b1a" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea8805590d6eb0a2ef83b1a" title="05_angr_symbolic_memory"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">05_angr_symbolic_memory</span></span></h4><div class="notion-text notion-block-14425ac96ea8808eb176d2b4fcc4dcbf">对应到全局变量的方法</div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea880c2a669e5d011db1df4" data-id="14425ac96ea880c2a669e5d011db1df4"><span><div id="14425ac96ea880c2a669e5d011db1df4" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea880c2a669e5d011db1df4" title="06_angr_symbolic_dynamic_memory"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">06_angr_symbolic_dynamic_memory</span></span></h4><div class="notion-text notion-block-14425ac96ea880c49a68f6197d8b9c0e"><s>最早的仍旧能打通</s></div><div class="notion-text notion-block-14425ac96ea880959150cc9b0ed9f22d">不过这题主要还是教你把堆模拟（分配未分配过的内存即可）</div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea880dbbfe1de0745f147d1" data-id="14425ac96ea880dbbfe1de0745f147d1"><span><div id="14425ac96ea880dbbfe1de0745f147d1" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea880dbbfe1de0745f147d1" title="07_angr_symbolic_file"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">07_angr_symbolic_file</span></span></h4><div class="notion-text notion-block-14425ac96ea880b5894cf18f674279cc"><s>最早的仍旧能打通，而且官方的反而打不通ee</s></div><div class="notion-text notion-block-14425ac96ea880e78fc2f5662a175884">还是贴一个官方的吧，其实就是教怎么模拟文件</div><div class="notion-text notion-block-14425ac96ea88059a86ecd2859c33b6c">ps. 找到issue了：</div><div class="notion-text notion-block-14425ac96ea880d5a6cee18b55084a80">Scaffold and solution challenge 07 are not working with latest angr, because SimFile class changed.</div><div class="notion-text notion-block-14425ac96ea880d4a0a5d78ee94fda65">This is working code with latest version of angr for the filesystem part:</div><div class="notion-text notion-block-14425ac96ea880af8b4ed8e7d1727e82">TODO：改了issue仍旧打不通</div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea8809e912ac37a6e840d72" data-id="14425ac96ea8809e912ac37a6e840d72"><span><div id="14425ac96ea8809e912ac37a6e840d72" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea8809e912ac37a6e840d72" title="08_angr_constraints"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">08_angr_constraints</span></span></h4><div class="notion-text notion-block-14425ac96ea8804c84faf057c15cdd7d"><s>老exp打不通了，好耶（什）</s></div><div class="notion-text notion-block-14425ac96ea88034bf0ef2c7f4d5daa1">原理：</div><div class="notion-text notion-block-14425ac96ea88003b251fed6b6964a4c">TODO：这里尝试过在check的jnz地址处对zf寄存器状态做剪枝，也跑不出来，后续看看为啥</div><div class="notion-text notion-block-14425ac96ea8808e92b5d2862bad74a2">官方给的解法是手动获取模拟比较（设置终止状态在真正的check之前，然后手动设置比较），将其转化为constraint，约束求解得到最终结果，贴一个吧先：</div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea880169117dec19c10a3d5" data-id="14425ac96ea880169117dec19c10a3d5"><span><div id="14425ac96ea880169117dec19c10a3d5" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea880169117dec19c10a3d5" title="09_angr_hooks"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">09_angr_hooks</span></span></h4><div class="notion-text notion-block-14425ac96ea8809cb5f7e15a91f1a8e7"><s>他说要hook，但是我强行给他分段打通楽（什）</s></div><div class="notion-text notion-block-14425ac96ea8803f91e9f483e2e1d21f">一开始写的exp（注意给password初始值写上，开始的时候忘了）可以打通</div><div class="notion-text notion-block-14425ac96ea880408249d1ff181d1c37">然后看看官方怎么hook的</div><div class="notion-text notion-block-14425ac96ea880aeba67c0281dd17fd9">结论是这么写将中间那个过不去的函数转化为手动的check，那比上一个的做法还简洁点点</div><div class="notion-text notion-block-14425ac96ea8804b8e53fdd6b066748e">主要就是这里：</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-14425ac96ea880ba9e7bc2d58e7337e0"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Fec8fd2f2-1649-4985-8970-ff7b57d45517%2F0a7aa8f8-677a-482f-a43a-c2b175bc71d2%2Fimage.png?table=block&amp;id=14425ac9-6ea8-80ba-9e7b-c2d58e7337e0&amp;t=14425ac9-6ea8-80ba-9e7b-c2d58e7337e0&amp;width=461.7658996582031&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-14425ac96ea880638088f23c60fc618e">直接贴一个：</div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea88095bf36dd217c2f364d" data-id="14425ac96ea88095bf36dd217c2f364d"><span><div id="14425ac96ea88095bf36dd217c2f364d" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea88095bf36dd217c2f364d" title="10_angr_simprocedures"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">10_angr_simprocedures</span></span></h4><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-14425ac96ea88079b8d4c86e0b518d2b"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:415.97222900390625px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Fec8fd2f2-1649-4985-8970-ff7b57d45517%2Fb368b043-6096-4e9c-8e90-db11102abe30%2Fimage.png?table=block&amp;id=14425ac9-6ea8-8079-b8d4-c86e0b518d2b&amp;t=14425ac9-6ea8-8079-b8d4-c86e0b518d2b&amp;width=415.97222900390625&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-14425ac96ea8804b9731eee600f45d96">将check部分的basic block拆了很多很多，看源码是加了不透明谓词和分发块：</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-14425ac96ea88077a17cec69fee36be5"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Fec8fd2f2-1649-4985-8970-ff7b57d45517%2F7519f42f-e2a7-48db-875a-5db27f16cca7%2Fimage.png?table=block&amp;id=14425ac9-6ea8-8077-a17c-ec69fee36be5&amp;t=14425ac9-6ea8-8077-a17c-ec69fee36be5&amp;width=461.74603271484375&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-14425ac96ea8803881a8fec5c2baf667">ida做了的伪代码做了代码优化，看起来其实和前面两个题差不多</div><div class="notion-text notion-block-14425ac96ea8808dbf88e08e6e4e3021">但是下面这种写法不行，不知道是为啥不能这样hook，这样hook的话约束不出来解：</div><div class="notion-text notion-block-14425ac96ea880a6ba11e82a3358a6ea">（先hook找输入的地址，然后手写check，但是约束不出来，跑出来空解）</div><div class="notion-text notion-block-14425ac96ea8801e94bddc7e0c3d49c2">看看官方的吧：</div><div class="notion-text notion-block-14425ac96ea880cb8741f7a80724d059">定义一个类，遇到check函数后直接hook并且跳过</div><div class="notion-text notion-block-14425ac96ea880809400daf5eae100f6">简写<s>偷</s>一个，方便看：</div><div class="notion-text notion-block-14425ac96ea880348662fcd7f13e3a51"><s>所以为啥我的跑不通</s></div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea880dbad6ccfe5d9718afd" data-id="14425ac96ea880dbad6ccfe5d9718afd"><span><div id="14425ac96ea880dbad6ccfe5d9718afd" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea880dbad6ccfe5d9718afd" title="11_angr_sim_scanf"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">11_angr_sim_scanf</span></span></h4><div class="notion-text notion-block-14425ac96ea880ae8c38d32c1a6e5e04">看起来比上个还过分一点</div><div class="notion-text notion-block-14425ac96ea8804b8af5e4c763ed7556">看起来是很多<code class="notion-inline-code">scanf</code>了</div><div class="notion-text notion-block-14425ac96ea880b084f1c0af2db6425f">这个从源程序看起来可以直接手动check秒掉，还是小写一个</div><div class="notion-text notion-block-14425ac96ea880a4a34fe0d20d6c1c9b">（然后其实check也是不必要的，就这样hook就行）</div><div class="notion-text notion-block-14425ac96ea880f8abf3c3d09eb0fa84">来看看这题想考怎么个事</div><div class="notion-text notion-block-14425ac96ea880919ef0e7c3e48ec2ec">结果</div><div class="notion-text notion-block-14425ac96ea880bf8e19f28cb9f11cb8">其实可以打通的，结论是angr在不断进步~~，楽~~</div><div class="notion-text notion-block-14425ac96ea880889970e8192b4538c0">不过这题还是想跟你说说hook系统函数的方法，其实也就是hook一下符号</div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea880189083cd011444d89c" data-id="14425ac96ea880189083cd011444d89c"><span><div id="14425ac96ea880189083cd011444d89c" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea880189083cd011444d89c" title="12_angr_veritesting"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">12_angr_veritesting</span></span></h4><div class="notion-text notion-block-14425ac96ea880468c2dc08fe0a9f46a">？？？为什么又hook不成功了（这里因为代码又变了，想做一些新的尝试）</div><div class="notion-text notion-block-14425ac96ea880e8b753f169acb1be7c">↓失败的代码</div><div class="notion-text notion-block-14425ac96ea880338c12ea3f778c7f3f">这里进行一点debug看看...</div><div class="notion-text notion-block-14425ac96ea88056940ae5d4f770e4fe">修改代码如下：</div><div class="notion-text notion-block-14425ac96ea880e996dbd6323cdc2380">打印的内容如下：</div><div class="notion-text notion-block-14425ac96ea88098811eec9cc01f5a69">实际上，这里去重之后就是正确答案了，说明这里出现了路径爆炸，在某个地方被分化，stash内路径数量翻倍了，导致每次bfs路径都幂指数上升了</div><div class="notion-text notion-block-14425ac96ea880eebdebd5936f11b36a">猜测是因为输入的不确定，在赋值的时候就需要hook掉，把这段补上（打印stash的长度看眼）：</div><div class="notion-text notion-block-14425ac96ea880188069eb7b16aabb49">看一下目前hook后剩下的代码（ida中patch替代）</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-14425ac96ea880f38122d52e996885f0"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Fec8fd2f2-1649-4985-8970-ff7b57d45517%2Fbcc704b2-d56b-4f2d-be49-25be4acac680%2Fimage.png?table=block&amp;id=14425ac9-6ea8-80f3-8122-d52e996885f0&amp;t=14425ac9-6ea8-80f3-8122-d52e996885f0&amp;width=709.9801635742188&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-14425ac96ea880e68ecfc4316d8a5f1c">晚上睡前想着，会不会是循环的时候<code class="notion-inline-code">jle</code>给分化出来了stash，但是早起看了眼前面的程序，也是循环应该没有问题的</div><div class="notion-text notion-block-14425ac96ea880f1a982c6bc0141c00e">加上上面又hook的代码，输出大约如下：</div><div class="notion-text notion-block-14425ac96ea880e59157d7ca11ddbdf2">结果stash长度并没有变化，但是仍旧有路径分化的现象，这就有些闹鬼了</div><div class="notion-text notion-block-14425ac96ea88072a759fe2722cf32a6">打在上面看看：</div><div class="notion-text notion-block-14425ac96ea8804e9ddff72f9cef9cd0">结论是stash还是9，为啥9啊，整个程序才9个<code class="notion-inline-code">basic block</code>，结束地址前面已经不存在分支了</div><div class="notion-text notion-block-14425ac96ea880d6ba3aeead36c96122">这里直接从scanf后面开始<code class="notion-inline-code">init blank_state</code>也是一样的结果，说明不是<code class="notion-inline-code">scanf</code>或者环境变量传入的问题</div><div class="notion-text notion-block-14425ac96ea88034bcb0d5ae40a12393">问了r1mao学长，发现这里对<code class="notion-inline-code">stash</code>和<code class="notion-inline-code">state</code>的理解有点问题了：</div><div class="notion-text notion-block-14425ac96ea880da819dd24bd78954c3">state会分在不同types的stash，如果这里打印<code class="notion-inline-code">simulation.active</code>的话，得到的就是当前的state数量，和执行的重复数量结果是一致的</div><div class="notion-text notion-block-14425ac96ea88045bf07e15584457fe3">打印一下stash 和 state的结构
实际上是这样子的</div><div class="notion-text notion-block-14425ac96ea880b1ad25f12b070e4dad">所以应该这样子用：</div><div class="notion-text notion-block-14425ac96ea88029b364ce9433cd02cc">检查一下是不是<code class="notion-inline-code">jle</code>惹的锅</div><div class="notion-text notion-block-14425ac96ea8804195a3cf1bd9156ce8">同理，只剩一个地方了...</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-14425ac96ea8804092f3d9a193be337a"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Fec8fd2f2-1649-4985-8970-ff7b57d45517%2F4aca23a5-8188-4c23-a1fc-df4fe8957b97%2Fimage.png?table=block&amp;id=14425ac9-6ea8-8040-92f3-d9a193be337a&amp;t=14425ac9-6ea8-8040-92f3-d9a193be337a&amp;width=2242&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-14425ac96ea88031a7bcf412ce9aa171">这下赛博鬼抓到了...hook以后机器指令没跳过去...</div><div class="notion-text notion-block-14425ac96ea880749235f58e8b1663e3">ok，找到了，语法错误，也没报...</div><div class="notion-text notion-block-14425ac96ea880f88a6ada354e5f01dd">exp：</div><div class="notion-text notion-block-14425ac96ea880199d03fcd275296e83">还是看看官方吧，虽然被折磨了一把...</div><div class="notion-text notion-block-14425ac96ea880d89d09ef36343aaff8">这里是想教你用<code class="notion-inline-code">veritesting</code>，这样子<code class="notion-inline-code">veritesting=True</code>即可</div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea88096b27efd684b44f250" data-id="14425ac96ea88096b27efd684b44f250"><span><div id="14425ac96ea88096b27efd684b44f250" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea88096b27efd684b44f250" title="13_angr_static_binary"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">13_angr_static_binary</span></span></h4><div class="notion-text notion-block-14425ac96ea880c79c09f1b1ac79d832">可以看到原本的<code class="notion-inline-code">strcmp</code>函数被分解成了很复杂的样子，会导致angr陷进去出不来了，其他库函数也一样</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-14425ac96ea880098296e2b8481a276d"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Fec8fd2f2-1649-4985-8970-ff7b57d45517%2F3b655b99-362f-4c51-ad6c-ffbea293782a%2Fimage.png?table=block&amp;id=14425ac9-6ea8-8009-8296-e2b8481a276d&amp;t=14425ac9-6ea8-8009-8296-e2b8481a276d&amp;width=461.7658996582031&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-14425ac96ea8803883ddd2dce42afd8f">这里是编译时加了静态链接的参数导致的</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-14425ac96ea8806ba640f86a226fc5a7"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Fec8fd2f2-1649-4985-8970-ff7b57d45517%2Fc7b1f115-9cfc-49e2-8ef8-dadca22db727%2Fimage.png?table=block&amp;id=14425ac9-6ea8-806b-a640-f86a226fc5a7&amp;t=14425ac9-6ea8-806b-a640-f86a226fc5a7&amp;width=709.9702758789062&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-14425ac96ea8804e90c2ecfbc8a45bdd">把系统函数hook掉换成libc和glibc里的标准符号即可</div><h4 class="notion-h notion-h3 notion-h-indent-0 notion-block-14425ac96ea88004b668cdc408ec82d7" data-id="14425ac96ea88004b668cdc408ec82d7"><span><div id="14425ac96ea88004b668cdc408ec82d7" class="notion-header-anchor"></div><a class="notion-hash-link" href="#14425ac96ea88004b668cdc408ec82d7" title="14_angr_shared_library"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">14_angr_shared_library</span></span></h4><div class="notion-text notion-block-14425ac96ea880909492c9763900d8f6">坏了，这题目编译不明白了开始</div><div class="notion-text notion-block-14425ac96ea880fc8a19ee66a699e601"><s>直接gh上拿了...懒得研究了...</s></div><div class="notion-text notion-block-14425ac96ea8806bb96afe823e86477b">从so里面导入的check：</div><div class="notion-text notion-block-14425ac96ea88056970bdec0675090e5">直接看官方exp吧（也就是做了个模拟，不过这个挺经典的感觉，后面单独模拟函数会很用得上）：</div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[mingw启动项学习]]></title>
            <link>https://moyaoxue.de/article/15e25ac9-6ea8-80d2-a57e-c55a9aa76a63</link>
            <guid>https://moyaoxue.de/article/15e25ac9-6ea8-80d2-a57e-c55a9aa76a63</guid>
            <pubDate>Mon, 16 Dec 2024 00:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-15e25ac96ea880d2a57ec55a9aa76a63"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><div class="notion-callout notion-gray_background_co notion-block-15e25ac96ea8818fa1dae90c625ce4ff"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="💫">💫</span></div><div class="notion-callout-text">感觉网上没啥人做，突然有点兴趣稍微看看</div></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-15e25ac96ea88068a1fae53abea5c9a9" data-id="15e25ac96ea88068a1fae53abea5c9a9"><span><div id="15e25ac96ea88068a1fae53abea5c9a9" class="notion-header-anchor"></div><a class="notion-hash-link" href="#15e25ac96ea88068a1fae53abea5c9a9" title="版本"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">版本</span></span></h2><div class="notion-text notion-block-15e25ac96ea88078aeaec63e717a0913">mingw-w64-v11.0.0</div><div class="notion-text notion-block-15e25ac96ea880e1b04af82e7ccec7bd">源码这里下载：<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://www.mingw-w64.org/downloads/#sources">https://www.mingw-w64.org/downloads/#sources</a></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-15e25ac96ea880f49e50f0b59d4e8422" data-id="15e25ac96ea880f49e50f0b59d4e8422"><span><div id="15e25ac96ea880f49e50f0b59d4e8422" class="notion-header-anchor"></div><a class="notion-hash-link" href="#15e25ac96ea880f49e50f0b59d4e8422" title="分析"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">分析</span></span></h2><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-15e25ac96ea880ab8c9ffbfb42a1c9eb" data-id="15e25ac96ea880ab8c9ffbfb42a1c9eb"><span><div id="15e25ac96ea880ab8c9ffbfb42a1c9eb" class="notion-header-anchor"></div><a class="notion-hash-link" href="#15e25ac96ea880ab8c9ffbfb42a1c9eb" title="入口"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">入口</span></span></h3><div class="notion-text notion-block-15e25ac96ea880a18dc9c9ec94ef6de4">拿到一个mingw编译的程序，入口点大概长这样：</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-15e25ac96ea88084a736cdc434829326"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Fec8fd2f2-1649-4985-8970-ff7b57d45517%2F7d5a33a3-bf01-4f7f-8bfe-32c2b70ad3b7%2Fimage.png?table=block&amp;id=15e25ac9-6ea8-8084-a736-cdc434829326&amp;t=15e25ac9-6ea8-8084-a736-cdc434829326&amp;width=707.9761962890625&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-15e25ac96ea8802c8909e61d44b5e5db">一般有两个tlscallback和一个maincrtstartup</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-15e25ac96ea88025a78af6cad471af58" data-id="15e25ac96ea88025a78af6cad471af58"><span><div id="15e25ac96ea88025a78af6cad471af58" class="notion-header-anchor"></div><a class="notion-hash-link" href="#15e25ac96ea88025a78af6cad471af58" title="TlsCallback"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">TlsCallback</span></span></h3><div class="notion-text notion-block-15e25ac96ea880a788deefc848f7d383">带符号的情况下我们可以查看到其分别是_dyn_tls_init函数和_dyn_tls_dtor函数</div><div class="notion-text notion-block-15e25ac96ea880028b26ffbf9456a729">TlsCallback0</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-15e25ac96ea880ceb637c43a957e5fea"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Fec8fd2f2-1649-4985-8970-ff7b57d45517%2F57ff8e72-79e4-40f7-8083-65b957fdc7c2%2Fimage.png?table=block&amp;id=15e25ac9-6ea8-80ce-b637-c43a957e5fea&amp;t=15e25ac9-6ea8-80ce-b637-c43a957e5fea&amp;width=707.9861450195312&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-15e25ac96ea880f7aa55c6feca86d58b">TlsCallback1</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-15e25ac96ea88097a389f6d737f0dd3d"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Fec8fd2f2-1649-4985-8970-ff7b57d45517%2F25eb5067-063d-4fd1-bdb2-62f3c383bfd5%2Fimage.png?table=block&amp;id=15e25ac9-6ea8-8097-a389-f6d737f0dd3d&amp;t=15e25ac9-6ea8-8097-a389-f6d737f0dd3d&amp;width=707.9861450195312&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-blank notion-block-15e25ac96ea880eca42ed37399360dfc"> </div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-15e25ac96ea880b6a214da6796108e23" data-id="15e25ac96ea880b6a214da6796108e23"><span><div id="15e25ac96ea880b6a214da6796108e23" class="notion-header-anchor"></div><a class="notion-hash-link" href="#15e25ac96ea880b6a214da6796108e23" title="_dyn_tls_init"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">_dyn_tls_init</span></span></h4><div class="notion-text notion-block-15e25ac96ea880e586e9f7eb0a8fefbd">先看源码：</div><div class="notion-text notion-block-15e25ac96ea8808a84f6e91014d90d0f">核心是调用了__mingw_TLScallback 函数</div><div class="notion-blank notion-block-15e25ac96ea880579587f9bb8c31ffad"> </div><div class="notion-text notion-block-15e25ac96ea880358ad4f101ad74e02a">这里需要知道：<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://zh.wikipedia.org/zh-cn/%E7%BA%96%E7%A8%8B">纤程 - 维基百科，自由的百科全书</a> ：<b>纤程</b>（英语：Fiber）是一种最轻量化的<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://zh.wikipedia.org/wiki/%E7%BA%BF%E7%A8%8B">线程</a>（lightweight threads）。它是一种用户态线程（user thread），让<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://zh.wikipedia.org/wiki/%E6%87%89%E7%94%A8%E7%A8%8B%E5%BC%8F">应用程序</a>可以独立决定自己的线程要如何运作。操作系统<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://zh.wikipedia.org/wiki/%E5%86%85%E6%A0%B8">内核</a>不能看见它，也不会为它进行<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://zh.wikipedia.org/wiki/%E6%8E%92%E7%A8%8B">调度</a>。</div><div class="notion-text notion-block-15e25ac96ea880e5aea1ccc5b76ed184">这里遍历了 key_dtor_list 并调用，但 key_dtor_list 怎么直接改也不清楚。</div><div class="notion-blank notion-block-15e25ac96ea880a883f2d50ea567fcb8"> </div><div class="notion-text notion-block-15e25ac96ea8806f8336d0066d03d552">回到 __mingw_TLScallback 函数：</div><div class="notion-text notion-block-15e25ac96ea88015928ae13b7e519197">回到dyn_tls_init：，从 __xd_a 这里不断调用函数列表</div><div class="notion-text notion-block-15e25ac96ea880c4add3fa37ea300679">试图写东西进去用但是写不进去会报错，感觉编译出来也不一定有这段</div><div class="notion-blank notion-block-15e25ac96ea880d0b2daec6aad9f8f1e"> </div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-15e25ac96ea8806c9164f37e75e1195b" data-id="15e25ac96ea8806c9164f37e75e1195b"><span><div id="15e25ac96ea8806c9164f37e75e1195b" class="notion-header-anchor"></div><a class="notion-hash-link" href="#15e25ac96ea8806c9164f37e75e1195b" title="_dyn_tls_dtor"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">_dyn_tls_dtor</span></span></h4><div class="notion-text notion-block-15e25ac96ea880959f2cd8830fd0a799">核心也是调用 __mingw_TLScallback ，如果启用MS_TLS的话有 dtor_list 调用</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-15e25ac96ea880a29523da81db77a3cb" data-id="15e25ac96ea880a29523da81db77a3cb"><span><div id="15e25ac96ea880a29523da81db77a3cb" class="notion-header-anchor"></div><a class="notion-hash-link" href="#15e25ac96ea880a29523da81db77a3cb" title="mainCRTStartup"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">mainCRTStartup</span></span></h3><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-15e25ac96ea880849a25d81ed655279e"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:457.99603271484375px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Fec8fd2f2-1649-4985-8970-ff7b57d45517%2F32f04aa1-0a9c-4452-a720-35d90d94982a%2Fimage.png?table=block&amp;id=15e25ac9-6ea8-8084-9a25-d81ed655279e&amp;t=15e25ac9-6ea8-8084-9a25-d81ed655279e&amp;width=457.99603271484375&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-15e25ac96ea880cc85deea225f625ac5" data-id="15e25ac96ea880cc85deea225f625ac5"><span><div id="15e25ac96ea880cc85deea225f625ac5" class="notion-header-anchor"></div><a class="notion-hash-link" href="#15e25ac96ea880cc85deea225f625ac5" title="_security_init_cookie"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">_security_init_cookie</span></span></h4><div class="notion-text notion-block-15e25ac96ea880189d72dff3856ff980">_security_init_cookie()， windows的机制：<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/security-init-cookie?view=msvc-170">https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/security-init-cookie?view=msvc-170</a>，</div><div class="notion-text notion-block-15e25ac96ea8801088c7d377868f0a69">用于初始化类似windows canary，通过对多个时间、进程信息异或获取一个值存储在全局，逻辑比较简单不重点关注</div><div class="notion-blank notion-block-15e25ac96ea8802b8358e7df4d7dccf5"> </div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-15e25ac96ea880fc86d5c08d9a45a1ef" data-id="15e25ac96ea880fc86d5c08d9a45a1ef"><span><div id="15e25ac96ea880fc86d5c08d9a45a1ef" class="notion-header-anchor"></div><a class="notion-hash-link" href="#15e25ac96ea880fc86d5c08d9a45a1ef" title="_tmainCRTStartup"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">_tmainCRTStartup</span></span></h4><div class="notion-text notion-block-15e25ac96ea880df908ef6196e0df422">源码：</div><ul class="notion-list notion-list-disc notion-block-15e25ac96ea8806e858bf89d51cb0477"><li>首先是自旋锁的设置，控制资源访问，这部分略过，</li></ul><ul class="notion-list notion-list-disc notion-block-15e25ac96ea8800a8518d3b8a5bfae2a"><li>然后调用init_term，实际上就是从第一个参数的函数指针执行到第二个参数的函数指针</li></ul><ul class="notion-list notion-list-disc notion-block-15e25ac96ea880818810dfa65357f884"><li>_pei386_runtime_relocator ：似乎是由于pe文件ld的bug加的init函数</li></ul><ul class="notion-list notion-list-disc notion-block-15e25ac96ea88022b4b4f98e72196c10"><li>SetUnhandledExceptionFilter 函数：</li></ul><details class="notion-toggle notion-block-15e25ac96ea880a98fc2d6e1abbcd2c5"><summary><b>SetUnhandledExceptionFilter 函数 (errhandlingapi.h)</b></summary><div><ul class="notion-list notion-list-disc notion-block-c608b1ac70c340808bb58cd5e5fd9d25"><li>使应用程序能够取代进程每个线程的顶级异常处理程序。</li></ul><ul class="notion-list notion-list-disc notion-block-bc3a97d234d543cfacd5c148126bd80a"><li>调用此函数后，如果在未调试的进程中发生异常，并且异常会将其引入未经处理的异常筛选器，该筛选器将调用 <em>由 lpTopLevelExceptionFilter</em> 参数指定的异常筛选器函数。</li></ul><div class="notion-text notion-block-434190b01f8541adb2f9f06ea4663dcc"><b>参数：</b><code class="notion-inline-code">[in] lpTopLevelExceptionFilter</code></div><div class="notion-text notion-block-cfb4099e7bfa43f4bdf815a25a8a8917">指向顶级异常筛选器函数的指针，<span class="notion-red_background">每当 </span><span class="notion-red_background"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://learn.microsoft.com/zh-cn/windows/desktop/api/errhandlingapi/nf-errhandlingapi-unhandledexceptionfilter">UnhandledExceptionFilter</a></span><span class="notion-red_background"> 函数获得控制权且进程未调试时，将调用该函数</span>。 此参数的 <b>NULL</b> 值指定 <b>UnhandledExceptionFilter</b> 中的默认处理。</div><div class="notion-text notion-block-e4081d9136744a94b98d48c740365414">filter 函数的语法类似于 <a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://learn.microsoft.com/zh-cn/windows/desktop/api/errhandlingapi/nf-errhandlingapi-unhandledexceptionfilter">UnhandledExceptionFilter</a>：它采用 <b>LPEXCEPTION_POINTERS</b> 类型的单个参数，具有 WINAPI 调用约定，并返回 <b>LONG</b> 类型的值。 筛选器函数应返回以下值之一。</div><table class="notion-simple-table notion-block-a9458eaf380b4d2fb479206924cdc806"><tbody><tr class="notion-simple-table-row notion-block-1b7f763907e748cda62cf730e23cbe44"><td class="" style="width:120px"><div class="notion-simple-table-cell">值</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">含义</div></td></tr><tr class="notion-simple-table-row notion-block-1fd0b0e60f744c60ae61764c8e2e43eb"><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>EXCEPTION_EXECUTE_HANDLER</b>0x1</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">从 <a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://learn.microsoft.com/zh-cn/windows/desktop/api/errhandlingapi/nf-errhandlingapi-unhandledexceptionfilter">UnhandledExceptionFilter 返回</a> 并执行关联的异常处理程序。 这通常会导致进程终止。</div></td></tr><tr class="notion-simple-table-row notion-block-5e67262476a34344b2ebb0e043e0b0a7"><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>EXCEPTION_CONTINUE_EXECUTION</b>0xffffffff</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">从 <a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://learn.microsoft.com/zh-cn/windows/desktop/api/errhandlingapi/nf-errhandlingapi-unhandledexceptionfilter">UnhandledExceptionFilter 返回</a> ，并从异常点继续执行。 请注意，筛选器函数可以通过修改通过其 <b>LPEXCEPTION_POINTERS</b> 参数提供的异常信息来自由修改延续状态。</div></td></tr><tr class="notion-simple-table-row notion-block-fe6f012604d44b8cbf0665b6dd0c4ed6"><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>EXCEPTION_CONTINUE_SEARCH</b>0x0</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">继续正常执行 <a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://learn.microsoft.com/zh-cn/windows/desktop/api/errhandlingapi/nf-errhandlingapi-unhandledexceptionfilter">UnhandledExceptionFilter</a>。 这意味着遵守 <a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://learn.microsoft.com/zh-cn/windows/desktop/api/errhandlingapi/nf-errhandlingapi-seterrormode">SetErrorMode</a> 标志，或调用“应用程序错误”弹出消息框。</div></td></tr></tbody></table><div class="notion-text notion-block-fc3dbe8f67a447ca8515db356f24ccf6"><b>返回值</b></div><div class="notion-text notion-block-e176f64a634d42dfa47a1c74cad6eedb"><b>SetUnhandledExceptionFilter</b> 函数返回使用 函数建立的上一个异常筛选器的地址。 <b>NULL</b> 返回值表示当前没有顶级异常处理程序。</div><div class="notion-text notion-block-4c0d2884fbe84f74beda835c12c3650c"><b>注解</b></div><div class="notion-text notion-block-eda5bdbc3f384d4abbb0db939e06abf8">发出 <b>SetUnhandledExceptionFilter</b> 将替换调用进程中所有现有线程和所有未来线程的现有顶级异常筛选器。</div><div class="notion-text notion-block-62b45ed277734dc3ab259630ee2d4c9c"><em>lpTopLevelExceptionFilter</em> 指定的异常处理程序在导致错误的线程上下文中执行。 这可能会影响异常处理程序从某些异常（如无效堆栈）中恢复的能力。</div></div></details><details class="notion-toggle notion-block-15e25ac96ea88011b798ef79ac83c22e"><summary><b>_set_invalid_parameter_handler</b></summary><div><div class="notion-text notion-block-dbc19a640f244d6bbdb8b3c7e7da6eb4">Sets a function to be called when the CRT detects an invalid argument.</div><div class="notion-text notion-block-060a985b4e4c44a799e73fa7d6ec9e7a"><b>Parameters</b></div><ul class="notion-list notion-list-disc notion-block-284423d2d562451f8a6f58d9bb107b6c"><li>[in] pNewThe function pointer to the new invalid parameter handler.</li></ul><div class="notion-text notion-block-1e6d5c95814d43f7aa43c9ea6be0fa16"><b>Return Value</b></div><div class="notion-text notion-block-5bdc1031e4924dbbbe5c35430142358f">A pointer to the invalid parameter handler before the call.</div></div></details><details class="notion-toggle notion-block-15e25ac96ea880648b84db92d2843bcc"><summary>duplicate_ppstrings </summary><div><div class="notion-text notion-block-b83b38a1da3347659bbb2de933ee0111">编译后被inline，就是把argc 和 argv复制出来</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-1b58ea51915f4d7a871f2c194187cc68"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:680.0099487304688px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Fec8fd2f2-1649-4985-8970-ff7b57d45517%2F24546e91-1a2e-4725-9a0d-6dce00deea2d%2Fimage.png?table=block&amp;id=1b58ea51-915f-4d7a-871f-2c194187cc68&amp;t=1b58ea51-915f-4d7a-871f-2c194187cc68&amp;width=680.0099487304688&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure></div></details><details class="notion-toggle notion-block-15e25ac96ea8801a9acdc09fd00a32ce"><summary>_main：C++初始化函数</summary><div><div class="notion-text notion-block-8b8dde9fa80940b1b3afd265af7ddd97">找这个function list：__CTOR_LIST__执行，g++里面直接这样调用：</div></div></details><details class="notion-toggle notion-block-15e25ac96ea880c9b8def4b7d18b66a5"><summary>最后是 _tmain 也就是用户main函数，执行后exit结束完整程序</summary><div></div></details><div class="notion-text notion-block-15e25ac96ea88049951ec6d1f5c6c114">至此，程序基本分析完毕</div><div class="notion-blank notion-block-15e25ac96ea880d1a4abc97ce2795fc5"> </div><div class="notion-blank notion-block-15e25ac96ea88074a15fefd125aa0b06"> </div><div class="notion-blank notion-block-15e25ac96ea8816a9016c5532051077d"> </div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[windows 反调试记录]]></title>
            <link>https://moyaoxue.de/article/15c25ac9-6ea8-802a-b1f3-dc726b0cc296</link>
            <guid>https://moyaoxue.de/article/15c25ac9-6ea8-802a-b1f3-dc726b0cc296</guid>
            <pubDate>Sat, 14 Dec 2024 00:00:00 GMT</pubDate>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-15c25ac96ea8802ab1f3dc726b0cc296"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-15c25ac96ea880ebb999ced98d00444b" data-id="15c25ac96ea880ebb999ced98d00444b"><span><div id="15c25ac96ea880ebb999ced98d00444b" class="notion-header-anchor"></div><a class="notion-hash-link" href="#15c25ac96ea880ebb999ced98d00444b" title="ring 3"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">ring 3</span></span></h2><details class="notion-toggle notion-block-15c25ac96ea880769194f9f272b651b1"><summary>本部分收集自ctf-wiki，实现方面均改为g++ asm汇编内联 + syscall直接调用win syscall或api（除去getVersion不太好写），部分代码存在内核内存读取的灵车问题</summary><div><div class="notion-text notion-block-ae93e2b013bb4ad3852da0b1733b27a4">直接给到完整代码，解析见ctf-wiki即可：</div><div class="notion-text notion-block-15c25ac96ea88056b323e01030a6c174">note：不太清楚的可以编译一个调api的动调进去看源码的syscall参数</div><div class="notion-text notion-block-fd80566f10bb401fa8bf2c835b92b322">编译：64bit `g++ -g -masm=intel -o  test test.cpp`</div></div></details><div class="notion-text notion-block-15c25ac96ea88019a9bdee55d84a18c3">主要是<b>gs段中的标识位、windows堆的特性、syscall找到debug标识位</b>三大部分检查</div><div class="notion-text notion-block-15c25ac96ea8806f9684e4e441dda61f">代码方面可以注意一下：gs地址可以传入eax，那么ida识别的偏移是错的</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-15c25ac96ea8806da340e70692c2c9e3"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Fec8fd2f2-1649-4985-8970-ff7b57d45517%2Faa146266-1b4b-4433-bcb9-8e0480ad1335%2Fimage.png?table=block&amp;id=15c25ac9-6ea8-806d-a340-e70692c2c9e3&amp;t=15c25ac9-6ea8-806d-a340-e70692c2c9e3&amp;width=707.9761962890625&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-15c25ac96ea88018a735eefc05643561">如果给到rax，ida可以识别出来偏移</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-15c25ac96ea88098a14ed61cd0cb608e"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:548.9782104492188px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Fec8fd2f2-1649-4985-8970-ff7b57d45517%2F32fd1873-c1e4-4a35-8bff-5096d91ef5d0%2Fimage.png?table=block&amp;id=15c25ac9-6ea8-8098-a14e-d61cd0cb608e&amp;t=15c25ac9-6ea8-8098-a14e-d61cd0cb608e&amp;width=548.9782104492188&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-15c25ac96ea88050977be20b5b8147a3">windows syscall 统计：<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://github.com/ikermit/11Syscalls/blob/main/MD/10.0.22000.md">https://github.com/ikermit/11Syscalls/blob/main/MD/10.0.22000.md</a></div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-15c25ac96ea880f9a91aec7b9ce55d64"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Fec8fd2f2-1649-4985-8970-ff7b57d45517%2Fa74e8e81-70c3-4628-9b3d-b0b3bb12034c%2Fimage.png?table=block&amp;id=15c25ac9-6ea8-80f9-a91a-ec7b9ce55d64&amp;t=15c25ac9-6ea8-80f9-a91a-ec7b9ce55d64&amp;width=707.9960327148438&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-15c25ac96ea880ca8835fc4cf6861278" data-id="15c25ac96ea880ca8835fc4cf6861278"><span><div id="15c25ac96ea880ca8835fc4cf6861278" class="notion-header-anchor"></div><a class="notion-hash-link" href="#15c25ac96ea880ca8835fc4cf6861278" title="ring 0"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">ring 0</span></span></h2><div class="notion-text notion-block-15c25ac96ea88043bdf1ee3961ec37bf">以下这两个是vmp的反调</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-15c25ac96ea8806ca077fcb5cbb142ba" data-id="15c25ac96ea8806ca077fcb5cbb142ba"><span><div id="15c25ac96ea8806ca077fcb5cbb142ba" class="notion-header-anchor"></div><a class="notion-hash-link" href="#15c25ac96ea8806ca077fcb5cbb142ba" title="KdDebuggerEnabled"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">KdDebuggerEnabled</span></span></h3><div class="notion-text notion-block-15c25ac96ea880fea3a9ee2308fe3759">KdDebuggerEnabled 来说，其本质上是共享内存区域 KUSER_SHARED_DATA 里的一个标志位，在开启内核调试时会被置位。通过查询 KUSER_SHARED_DATA 中的标志位可以检测到是否有内核调试器，或者通过 NtQuerySystemInformation 的 class 0x23(35) 来检测，该 class 返回两个值，分别对应 KdDebuggerEnabled 和 KdDebuggerNotPresent</div><div class="notion-text notion-block-15c25ac96ea880a68130c27634b9469a">代码类似：</div><div class="notion-blank notion-block-15c25ac96ea8808bbee7dff7ff6730f7"> </div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-15c25ac96ea88097b773c3b7a6a80b38" data-id="15c25ac96ea88097b773c3b7a6a80b38"><span><div id="15c25ac96ea88097b773c3b7a6a80b38" class="notion-header-anchor"></div><a class="notion-hash-link" href="#15c25ac96ea88097b773c3b7a6a80b38" title="KdDebuggerNotPresent"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">KdDebuggerNotPresent</span></span></h3><div class="notion-text notion-block-15c25ac96ea880e395b9dbd07dca8c17">全局变量nt!KdDebuggerNotPresent来标识是否存在内核调试器，在未启动调试模式下此值为1</div><div class="notion-text notion-block-15c25ac96ea880ef9c0cc3c14c6e4720">kdcom.dll是Windows 操作系统内核的调试模块，里面包含了大量的内核调试函数，例如：KdD0Transition 、KdD3Transition、KdDebuggerInitialize0、KdReceivePacket、KdRestore 、KdSave 等函数。</div><div class="notion-text notion-block-15c25ac96ea880c2b417d61435f1945c">KdDebuggerNotPresent，在KdReceivePacket这个函数中找到。KdReceivePacket将KdDebuggerNotPresent循环复位清零</div></main></div>]]></content:encoded>
        </item>
    </channel>
</rss>