<?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>NotionNext BLOG</title>
        <link>https://ethanyi9.site/</link>
        <description>这是一个由NotionNext生成的站点</description>
        <lastBuildDate>Wed, 16 Oct 2024 16:09:21 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 2024, Ethanyi</copyright>
        <item>
            <title><![CDATA[gitlet完成纪念]]></title>
            <link>https://ethanyi9.site/article/gitlet</link>
            <guid>https://ethanyi9.site/article/gitlet</guid>
            <pubDate>Wed, 16 Oct 2024 00:00:00 GMT</pubDate>
            <description><![CDATA[一个值得学习的小型项目]]></description>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-1216a125c34e803fa7cdd033b9cda03b"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><div class="notion-table-of-contents notion-gray notion-block-1216a125c34e802e9eb0c756ce9db7a1"><a href="#1216a125c34e804ebac1c07001baf1a3" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:0">前言</span></a><a href="#1216a125c34e8094bc04c85354f8d7ed" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:0">学习到的东西</span></a><a href="#1216a125c34e80439c94ebb98fe91679" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:0">项目构建</span></a><a href="#1216a125c34e80bfaf63fc50034652e4" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:0">相关链接</span></a></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-1216a125c34e804ebac1c07001baf1a3" data-id="1216a125c34e804ebac1c07001baf1a3"><span><div id="1216a125c34e804ebac1c07001baf1a3" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1216a125c34e804ebac1c07001baf1a3" 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-1216a125c34e8067a096d11a74cf3abb">首先将自己的gradescope成绩放过来</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-1216a125c34e80f68910e006d6d6bdd6"><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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2F9576b937-488c-404f-a50f-0924b2a7f6f8%2Fimage.png?table=block&amp;id=1216a125-c34e-80f6-8910-e006d6d6bdd6&amp;t=1216a125-c34e-80f6-8910-e006d6d6bdd6&amp;width=2425&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-1216a125c34e807c8ef7cc0ebbec39c2">早在进行CS61B学习之前就听说过<code class="notion-inline-code">gitlet</code>的大名，可以说这是来自UCB的课程中最为出名的项目之一，它包括了60多页的Spec文档、几乎为零的skeleton代码（仅提供了几个相关的类）、相当繁杂的文件操作以及链表构建还有令人纠结的诸多逻辑。</div><div class="notion-text notion-block-1216a125c34e804e98d9d113afd6cbae">我从gitlet上花费的时间没有具体计算，但从开始构建Merge命令的时候，我开始使用wakatime来记录自己编写代码的时间，所以以下时间可以看做是我构建Merge+debug代码的时间，这里列出。</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-1216a125c34e80e0a9d1e86992683e4d"><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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2Fd116da56-741c-46a1-884a-327c54cbf21f%2Fimage.png?table=block&amp;id=1216a125-c34e-80e0-a9d1-e86992683e4d&amp;t=1216a125-c34e-80e0-a9d1-e86992683e4d&amp;width=707.9874877929688&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-1216a125c34e80a39b46d08617aee977">是的，光是构建merge指令，加上debug的时间就已经有14个小时了，也就是说整个项目起码有30+小时的时间进行构建，这还只包括敲代码的时间，还不包括思考思路的时间，大家可以想象一下这个项目的难度。</div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-1216a125c34e8094bc04c85354f8d7ed" data-id="1216a125c34e8094bc04c85354f8d7ed"><span><div id="1216a125c34e8094bc04c85354f8d7ed" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1216a125c34e8094bc04c85354f8d7ed" 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-1216a125c34e8020aac1c383134e95f0">但是！虽然我说了这么多，如果你要问我这个项目值不值得，我还是觉得非常的值。</div><div class="notion-text notion-block-1216a125c34e803c8788c593afd905e3">通过gitlet这个项目，我学习到了：</div><ul class="notion-list notion-list-disc notion-block-1216a125c34e803db91fca9057305dbc"><li><b>git操作的底层原理，</b>之前一直了解，但知识结构不是很清晰</li><ul class="notion-list notion-list-disc notion-block-1216a125c34e803db91fca9057305dbc"><li>听说gitlet的<code class="notion-inline-code">remote</code> 相关操作底层原理和真实git其实有不小差距，加上时间原因实在不允许我慢悠悠再构建remote相关代码，我就没有将其实现，如果是本科的同学们有比较充裕的时间，可以来进行对作为extra部分的remote相关进行实现</li><li>准确来说是学习了对一些功能在底层实现上面的解构思想</li></ul></ul><ul class="notion-list notion-list-disc notion-block-1216a125c34e80088832e1764d6ae814"><li><b>文件形式的链表操作</b>，同时学习了<b>BFS广度优先</b>在代码中大致怎么实现的</li></ul><ul class="notion-list notion-list-disc notion-block-1216a125c34e802ba95cc3e6ce1d94a4"><li><b>面向函数式编程</b>，这个思想我觉得是项目构建的很重要的一环，在想要一个功能的时候，编写一个功能的函数，然后将文件中相关功能的部分解耦合，这样就在修改的时候就不需要分别进行更改</li><ul class="notion-list notion-list-disc notion-block-1216a125c34e802ba95cc3e6ce1d94a4"><li>但这个其实项目做多的之后，本能上就是会意识到这个问题，会实现模块解耦</li><li>但是抽象性思维真的很重要，所以说不管怎么说还是重新意识到了这一点</li></ul></ul><ul class="notion-list notion-list-disc notion-block-1216a125c34e802daeb3f84af44eb210"><li>集成测试的思路</li><ul class="notion-list notion-list-disc notion-block-1216a125c34e802daeb3f84af44eb210"><li>有但不多，因为我为了节约时间都是直接在网上找了找大家爬下来的testing文件进行的面向测试编写</li></ul></ul><ul class="notion-list notion-list-disc notion-block-1216a125c34e80ea9877da65e3584955"><li>make的使用</li><ul class="notion-list notion-list-disc notion-block-1216a125c34e80ea9877da65e3584955"><li>有但不多，基本都是直接使用make指令，过两天找找相关make的文章再详细地学学</li></ul></ul><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-1216a125c34e80439c94ebb98fe91679" data-id="1216a125c34e80439c94ebb98fe91679"><span><div id="1216a125c34e80439c94ebb98fe91679" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1216a125c34e80439c94ebb98fe91679" 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-1216a125c34e80ecb0face7f72fe8a48">这方面内容我写在Repo中了，有兴趣的同学可以去看看：<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://github.com/thanyi/gitlet">https://github.com/thanyi/gitlet</a>，但是最好还是自己看看思路就好</div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-1216a125c34e80bfaf63fc50034652e4" data-id="1216a125c34e80bfaf63fc50034652e4"><span><div id="1216a125c34e80bfaf63fc50034652e4" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1216a125c34e80bfaf63fc50034652e4" 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><ul class="notion-list notion-list-disc notion-block-1216a125c34e8039b7d7d2ca06462f1b"><li>对于gitlet的构建：<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://github.com/thanyi/gitlet">https://github.com/thanyi/gitlet</a></li></ul><ul class="notion-list notion-list-disc notion-block-1216a125c34e80e58f6ed27fe3a85157"><li>cs61b的Spec文档：<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://sp21.datastructur.es/materials/proj/proj2/proj2#understanding-integration-tests">https://sp21.datastructur.es/materials/proj/proj2/proj2</a></li></ul><ul class="notion-list notion-list-disc notion-block-1216a125c34e802aac49ed10a572e7fb"><li>相关参考博客：</li><ul class="notion-list notion-list-disc notion-block-1216a125c34e802aac49ed10a572e7fb"><li><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://zhuanlan.zhihu.com/p/533852291">https://zhuanlan.zhihu.com/p/533852291</a></li><li><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://eimy.ink/zh/posts/2023/gitlet-fin/">https://eimy.ink/zh/posts/2023/gitlet-fin/</a></li></ul></ul></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[XYCTF 2024]]></title>
            <link>https://ethanyi9.site/article/xyctf</link>
            <guid>https://ethanyi9.site/article/xyctf</guid>
            <pubDate>Wed, 01 May 2024 00:00:00 GMT</pubDate>
            <description><![CDATA[关于XYCTF 2024 部分pwn题的复现]]></description>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-3806f369a0754cdb8b2e1460a88beb0e"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><div class="notion-table-of-contents notion-gray notion-block-16dd4af3c7224c57926a262be4e62e2f"><a href="#0ab43ff6fce54dfa8aad69f6e692fc26" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:0">baby_gift</span></a><a href="#3d5663a3b36746e9a11810cd32004cc9" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">反汇编代码</span></a><a href="#5b2205280db2478caacbb9c47a585367" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">思路</span></a><a href="#8bcddd33b8d54e5881af320022071d94" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:48px">初看</span></a><a href="#97ef190866834dbc827940cf143e61b0" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:48px">细看</span></a><a href="#758ca5854caa4ecd8cacee23e8b30389" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">printf</span></a><a href="#1d6835b3f6d74697bee356f44f339fa4" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">exp</span></a><a href="#6c4cdb4fd3994240bc4b50f3d334fd6b" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:0">fmt</span></a><a href="#d7bfa0be02c8436dbead21b02082fe43" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">低版本的exit_hook</span></a><a href="#fc7fac294dc54127a305e597e81bc33c" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:0">simple_srop</span></a><a href="#826076d6216248279f82f67ea174a99e" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:0">fastfastfast</span></a><a href="#65a65575d12847b0bc340603b6a14553" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">Fastbin reverse into tcache</span></a><a href="#dc4f4cad5523430b960495b30efb93fe" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">stdout</span></a><a href="#b2d9f45773194870bad9916327225ac8" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:0">mips</span></a><a href="#87591d12eb9f47d1bf390f85e8aebde4" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:0">ptmalloc2 it&#x27;s myheap</span></a><a href="#3c14efe7937644888c8c7f01c7037ecc" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">解法</span></a><a href="#42b69d8e10d144708a96d3b32237b18d" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:0">ptmalloc2 it&#x27;s myheap pro</span></a><a href="#a3a3a6ae9eae455aa05add2473e6d6be" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">原理</span></a><a href="#443e186ad7c8492699006bf85c0d48c8" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:48px"> exit → __run_exit_handlers → __call_tls_dtors</span></a><a href="#a224b0df9f3642ec8ddd672e7c7f479a" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:48px">exp</span></a></div><div class="notion-text notion-block-fc4da609e8fd49598847207a64844a8c">虽然中途有这不少的问题，还是磕磕碰碰复现一下</div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-0ab43ff6fce54dfa8aad69f6e692fc26" data-id="0ab43ff6fce54dfa8aad69f6e692fc26"><span><div id="0ab43ff6fce54dfa8aad69f6e692fc26" class="notion-header-anchor"></div><a class="notion-hash-link" href="#0ab43ff6fce54dfa8aad69f6e692fc26" title="baby_gift"><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">baby_gift</span></span></h2><div class="notion-text notion-block-316ac3c9da01432cb7d4d6f21f2ee4c5">这个题是用时较久的题所以最先拿出来进行复盘</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-3d5663a3b36746e9a11810cd32004cc9" data-id="3d5663a3b36746e9a11810cd32004cc9"><span><div id="3d5663a3b36746e9a11810cd32004cc9" class="notion-header-anchor"></div><a class="notion-hash-link" href="#3d5663a3b36746e9a11810cd32004cc9" 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-10994f70cb1442e184408a50855d7eb2">题目是这样：</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-9f35537609084e118ff532b346093755"><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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2F88920ee1-aa98-43cb-bfb8-23fa85340f51%2FUntitled.png?table=block&amp;id=9f355376-0908-4e11-8ff5-32b346093755&amp;t=9f355376-0908-4e11-8ff5-32b346093755&amp;width=708&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-2f8dfb96bf714d39a84cc8cfbbb4dc58">汇编代码：</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-45fa74239a114627bd56a34e9c3bb356"><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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2F87f63d9c-4f8f-49d0-99f1-4b25965ba600%2FUntitled.png?table=block&amp;id=45fa7423-9a11-4627-bd56-a34e9c3bb356&amp;t=45fa7423-9a11-4627-bd56-a34e9c3bb356&amp;width=708&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-blank notion-block-de371b69ca11492aa0d3216f7f600085"> </div><div class="notion-text notion-block-6ec05043c5da4106912d3306a543f786">其中gift是这样</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-beda2418f3ca44a79eb0437c30628619"><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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2F65cc72c2-707e-428e-b080-d3b441946052%2FUntitled.png?table=block&amp;id=beda2418-f3ca-44a7-9eb0-437c30628619&amp;t=beda2418-f3ca-44a7-9eb0-437c30628619&amp;width=708&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-afdeddfabfdc44bfa6b9e35af950c3ed">可以看出来，getInfo函数是有一个栈溢出，可以溢出0x20字节</div><div class="notion-text notion-block-7dcb109ba00246d79aad6f3fcabf9ca2">其中gift中的功能是说可以将[rbp-0x8]的地方变成rdi的值。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-5b2205280db2478caacbb9c47a585367" data-id="5b2205280db2478caacbb9c47a585367"><span><div id="5b2205280db2478caacbb9c47a585367" class="notion-header-anchor"></div><a class="notion-hash-link" href="#5b2205280db2478caacbb9c47a585367" 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><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-8bcddd33b8d54e5881af320022071d94" data-id="8bcddd33b8d54e5881af320022071d94"><span><div id="8bcddd33b8d54e5881af320022071d94" class="notion-header-anchor"></div><a class="notion-hash-link" href="#8bcddd33b8d54e5881af320022071d94" 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-030c392361ef404eb9f3c17031992557">做题的时候我觉得对gift的使用应该是：</div><ul class="notion-list notion-list-disc notion-block-b4057855e7684c348aa67c3a07d15579"><li>我们可以修改rbp和返回地址，将返回地址修改为：0x4012a0，就可以修改掉rdi的值，作为一个参数，然后让其再返回到system之类的函数，就可以直接拿到shell了</li></ul><div class="notion-text notion-block-eb3f96f6779045f7bd3eb6ddc6ce0646">但是后面我发现首先还要泄露libc，不知道怎么泄露，卡了很久没有思路，因为没有程序没有关于参数的ROP链，同时也没有除printf之外的输出（当时没有反应过来printf是有用的）</div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-97ef190866834dbc827940cf143e61b0" data-id="97ef190866834dbc827940cf143e61b0"><span><div id="97ef190866834dbc827940cf143e61b0" class="notion-header-anchor"></div><a class="notion-hash-link" href="#97ef190866834dbc827940cf143e61b0" 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-63e984f8e2db41af9341ab296d33e11b">再然后第二天看的时候，突然发现可以先不修改rdi，因为[rbp-0x20]地址中的值最开始是我们输入的<code class="notion-inline-code">passwd</code> ，同时gift函数执行完后其实也没有将rdi改变，所以直接将返回地址改为<code class="notion-inline-code">printf</code> 函数可以造成格式化字符串漏洞</div><div class="notion-text notion-block-e08dc87bee6b48898aee14349e25e160">但是这就遇到了一个问题，不知道为什么<code class="notion-inline-code">printf(&quot;%27$p&quot;)</code>输出结果</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-758ca5854caa4ecd8cacee23e8b30389" data-id="758ca5854caa4ecd8cacee23e8b30389"><span><div id="758ca5854caa4ecd8cacee23e8b30389" class="notion-header-anchor"></div><a class="notion-hash-link" href="#758ca5854caa4ecd8cacee23e8b30389" title="printf"><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">printf</span></span></h3><div class="notion-text notion-block-527a0308ca084d30be150800a62a6e02">很奇怪，问了其他师傅才知道，原来printf函数中有这样的一份判断：</div><div class="notion-text notion-block-a1a8a1ba6a294a5181afb623b02588ad">不知道是不是所有版本的printf函数都有这个判断，有时间去看看源码。这个判断的意义是检查al寄存器，查看printf的参数量是多少</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-ea730431f6d247fcaa107180cdcba9b6"><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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2F270bb266-aec8-4861-845e-02b4dddc787e%2FUntitled.png?table=block&amp;id=ea730431-f6d2-47fc-aa10-7180cdcba9b6&amp;t=ea730431-f6d2-47fc-aa10-7180cdcba9b6&amp;width=708&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><blockquote class="notion-quote notion-block-5987c40f8fc84790aa17860979ecf2bc"><div>对于用 varargs 或 stdargs 的函数，%al 当作隐藏参数使用，表明 SSE 寄存器的用量。%al 的内容不必和寄存器用量吻合，但是一定要是 SSE 寄存器用量的一个上界而且落在开区间 0-8 里。</div></blockquote><div class="notion-text notion-block-82d46b80f70c47e7b4020417d8f3ce45">SSE: 8个128位寄存器（从xmm0到xmm7）</div><div class="notion-text notion-block-adbefd4a327a4079a1d40e398620d1c6">但是这些只是简要一提，主要涉及就是对<code class="notion-inline-code">printf</code> 函数使用的时候需要将eax归零，不然会进入奇怪的逻辑中</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1d6835b3f6d74697bee356f44f339fa4" data-id="1d6835b3f6d74697bee356f44f339fa4"><span><div id="1d6835b3f6d74697bee356f44f339fa4" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1d6835b3f6d74697bee356f44f339fa4" title="exp"><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">exp</span></span></h3><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-6c4cdb4fd3994240bc4b50f3d334fd6b" data-id="6c4cdb4fd3994240bc4b50f3d334fd6b"><span><div id="6c4cdb4fd3994240bc4b50f3d334fd6b" class="notion-header-anchor"></div><a class="notion-hash-link" href="#6c4cdb4fd3994240bc4b50f3d334fd6b" title="fmt"><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">fmt</span></span></h2><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-aecf6c01637c4609beb6736aab3a0004"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:345px;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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2F162e9ecd-39c2-42bb-b8d7-ca0b976b9e19%2FUntitled.png?table=block&amp;id=aecf6c01-637c-4609-beb6-736aab3a0004&amp;t=aecf6c01-637c-4609-beb6-736aab3a0004&amp;width=345&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-befecd8a48fd4ea1ba4a3d6d5f4ff4de">这个题有点意思，它涉及fmt，但不是用的printf来进行fmt，而是用了scanf，但是原理是一模一样的</div><div class="notion-callout notion-gray_background_co notion-block-c6b0f9d0b0fa48489d9dbb453faef046"><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">fmt的原理可以在网上多查查，主要就是由于字符串指针内存可以随便修改，且每当一个%号变量出现就要去寻找是否有相关变量（尤其是在栈中寻找），这就导致了可以进行任意写的漏洞。对栈中的地址指向的值进行修改</div></div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-d7bfa0be02c8436dbead21b02082fe43" data-id="d7bfa0be02c8436dbead21b02082fe43"><span><div id="d7bfa0be02c8436dbead21b02082fe43" class="notion-header-anchor"></div><a class="notion-hash-link" href="#d7bfa0be02c8436dbead21b02082fe43" title="低版本的exit_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">低版本的exit_hook</span></span></h3><div class="notion-text notion-block-526dc6dd3cc848508ef042ca504a9ff4">其中也涉及到了exit_hook的知识：</div><blockquote class="notion-quote notion-block-ef6438a89d77439bb391642e9fddf52f"><div><code class="notion-inline-code"><b>_rtld_global</b></code>是GNU C Library (glibc) 中动态链接器用于维护自身状态的一个全局结构体。</div></blockquote><div class="notion-text notion-block-7a632cad97144c92a01b4772cb2ead1e">在exit的调用中，调用链是<code class="notion-inline-code">exit </code>→ <code class="notion-inline-code">__run_exit_handlers </code> →<code class="notion-inline-code">_dl_fini</code> →<code class="notion-inline-code">__rtld_lock_lock_recursive </code>或者<code class="notion-inline-code">__rtld_lock_unlock_recursive </code></div><div class="notion-text notion-block-5e6902f7429b4c7987f08d7569a630cc">这里就不多赘述了，给出exp</div><div class="notion-text notion-block-d872964ac4b642328ea836b7418562f0">收获：</div><ul class="notion-list notion-list-disc notion-block-646a8978871e42ed87b1c84cb0d77ac3"><li>ld基地址与libc基地址偏移量相同（起码在2.31为止是这样）</li></ul><ul class="notion-list notion-list-disc notion-block-37b81c27d60345bfa05547b5cc8a8604"><li><code class="notion-inline-code">__rtld_lock_lock_recursive</code> 指针地址为<code class="notion-inline-code">__rtld_global+0xf08</code> ，当修改了这个指针为任意地址，就可以将exit函数hook指向其他地方（但是2.34之后就用不了了）</li></ul><div class="notion-blank notion-block-1f3d9a016a8a46cd8b9e148cfb63538e"> </div><div class="notion-text notion-block-2a7ad84535a64a8c9fcf3cd230a624a1">涉及exit_hook的链接在这里</div><div class="notion-row"><a target="_blank" rel="noopener noreferrer" class="notion-bookmark notion-block-155a8c2d38e6477d9a6d2eac7f73255c" href="https://www.cnblogs.com/bhxdn/p/14222558.html"><div><div class="notion-bookmark-title">exit_hook在pwn题中的应用 - 不会修电脑 - 博客园</div><div class="notion-bookmark-description">以前只接触过malloc_hook，free_hook，大概意思就是在调用malloc和free的时候会先看看里面有没有东西，有的话就会执行。以前在看一些师傅们博客的时候有看到过exit_hook，前几天就研究了一下，这篇来做个总结。 首先我们自己写一个程序，调试一下exit是怎么执行的。 1 #i</div><div class="notion-bookmark-link"><div class="notion-bookmark-link-icon"><img src="https://assets.cnblogs.com/favicon.svg?v=2&amp;t=155a8c2d-38e6-477d-9a6d-2eac7f73255c" alt="exit_hook在pwn题中的应用 - 不会修电脑 - 博客园" loading="lazy" decoding="async"/></div><div class="notion-bookmark-link-text">https://www.cnblogs.com/bhxdn/p/14222558.html</div></div></div></a></div><div class="notion-row"><a target="_blank" rel="noopener noreferrer" class="notion-bookmark notion-block-366be1b78a6c4e8183c0a30e8e9682dd" href="https://xz.aliyun.com/t/12856?time__1311=mqmhq+xfxUxoDsD7GY5x7q7Ir5xArTbD"><div><div class="notion-bookmark-title">exit_hook攻击利用 - 先知社区</div><div class="notion-bookmark-description">先知社区，先知安全技术社区</div><div class="notion-bookmark-link"><div class="notion-bookmark-link-icon"><img src="https://xz.aliyun.com/static/icon/favicon.ico?t=366be1b7-8a6c-4e81-83c0-a30e8e9682dd" alt="exit_hook攻击利用 - 先知社区" loading="lazy" decoding="async"/></div><div class="notion-bookmark-link-text">https://xz.aliyun.com/t/12856?time__1311=mqmhq+xfxUxoDsD7GY5x7q7Ir5xArTbD</div></div></div></a></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-fc7fac294dc54127a305e597e81bc33c" data-id="fc7fac294dc54127a305e597e81bc33c"><span><div id="fc7fac294dc54127a305e597e81bc33c" class="notion-header-anchor"></div><a class="notion-hash-link" href="#fc7fac294dc54127a305e597e81bc33c" title="simple_srop"><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"><b><b>simple_srop</b></b></span></span></h2><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-b5dd4f9eaf9b417695aca5230211aa0f"><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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2Fd6f1159e-3a8d-4e0a-9087-af7c861c87d1%2FUntitled.png?table=block&amp;id=b5dd4f9e-af9b-4176-95ac-a5230211aa0f&amp;t=b5dd4f9e-af9b-4176-95ac-a5230211aa0f&amp;width=708&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-3a38451b19e04b938908989c2303fc3c"><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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2F0e60d78a-b4c4-40bc-9757-348e55a8a600%2FUntitled.png?table=block&amp;id=3a38451b-19e0-4b93-8908-989c2303fc3c&amp;t=3a38451b-19e0-4b93-8908-989c2303fc3c&amp;width=708&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-b8c04b05c65d4c7daa29fd5a9fad2de8">其实SROP的功能就是一长串ROP链的功能，只不过它在没有ROP的时候也可以进行使用，主要是依靠syscall</div><div class="notion-text notion-block-16877900bd054f05b1f05f0f577ddff4">这道题是利用了SROP，在没有输出函数，没有ROP的时候，让它成为主角，特别是当SROP中的rsp被设置为下一个SROP的地址的时候，这就达成了<b>SROP链</b></div><div class="notion-text notion-block-2f21fd7ced0248e384ea137326307959">SROP这里也有详细的参考</div><div class="notion-row"><a target="_blank" rel="noopener noreferrer" class="notion-bookmark notion-block-4cbfe8af1d2046f8b7b5d0ad7bb28f4f" href="https://xz.aliyun.com/t/12790?time__1311=mqmhqGrxCG8D/iNiQGkIeG=D8ia40QqT=4D"><div><div class="notion-bookmark-title">SROP详解 - 先知社区</div><div class="notion-bookmark-description">先知社区，先知安全技术社区</div><div class="notion-bookmark-link"><div class="notion-bookmark-link-icon"><img src="https://xz.aliyun.com/static/icon/favicon.ico?t=4cbfe8af-1d20-46f8-b7b5-d0ad7bb28f4f" alt="SROP详解 - 先知社区" loading="lazy" decoding="async"/></div><div class="notion-bookmark-link-text">https://xz.aliyun.com/t/12790?time__1311=mqmhqGrxCG8D/iNiQGkIeG=D8ia40QqT=4D</div></div></div></a></div><div class="notion-text notion-block-dd1e854fc7d24bc0a82b09dc6fa2d4c0">在可以使用SROP链的时候，他是一个非常方便的trick</div><div class="notion-text notion-block-072b4399bd4b40368ae4e24a44fda49b">先给出exp</div><div class="notion-text notion-block-736eae4a5c414e3db0f70ed2125dfd9e">可以看出虽然弄出来的段很多，但是从逻辑上来看SROP能达成的效果的利用相当的简便（在你弄懂了的情况下）</div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-826076d6216248279f82f67ea174a99e" data-id="826076d6216248279f82f67ea174a99e"><span><div id="826076d6216248279f82f67ea174a99e" class="notion-header-anchor"></div><a class="notion-hash-link" href="#826076d6216248279f82f67ea174a99e" title="fastfastfast"><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">fastfastfast</span></span></h2><div class="notion-text notion-block-973650283263452cad6d4e4612e1fba5">这个题真的卡了我好久，谢谢ret2o.O师傅的提点</div><div class="notion-text notion-block-61b76aa7440944f6b60107bb860d055d">打开ida</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-a9f796c702ac438ca5d383fdb6033156"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:498px;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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2F2087bdcb-82ac-4c29-a4cb-930348753e66%2FUntitled.png?table=block&amp;id=a9f796c7-02ac-438c-a5d3-83fdb6033156&amp;t=a9f796c7-02ac-438c-a5d3-83fdb6033156&amp;width=498&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-1aa5414b879645acb0b69fe487b70c02">经典的堆题，接下来看看漏洞</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-6c6b2754db194b99801772641eafbff7"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:374px;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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2F092838f8-9a57-4fe7-add2-934027df99a3%2FUntitled.png?table=block&amp;id=6c6b2754-db19-4b99-8017-72641eafbff7&amp;t=6c6b2754-db19-4b99-8017-72641eafbff7&amp;width=374&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-8abed1a53b7a407d931e80f68e75b1da">UAF漏洞，同时add函数中</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-11050a5103744b188de26bd2f6b7507e"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:480px;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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2F51350546-8066-4842-b251-64d1a52f1ad6%2FUntitled.png?table=block&amp;id=11050a51-0374-4b18-8de2-6bd2f6b7507e&amp;t=11050a51-0374-4b18-8de2-6bd2f6b7507e&amp;width=480&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-6a810feb436942dab884592caa5edbd0">可以看出是只有fastbin的大小，这就有个问题，我们不能申请到unsorted_bin，libc基地址就很难泄露，这就卡住我了</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-65a65575d12847b0bc340603b6a14553" data-id="65a65575d12847b0bc340603b6a14553"><span><div id="65a65575d12847b0bc340603b6a14553" class="notion-header-anchor"></div><a class="notion-hash-link" href="#65a65575d12847b0bc340603b6a14553" title="Fastbin reverse into tcache"><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"><b><b>Fastbin reverse into tcache</b></b></span></span></h3><div class="notion-text notion-block-4eba46c86b1d4a599dfe93c46e97a43a">同时学到关于fastbin dup的另一种说法：<b><b>Fastbin reverse into tcache</b></b></div><div class="notion-text notion-block-f341006391844a12b158f4b8ea00e668">具体上就是说tcache bin的stash机制：</div><div class="notion-text notion-block-1332901c9b994eb594f30a5ad9d899a7">在tcache bin中相同长度的chunk超过7个之后，会根据大小将其放入fastbin或者是unsorted bin中，同时如果，当我们重新进行申请chunk，在tcache bin中申请结束之后，会将fastbin的其他chunk放进tcache bin中（逆序）</div><div class="notion-text notion-block-6271ef1c5a304816a1c9992e7b298f34">如下图：</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-8ac0c5bacfab41fba11c3c8f306d7bc6"><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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2Fa6276c97-365d-4fb5-8c5e-e8708c2dfb19%2FUntitled.png?table=block&amp;id=8ac0c5ba-cfab-41fb-a11c-3c8f306d7bc6&amp;t=8ac0c5ba-cfab-41fb-a11c-3c8f306d7bc6&amp;width=707.9750366210938&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-42365117854d46cc9c7b053dac63f9d3">申请8个之后变成：</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-cf0d1c9a7d1345609da58446ec1422e3"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:537px;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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2Fa637c563-4ae4-4b1a-85fd-a5ec6ec7bc84%2FUntitled.png?table=block&amp;id=cf0d1c9a-7d13-4560-9da5-8446ec1422e3&amp;t=cf0d1c9a-7d13-4560-9da5-8446ec1422e3&amp;width=537&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-callout notion-gray_background_co notion-block-cb35cfb00e4e46bf89c96b84848a1112"><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">在和dup相关的构造的时候都要注意：如果你构造的fake_chunk不能有脏数据，就是说那片地址最好是直接指向的是\x00，这样被识别的时候不会引起其他的问题，不然再利用的时候扫描bin链就是会出问题</div></div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-dc4f4cad5523430b960495b30efb93fe" data-id="dc4f4cad5523430b960495b30efb93fe"><span><div id="dc4f4cad5523430b960495b30efb93fe" class="notion-header-anchor"></div><a class="notion-hash-link" href="#dc4f4cad5523430b960495b30efb93fe" title="stdout"><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">stdout</span></span></h3><div class="notion-text notion-block-5989483793da49098de88edf8e0e288c">我一直对stdout这个函数不是很理解，因为这总是让我想到__IO_2_1_stdout来泄露libc基址，但是我能知道stdout地址的时候不是就直接知道libc基址了吗？不知道有无大佬可以教教我</div><div class="notion-text notion-block-55ed95292e2a40a0ab8da620faca7fb4">但是这道题并没有用到这个知识，它只是利用了在bss中的stdout指针附近的地址，因为我们的show函数是这样</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-b30d18ea2b724fcc901bdd224489a56d"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:445px;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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2F59e95472-e1b6-4d23-a932-ba840c48e31f%2FUntitled.png?table=block&amp;id=b30d18ea-2b72-4fcc-901b-dd224489a56d&amp;t=b30d18ea-2b72-4fcc-901b-dd224489a56d&amp;width=445&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-967bcea942004ccc8f7ca5b8cb5e5961">意思是不会因为<b>\x00就结束输出</b>，所以可以把后面的内容全部输出出来</div><div class="notion-text notion-block-e25fc8194ef74e23bb3a2aad687f39c2">只要我们将fake_chunk地址放在stdout上方：</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-6bddf4a9d06b4401bc8ef84057c7129e"><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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2Ffb7e16b4-86d0-4ed1-a255-f646c8ca9ac3%2FUntitled.png?table=block&amp;id=6bddf4a9-d06b-4401-bc8e-f84057c7129e&amp;t=6bddf4a9-d06b-4401-bc8e-f84057c7129e&amp;width=707.9750366210938&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-60d158012b2248d4b3b5c1d80402ed9c">可以看到它的后面都是0，这就很符合我们之前的要求</div><div class="notion-text notion-block-4f0a72032eaa499da1bce709f3b6da43">exp:</div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-b2d9f45773194870bad9916327225ac8" data-id="b2d9f45773194870bad9916327225ac8"><span><div id="b2d9f45773194870bad9916327225ac8" class="notion-header-anchor"></div><a class="notion-hash-link" href="#b2d9f45773194870bad9916327225ac8" title="mips"><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">mips</span></span></h2><div class="notion-text notion-block-339d31d36aac43bd8abcc6346dfc45c3">通过这道题学会了mips的栈溢出攻击，相关的mips教程有很多，这里列两个：</div><div class="notion-row"><a target="_blank" rel="noopener noreferrer" class="notion-bookmark notion-block-0dc50203e4b146b7a8ae953cac8804f1" href="https://blog.csdn.net/abc380620175/article/details/101176930"><div><div class="notion-bookmark-title">blog.csdn.net</div><div class="notion-bookmark-link"><div class="notion-bookmark-link-text">https://blog.csdn.net/abc380620175/article/details/101176930</div></div></div></a></div><div class="notion-row"><a target="_blank" rel="noopener noreferrer" class="notion-bookmark notion-block-ffc097740fa74cc292a90549ca1bf8c3" href="https://xz.aliyun.com/t/1511?time__1311=n4+xni0QDQG=DtoqiKDsL3xCw4mwEMh74AKix"><div><div class="notion-bookmark-title">一步一步PWN路由器之rop技术实战 - 先知社区</div><div class="notion-bookmark-description">先知社区，先知安全技术社区</div><div class="notion-bookmark-link"><div class="notion-bookmark-link-icon"><img src="https://xz.aliyun.com/static/icon/favicon.ico?t=ffc09774-0fa7-4cc2-92a9-0549ca1bf8c3" alt="一步一步PWN路由器之rop技术实战 - 先知社区" loading="lazy" decoding="async"/></div><div class="notion-bookmark-link-text">https://xz.aliyun.com/t/1511?time__1311=n4+xni0QDQG=DtoqiKDsL3xCw4mwEMh74AKix</div></div></div></a></div><div class="notion-text notion-block-cf36f17f60544d22aa28a852c70f3720">相关的理论知识在上面都有，这里主要总结一下关于它的栈溢出</div><div class="notion-text notion-block-94546f11e8d548c29a956cf23b9ee6dd">mips的栈溢出和x86存在不同，主要体现在ROP链的运用，因为x86中栈存在入栈和出栈操作：<code class="notion-inline-code">push</code>和<code class="notion-inline-code">pop</code>，但在mips中由于栈空间大小是一开始就准备好的，不存在对栈的push和pop，同时也没有<code class="notion-inline-code">ret</code> 指令这种方便用来进行</div><div class="notion-callout notion-gray_background_co notion-block-27722a67d7e14435be0f002fcd3a790a"><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">主要的是在mips中需要跳转到一个中间的ROP，用于调整寄存器的值。在这些寄存器调整完之后就可以将程序跳转到想要的内存地址进行指令的运行了</div></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-87591d12eb9f47d1bf390f85e8aebde4" data-id="87591d12eb9f47d1bf390f85e8aebde4"><span><div id="87591d12eb9f47d1bf390f85e8aebde4" class="notion-header-anchor"></div><a class="notion-hash-link" href="#87591d12eb9f47d1bf390f85e8aebde4" title="ptmalloc2 it&#x27;s myheap"><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"><b><b>ptmalloc2 it&#x27;s myheap</b></b></span></span></h2><div class="notion-text notion-block-756cfb29952547eb86680bb0923905f9">这个题涉及到堆风水</div><div class="notion-text notion-block-287f258dfb62415b975f7797cce0de34">堆题经典的笔记题，有add、delete和show</div><div class="notion-text notion-block-e73447a906e747efb9dfdb6c05486ec1">其中add是申请0x18的管理块和内容块</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-870af0a6ae56486da2242c9506ca7c76"><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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2F2e41008c-e159-48d8-81b7-7b690f511851%2FUntitled.png?table=block&amp;id=870af0a6-ae56-486d-a224-2c9506ca7c76&amp;t=870af0a6-ae56-486d-a224-2c9506ca7c76&amp;width=708&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-92a6617bc248452ab54625aa4170a34a">delete有UAF</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-3c8da636bc2f49e18abc8404d9b98672"><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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2Ff2ac3268-7511-447e-ad26-00a3bd71b59c%2FUntitled.png?table=block&amp;id=3c8da636-bc2f-49e1-8abc-8404d9b98672&amp;t=3c8da636-bc2f-49e1-8abc-8404d9b98672&amp;width=708&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-fac431c01b6547ea9dc4e502627b9923">然后有一个后门gift：</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-656b12d837d640748c2d2009ee022655"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:647.9874877929688px;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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2F842f843a-db60-4a16-8675-22c8464c2938%2FUntitled.png?table=block&amp;id=656b12d8-37d6-4074-8c2d-2009ee022655&amp;t=656b12d8-37d6-4074-8c2d-2009ee022655&amp;width=647.9874877929688&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-1dee41709e1043ea8476d4de7864458d">最后，libc是2.35，这就是全部信息</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-3c14efe7937644888c8c7f01c7037ecc" data-id="3c14efe7937644888c8c7f01c7037ecc"><span><div id="3c14efe7937644888c8c7f01c7037ecc" class="notion-header-anchor"></div><a class="notion-hash-link" href="#3c14efe7937644888c8c7f01c7037ecc" 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-a90f20fa06274543990db84aea752c19">解法也是被ret2o.O师傅提点过</div><div class="notion-text notion-block-dfeff93c819e4ec183b9c060db603e88">使用堆风水（说人话就是控制堆申请的位置），让申请的内容块地址是之前的管理块，这样就可以达到任意读，show出heap基地址。</div><div class="notion-text notion-block-443d8c7b1f5e4ab6a54f9a2077ad4559">再通过申请让内容块的地址被指向heap基地址，也就是<b>tcache_perthread_struct。</b></div><div class="notion-text notion-block-c7aa0f189d424669b9fc19e84751bbe6">通过delete和add来将要的内容写入tcache_perthread_struct<b>，就凭空捏造了一个bin链中的chunk。</b>再将它申请出来修改为system</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-1c1742aa160e410bb0d13639c66ef752"><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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2F44ed9e3a-8660-49fc-865f-7cd385cdb449%2FUntitled.png?table=block&amp;id=1c1742aa-160e-410b-b0d1-3639c66ef752&amp;t=1c1742aa-160e-410b-b0d1-3639c66ef752&amp;width=708&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-ede2f90670624322b351e7796efd63a0"><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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2F0d37b44c-1037-43fb-8c18-c5d207222e1e%2FUntitled.png?table=block&amp;id=ede2f906-7062-4322-b351-e7796efd63a0&amp;t=ede2f906-7062-4322-b351-e7796efd63a0&amp;width=708&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-42b69d8e10d144708a96d3b32237b18d" data-id="42b69d8e10d144708a96d3b32237b18d"><span><div id="42b69d8e10d144708a96d3b32237b18d" class="notion-header-anchor"></div><a class="notion-hash-link" href="#42b69d8e10d144708a96d3b32237b18d" title="ptmalloc2 it&#x27;s myheap pro"><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"><b>ptmalloc2 it&#x27;s myheap pro</b></span></span></h2><div class="notion-row"><a target="_blank" rel="noopener noreferrer" class="notion-bookmark notion-block-95031201db28480ca0d570bad6a7e14b" href="https://bbs.kanxue.com/thread-280518.htm#msg_header_h2_4"><div><div class="notion-bookmark-title">[原创] Glibc-2.35下对tls_dtor_list的利用详解-Pwn-看雪-安全社区|安全招聘|kanxue.com</div><div class="notion-bookmark-description">[原创] Glibc-2.35下对tls_dtor_list的利用详解</div><div class="notion-bookmark-link"><div class="notion-bookmark-link-icon"><img src="https://bbs.kanxue.com/view/img/favicon.ico?t=95031201-db28-480c-a0d5-70bad6a7e14b" alt="[原创] Glibc-2.35下对tls_dtor_list的利用详解-Pwn-看雪-安全社区|安全招聘|kanxue.com" loading="lazy" decoding="async"/></div><div class="notion-bookmark-link-text">https://bbs.kanxue.com/thread-280518.htm#msg_header_h2_4</div></div></div></a></div><div class="notion-text notion-block-fa85c1be9e7841e396c849632c0e2102">这道题看的是后面的wp，只能说不愧是排名前三的队伍，这个解题思路真的厉害</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-a3a3a6ae9eae455aa05add2473e6d6be" data-id="a3a3a6ae9eae455aa05add2473e6d6be"><span><div id="a3a3a6ae9eae455aa05add2473e6d6be" class="notion-header-anchor"></div><a class="notion-hash-link" href="#a3a3a6ae9eae455aa05add2473e6d6be" 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-ebc4c85d155e4e3b93a13b30cc5ffe00">高版本的exit_hook：对tls_dtor_list的修改</div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-443e186ad7c8492699006bf85c0d48c8" data-id="443e186ad7c8492699006bf85c0d48c8"><span><div id="443e186ad7c8492699006bf85c0d48c8" class="notion-header-anchor"></div><a class="notion-hash-link" href="#443e186ad7c8492699006bf85c0d48c8" title=" exit → __run_exit_handlers → __call_tls_dtors"><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"><b> </b><code class="notion-inline-code"><b>exit</b></code><b> → </b><code class="notion-inline-code"><b>__run_exit_handlers</b></code><b> → </b><code class="notion-inline-code"><b>__call_tls_dtors</b></code></span></span></h4><div class="notion-text notion-block-7613675d04664b9c896fb71c6ea21559">当程序使用<b>exit</b>函数退出后，会进入 <b>__run_exit_handlers</b>函数</div><div class="notion-text notion-block-9c31235cb6bc492d8e77069826041602"><b>__run_exit_handlers</b>函数后，会首先判断 <b>__call_tls_dtors</b>和<b>run_dtors</b>是否为空，如果不为空就会调用 <b>__call_tls_dtors</b>函数</div><div class="notion-text notion-block-473565da48fa46c1885ac77f36dd9b46">相关示意：</div><ul class="notion-list notion-list-disc notion-block-db3a1e6f23b54b3a90b0b604f4c2e0b7"><li><b>__call_tls_dtors+10</b> 将<b>rbx</b>赋值为<b>0xffffffffffffffa8(-88)</b></li></ul><ul class="notion-list notion-list-disc notion-block-e3646836ed41481193fe6357a8b3028b"><li><b>__call_tls_dtors+17</b> 将<b>fs-88(tls_dtor_list)</b> 赋值给<b>rbp</b>（这为我们的栈迁移提供了条件）</li></ul><ul class="notion-list notion-list-disc notion-block-02aae78b5f1c4a6c8a5d7bafb5a69680"><li><b>__call_tls_dtors+21</b> 其实就是在判断<b>tls_dtor_list</b>是否为空</li></ul><ul class="notion-list notion-list-disc notion-block-70dfe41f6d25479a8b9216b79acbf268"><li>_<b>_call_tls_dtors+36</b> 将<b>tls_dtor_list</b>的第一个成员变量(偏移0，8 byte)赋值给<b>rax</b></li></ul><ul class="notion-list notion-list-disc notion-block-b54c73321475488cbd8a140f7cade5b3"><li><b>__call_tls_dtors+40</b>与 <b>__call_tls_dtors+53</b> 是对rax进行解密，先向右循环移位，再与<b>fs+0x30</b>上的值(一个随机数)进行异或</li></ul><ul class="notion-list notion-list-disc notion-block-9b23779713ba4e13a05359fbf169552f"><li><b>__call_tls_dtors+57</b> 将<b>tls_dtor_list</b>的第二个成员变量(偏移8，8 byte)赋值给<b>rdi</b></li></ul><ul class="notion-list notion-list-disc notion-block-ea6a565f85a8410eabc36840fb77582f"><li><b>__call_tls_dtors+61</b> 调用<b>rax</b></li></ul><div class="notion-blank notion-block-52292d3566b24816ab9d0f3393ab3b5b"> </div><div class="notion-text notion-block-c6a78ca6e0cc49d99675fe817f19bde3">这里给出链表结构体：</div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-a224b0df9f3642ec8ddd672e7c7f479a" data-id="a224b0df9f3642ec8ddd672e7c7f479a"><span><div id="a224b0df9f3642ec8ddd672e7c7f479a" class="notion-header-anchor"></div><a class="notion-hash-link" href="#a224b0df9f3642ec8ddd672e7c7f479a" title="exp"><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">exp</span></span></h4></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[0xgame2023]]></title>
            <link>https://ethanyi9.site/article/0xgame</link>
            <guid>https://ethanyi9.site/article/0xgame</guid>
            <pubDate>Tue, 05 Mar 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-9e3a48bd22dc4dadb7fe554ce556d15b"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><div class="notion-blank notion-block-ecc839847a0746e59f990de51f68026a"> </div><div class="notion-table-of-contents notion-gray notion-block-88806f5da17b4ecc84303b2407a9e57e"><a href="#852a08da4e704613ab1fb73530f2f085" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:0">week 1</span></a><a href="#6a137ae4e2cf4a08b12c3ad14c85e4ad" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">shellcode</span></a><a href="#7342d617b9a9451995bb3a866890c54f" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:0">week 2</span></a><a href="#ec00fb27170f4ffd8dad56784e57bed5" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:0">week 3</span></a><a href="#49e2eb9c7d1f47bca56a7db6674333ee" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">没了溢出，你能秒我？</span></a><a href="#88294d8906dd4e2381adb1fa489ac4a4" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:48px">关于one_gadget</span></a><a href="#3ff955456f7c4aeca1cb417934f040bb" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">fmt3</span></a><a href="#1b5b8d1428e24f8781c943a4286a2c97" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">all-in-one-file</span></a><a href="#cc76d7c54d6d4b6fad6525cdcfdd206a" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:0">week 4</span></a><a href="#73901079c0d54d66a87acf17b11a5728" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">srop</span></a><a href="#768b7a5166f14d449a205eedada43369" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">结束了？</span></a></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-852a08da4e704613ab1fb73530f2f085" data-id="852a08da4e704613ab1fb73530f2f085"><span><div id="852a08da4e704613ab1fb73530f2f085" class="notion-header-anchor"></div><a class="notion-hash-link" href="#852a08da4e704613ab1fb73530f2f085" title="week 1"><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">week 1</span></span></h2><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-6a137ae4e2cf4a08b12c3ad14c85e4ad" data-id="6a137ae4e2cf4a08b12c3ad14c85e4ad"><span><div id="6a137ae4e2cf4a08b12c3ad14c85e4ad" class="notion-header-anchor"></div><a class="notion-hash-link" href="#6a137ae4e2cf4a08b12c3ad14c85e4ad" title="shellcode"><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">shellcode</span></span></h3><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-7342d617b9a9451995bb3a866890c54f" data-id="7342d617b9a9451995bb3a866890c54f"><span><div id="7342d617b9a9451995bb3a866890c54f" class="notion-header-anchor"></div><a class="notion-hash-link" href="#7342d617b9a9451995bb3a866890c54f" title="week 2"><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">week 2</span></span></h2><div class="notion-file notion-block-9933352927a548deada215784e5f211d"><a target="_blank" rel="noopener noreferrer" class="notion-file-link" href="https://notion.so/signed/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2Fd173317a-6b79-4eba-9c8b-e371cdf8382c%2FUntitled.pdf?table=block&amp;id=99333529-27a5-48de-ada2-15784e5f211d"><svg class="notion-file-icon" viewBox="0 0 30 30"><path d="M22,8v12c0,3.866-3.134,7-7,7s-7-3.134-7-7V8c0-2.762,2.238-5,5-5s5,2.238,5,5v12c0,1.657-1.343,3-3,3s-3-1.343-3-3V8h-2v12c0,2.762,2.238,5,5,5s5-2.238,5-5V8c0-3.866-3.134-7-7-7S6,4.134,6,8v12c0,4.971,4.029,9,9,9s9-4.029,9-9V8H22z"></path></svg><div class="notion-file-info"><div class="notion-file-title">官网wp-week2</div><div class="notion-file-size">134.1KB</div></div></a></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-ec00fb27170f4ffd8dad56784e57bed5" data-id="ec00fb27170f4ffd8dad56784e57bed5"><span><div id="ec00fb27170f4ffd8dad56784e57bed5" class="notion-header-anchor"></div><a class="notion-hash-link" href="#ec00fb27170f4ffd8dad56784e57bed5" title="week 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">week 3</span></span></h2><div class="notion-file notion-block-4829444285f1441c9be5be76cf9b3bd3"><a target="_blank" rel="noopener noreferrer" class="notion-file-link" href="https://notion.so/signed/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2F8c35b25d-aafa-464f-87ea-b80433166b95%2FUntitled.pdf?table=block&amp;id=48294442-85f1-441c-9be5-be76cf9b3bd3"><svg class="notion-file-icon" viewBox="0 0 30 30"><path d="M22,8v12c0,3.866-3.134,7-7,7s-7-3.134-7-7V8c0-2.762,2.238-5,5-5s5,2.238,5,5v12c0,1.657-1.343,3-3,3s-3-1.343-3-3V8h-2v12c0,2.762,2.238,5,5,5s5-2.238,5-5V8c0-3.866-3.134-7-7-7S6,4.134,6,8v12c0,4.971,4.029,9,9,9s9-4.029,9-9V8H22z"></path></svg><div class="notion-file-info"><div class="notion-file-title">官方wp</div><div class="notion-file-size">158.1KB</div></div></a></div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-49e2eb9c7d1f47bca56a7db6674333ee" data-id="49e2eb9c7d1f47bca56a7db6674333ee"><span><div id="49e2eb9c7d1f47bca56a7db6674333ee" class="notion-header-anchor"></div><a class="notion-hash-link" href="#49e2eb9c7d1f47bca56a7db6674333ee" 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-aeae0f197a904a5d96a2c1cc83b3cab2">这道题很有意思，是利用了程序自带的<code class="notion-inline-code">leave</code> 指令，同时也是一道在栈范围的off-by-one问题。这个思路我觉得很值得介绍。感觉应该在栈范围是对我有点启发的。</div><div class="notion-text notion-block-28063d74384240b9b1a855c0047c3fea">程序源码大概是这样：</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-970c80f917974fbbae50b53a945118bb"><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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2F93a43116-5147-434e-86a6-9713f1758c44%2FUntitled.png?table=block&amp;id=970c80f9-1797-4fbb-ae50-b53a945118bb&amp;t=970c80f9-1797-4fbb-ae50-b53a945118bb&amp;width=707.9625244140625&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-d569f63d43b448c69a0149cb9584e9fd"><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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2Ff56f7c3d-3bd5-481a-a6d3-17d752fee9ed%2FUntitled.png?table=block&amp;id=d569f63d-43b4-48c6-9a01-49cb9584e9fd&amp;t=d569f63d-43b4-48c6-9a01-49cb9584e9fd&amp;width=707.9874877929688&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-d33517926e9642fc83507281ec06c4ce">看到这里，就需要想到第一个注重的点：我们这个程序在退回时经历了两次leave指令，这很重要，如果我们要涉及到关于栈迁移到思路的时候，这里就是天然的栈迁移。</div><div class="notion-text notion-block-dfcb6bc4c5e54f7b8d4cfcb37807a480">如果我们可以修改到栈中rbp的值，那么在两次函数返回的时候，rsp指令就会直接指向被修改的rbp的值加8的地址。</div><div class="notion-text notion-block-1374982b71354ee0b6df5388ee8e1fe2">然后我们进入<code class="notion-inline-code">custom_gets_off_by_one_or_null</code> 这个函数</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-b7433531704b4d8294c8241439cbc377"><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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2F12f66274-93bb-4d34-b478-9b71de0aa466%2FUntitled.png?table=block&amp;id=b7433531-704b-4d82-94c8-241439cbc377&amp;t=b7433531-704b-4d82-94c8-241439cbc377&amp;width=707.9874877929688&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-526a3381325f45318f69416b60b3af48">这里有一个很明显的off-by-one漏洞，这个漏洞可以让我们修改rbp的值，当然，只能修改到最低的一位</div><div class="notion-text notion-block-b32f24cfb25e462baad31d2945059495">我们只能赌一下，赌我们将rbp最后一位变成零之后，经过两次leave指令后被修改的rsp指针会指向<code class="notion-inline-code">v1</code> 的中间位置，这个位置也就是我们修改以后的地方。</div><div class="notion-text notion-block-330f980fe6a24afba08e304c0e1f1a19">同时要保证我们的payload最大可能性的被利用，方法就是在我们输入的payload的前端全部变成<code class="notion-inline-code">ret</code> 指令，然后在最后才进行我们的payload的输入。也就是这样</div><div class="notion-text notion-block-ca8cd246d86d446bbdcbf9c8eaf34b51">这个思路和之前week 1 中的shellcode那个题很像，只不过那个题是添加了<code class="notion-inline-code">nop</code> 指令，由此看来，这个思路是真的在栈漏洞方面比较通用的。</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-3162a6f35cad431d906d54ca1e8026ad"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:616px;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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2F6b5388fb-85fc-4b7b-a670-35165286f3e5%2FUntitled.png?table=block&amp;id=3162a6f3-5cad-431d-906d-54ca1e8026ad&amp;t=3162a6f3-5cad-431d-906d-54ca1e8026ad&amp;width=616&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-4ffe6460988c47098f7f6549bf09b85f">本题的exp如下：</div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-88294d8906dd4e2381adb1fa489ac4a4" data-id="88294d8906dd4e2381adb1fa489ac4a4"><span><div id="88294d8906dd4e2381adb1fa489ac4a4" class="notion-header-anchor"></div><a class="notion-hash-link" href="#88294d8906dd4e2381adb1fa489ac4a4" title="关于one_gadget"><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">关于one_gadget</span></span></h4><div class="notion-text notion-block-26fb0d181dfc4ff7846eaee41b0b4c9d">one_gadget的指令我偶尔会用，但是总是意识不到他的限制点是可以直接通过人工进行绕过的</div><div class="notion-text notion-block-050430c4e11f46999b038a5386e1a014">例如：</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-108ecab0aad2457b8da849bad28bcc2b"><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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2F51dc3b07-3471-470b-ad0d-09e5dfe6392c%2FUntitled.png?table=block&amp;id=108ecab0-aad2-457b-8da8-49bad28bcc2b&amp;t=108ecab0-aad2-457b-8da8-49bad28bcc2b&amp;width=707.9874877929688&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-30010faf42c942bc8550141fd0e11ba7">这个地方，这个地方的0xe3afe的one gadget，限制条件是r15和r12的值需要等于0</div><div class="notion-text notion-block-3e83ba1634f9421fbd535539c02d68c6">这个应该还是有点熟悉的，这两个寄存器同时存在的时候，直接用payload将0输入进去即可</div><div class="notion-text notion-block-5d098c5b55964dbd8185aaddf09d6d9c">这样就可以直接让one-gadget可以被使用了！</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-3ff955456f7c4aeca1cb417934f040bb" data-id="3ff955456f7c4aeca1cb417934f040bb"><span><div id="3ff955456f7c4aeca1cb417934f040bb" class="notion-header-anchor"></div><a class="notion-hash-link" href="#3ff955456f7c4aeca1cb417934f040bb" title="fmt3"><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">fmt3</span></span></h3><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-a168ccbf7b1c47d78d9d44b31f6c8e8c"><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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2Fd915e06c-7079-4a07-9b3d-e318bb888f06%2FUntitled.png?table=block&amp;id=a168ccbf-7b1c-47d7-8d9d-44b31f6c8e8c&amp;t=a168ccbf-7b1c-47d7-8d9d-44b31f6c8e8c&amp;width=707.9874877929688&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-92579e43e3cb4e70bd6421439b855d2b">我自己的代码如下:</div><div class="notion-text notion-block-cb3cde87c9ef41098a755dcf24c95628">疑问：</div><ul class="notion-list notion-list-disc notion-block-6e9322b5ae6a4aa99aa3e923c0cf890b"><li>关于格式化字符串到底是怎么进行漏洞利用的？为什么<code class="notion-inline-code">fmtstr_payload(8,{ret_addr : one_gadget_addr})</code> 不能利用？在offset正常的情况下</li></ul><ul class="notion-list notion-list-disc notion-block-f6790f2346994c24b9e2c9681a594304"><li>如果是不满足<code class="notion-inline-code">one_gadget_addr</code> 限定的条件下，那为什么<code class="notion-inline-code">fmtstr_payload(8,{printf_got: system_addr})</code> 也不是正确的？</li></ul><div class="notion-text notion-block-e45a4283100149c4a517f66d9603d767">以下是官方wp的代码：</div><div class="notion-text notion-block-ab08d83b08b9417c8f32afa93882da32">这个代码主要涉及到的是关于fmtstr_payload函数的使用，以及关于one_gadget的限制突破，结合起来其实理论上是将fmtstr_payload中的值，化为一个ROP的链。</div><div class="notion-text notion-block-d9cf16ad2f2e4c38a488eaf001365284">这个链可以将one_gadget的限制进行绕过，但是我不知道怎么用fmtstr_payload函数实现。</div><div class="notion-text notion-block-36a3202011064615a3caf0a41322d80d">fmtstr_payload函数的原型是有<code class="notion-inline-code">write_size</code> 参数，这个参数理论上是针对单个参数更改的时候可以很方便的进行，但是在针对像是ROP链的时候，就实现不了了</div><div class="notion-text notion-block-1b79f31463bc4c559c43a59fb471032a">例如我想将返回地址设置成以下的样子：</div><div class="notion-text notion-block-36696c4079ee4fa1a3a929a8ae368a46">那就代表我必须进行，将所有的地址都按照 <code class="notion-inline-code">write_size=&#x27;long&#x27;</code> 这样的规格进行，但是在64位修改地址的时候，地址数字太大了不能进行修改，搞得我目前也不知道该怎么办</div><div class="notion-text notion-block-f51d3b41d520447ebe2b2a417d372608">不过我找寻了其他的payload，以下payload应该可以实现：</div><div class="notion-text notion-block-a3963250aab04954a48e6da1762f902e">使用场景（以本题为例）：</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-1b5b8d1428e24f8781c943a4286a2c97" data-id="1b5b8d1428e24f8781c943a4286a2c97"><span><div id="1b5b8d1428e24f8781c943a4286a2c97" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1b5b8d1428e24f8781c943a4286a2c97" title="all-in-one-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">all-in-one-file</span></span></h3><div class="notion-text notion-block-8d58e0a5eb854c95b21346438cbf14c8">直接没看懂什么意思，文件1被关闭了那我该怎么办？</div><div class="notion-text notion-block-a09c7ce1f68e4036bd69efe30c87bb79">解答：</div><div class="notion-text notion-block-adf13585d2cb4ff0a218d91165d14f0d">使用脚本即可，输入时的回车键在程序判断的时候会形成干扰，导致不能够被执行</div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-cc76d7c54d6d4b6fad6525cdcfdd206a" data-id="cc76d7c54d6d4b6fad6525cdcfdd206a"><span><div id="cc76d7c54d6d4b6fad6525cdcfdd206a" class="notion-header-anchor"></div><a class="notion-hash-link" href="#cc76d7c54d6d4b6fad6525cdcfdd206a" title="week 4"><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">week 4</span></span></h2><div class="notion-file notion-block-23f14736d17147c9b5acade88c94e202"><a target="_blank" rel="noopener noreferrer" class="notion-file-link" href="https://notion.so/signed/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2Fb6f853be-a2ae-4789-8454-05586d205269%2FUntitled.pdf?table=block&amp;id=23f14736-d171-47c9-b5ac-ade88c94e202"><svg class="notion-file-icon" viewBox="0 0 30 30"><path d="M22,8v12c0,3.866-3.134,7-7,7s-7-3.134-7-7V8c0-2.762,2.238-5,5-5s5,2.238,5,5v12c0,1.657-1.343,3-3,3s-3-1.343-3-3V8h-2v12c0,2.762,2.238,5,5,5s5-2.238,5-5V8c0-3.866-3.134-7-7-7S6,4.134,6,8v12c0,4.971,4.029,9,9,9s9-4.029,9-9V8H22z"></path></svg><div class="notion-file-info"><div class="notion-file-title">官方wp-week4</div><div class="notion-file-size">104.8KB</div></div></a></div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-73901079c0d54d66a87acf17b11a5728" data-id="73901079c0d54d66a87acf17b11a5728"><span><div id="73901079c0d54d66a87acf17b11a5728" class="notion-header-anchor"></div><a class="notion-hash-link" href="#73901079c0d54d66a87acf17b11a5728" title="srop"><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">srop</span></span></h3><div class="notion-text notion-block-25fba0ffa3524c469f67be9ca1186c8c">关于过滤器</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-9634ed8770dd4a64841ea6fd4e7ae99d"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:621px;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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2F395deeea-63e4-4c6c-998b-7b55c91da515%2FUntitled.png?table=block&amp;id=9634ed87-70dd-4a64-841e-a6fd4e7ae99d&amp;t=9634ed87-70dd-4a64-841e-a6fd4e7ae99d&amp;width=621&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-2b02dcec8876422385d6674425fc4afa">这个SROP让我真正地大致明白了什么是具体的SROP解法，其实相对来说很简单：</div><div class="notion-text notion-block-b577430b339e4ddabffcc0be0d46ec4c">就是利用<code class="notion-inline-code">sigreturn</code> 系统调用，其他的说什么都是空的，就是利用这个系统调用就行了</div><div class="notion-text notion-block-89d65000ae824ddb8120d65f64837baf">首先构造一个frame：</div><div class="notion-text notion-block-4cdec54700504e41a794697fe121eacd">这个frame用来作为srop中sigreturn系统调用返回之后的改变寄存器的模版，他甚至可以实现栈迁移，因为我们的rsp可以直接被改。</div><div class="notion-text notion-block-5cbb068be8224997ad3558124a248f51">在同时也可以把执行的代码（rip）修改，改变此时程序的调用方向。</div><div class="notion-text notion-block-b92d2f25da46430297bd838ea918c881">然后在我们本就熟悉的ROP链的构造的基础上，再进行srop的调用</div><div class="notion-text notion-block-a56aad26dad34abea3dd80db7486e3ef">这道题只是在同时结合了orw，用open、read、write的方法输出了flag而已</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-768b7a5166f14d449a205eedada43369" data-id="768b7a5166f14d449a205eedada43369"><span><div id="768b7a5166f14d449a205eedada43369" class="notion-header-anchor"></div><a class="notion-hash-link" href="#768b7a5166f14d449a205eedada43369" 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-0fdeaf6480af49e0afc6bd898cd35311">这道题我真的学到了！！！</div><div class="notion-text notion-block-a901cfb607774c2781ccac3015208fff">栈迁移原来是可以这样写。</div><div class="notion-text notion-block-44eea0bc6ff546d78ca775d020db7363">我们将文件放到ida中，发现</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-6d2bc73d0d50493c885cf632ba66f8d3"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:633px;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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2Feb9464db-1baf-4038-8bbd-b85931b0c5c2%2FUntitled.png?table=block&amp;id=6d2bc73d-0d50-493c-885c-f632ba66f8d3&amp;t=6d2bc73d-0d50-493c-885c-f632ba66f8d3&amp;width=633&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-c602b93baca848a0b5e072418500744c">有个sandbox，所以不能进行exec，那就进行orw就行</div><div class="notion-text notion-block-7d141d702b814e1da16a5a701da07a11">然后因为有个格式化字符串函数，可以泄露内存地址</div><div class="notion-text notion-block-2a039746bc29464bbb429c8cb43afe20">重点来了，重点，我们发现栈溢出的地方很短，也就到返回地址处，也就是刚刚溢出两个栈帧长度</div><div class="notion-text notion-block-f6e2c8bcdb514f95b8ca3da2dedc9d92">那么肯定就要考虑栈迁移。</div><blockquote class="notion-quote notion-block-5ca8c583b3304c139cc0b961129a5bc3"><div>我以前对栈迁移的理解基本上就是迁移到栈中我们可以写的变量的原本位置，再继续输入ROP链。</div></blockquote><blockquote class="notion-quote notion-block-3b6ac1143450477eba47c13b4457da7e"><div>但是这个题不一样，这个题因为如果只迁移到局部变量开始处，哪怕修改了内容为ROP链，因为执行不了<code class="notion-inline-code">exec</code> 函数，只有orw但是orw的ROP链太长了，根本塞不下。</div></blockquote><div class="notion-text notion-block-8e6773bd113d4166bbfbdfbaab4d4475">所以该怎么弄呢？那就是利用函数自带的leave指令，通过修改rbp值的方式将rsp、rbp俩寄存器的值进行调用。</div><div class="notion-text notion-block-e014d16ddde145a98cf2e9e4703b6e5d">首先修改返回地址到偏移量<code class="notion-inline-code">0x148D</code></div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-5858572a9aad417a810fe29fc92e760d"><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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2F2e7bb2e1-b027-4f54-a068-bb424191dbfb%2FUntitled.png?table=block&amp;id=5858572a-9aad-417a-810f-e29fc92e760d&amp;t=5858572a-9aad-417a-810f-e29fc92e760d&amp;width=707.9750366210938&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-347c008ad37a4395a16eaf80da71533a">巧妙地利用了原本就存在的read函数，同时也可以更改rbp的值，这次返回到0x148D的同时，rbp也转到了<code class="notion-inline-code">elf.address + 0x4400 + 0x40</code> 的位置</div><div class="notion-text notion-block-f33d4f59546846e9b9b14826ab54be89">然后这次read函数需要send一个字符串，这个字符串就是要被写在<code class="notion-inline-code">rbp-0x40</code> 的地址上。</div><div class="notion-text notion-block-6ccea32d3abc4785a091d5c616351366">然后这次main函数结束，<code class="notion-inline-code">rbp</code>转为<code class="notion-inline-code">elf.address + 0x4400</code> ，<code class="notion-inline-code">rsp</code>转到原来的<code class="notion-inline-code">rbp+8</code> ，也就是<code class="notion-inline-code">leave_ret</code>的地方。</div><div class="notion-text notion-block-5b6d5bb7fa70445ba144a1fd7fe547b3">执行它，rbp重新变为<code class="notion-inline-code">elf.address + 0x4400 + 0x40</code> ，<code class="notion-inline-code">rsp</code>变为指向<code class="notion-inline-code">pop rdx</code>这里，进行这一串ROP链的执行，因为之前的<code class="notion-inline-code">rdi、rsi</code>寄存器都没变，所以直接写<code class="notion-inline-code">rdx</code>的值，将我们下次可以输入的ROP长度变大。</div><div class="notion-text notion-block-9cdd200a235b4a7cbf660a7bdaf4824b">然后重新在<code class="notion-inline-code">elf.address + 0x4400</code> 的地址上进行ROP链的输入即可，注意此时rsp的值其实是指向<code class="notion-inline-code">elf.address + 0x4400+0x20</code>了，所以我们在进行重写的时候需要将之前的几个位置用字符填满，或者是将其进行ret来将其“滑”到+0x20的地址</div><div class="notion-text notion-block-203ec52c010246b0b1acd972218fbf97">整体代码：</div><div class="notion-file notion-block-cb9860a2dcac475bb597076b7e53ed33"><a target="_blank" rel="noopener noreferrer" class="notion-file-link" href="https://notion.so/signed/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2F008e9aab-e0ca-487b-ba7f-10ac2ffdfb90%2FUntitled.pdf?table=block&amp;id=cb9860a2-dcac-475b-b597-076b7e53ed33"><svg class="notion-file-icon" viewBox="0 0 30 30"><path d="M22,8v12c0,3.866-3.134,7-7,7s-7-3.134-7-7V8c0-2.762,2.238-5,5-5s5,2.238,5,5v12c0,1.657-1.343,3-3,3s-3-1.343-3-3V8h-2v12c0,2.762,2.238,5,5,5s5-2.238,5-5V8c0-3.866-3.134-7-7-7S6,4.134,6,8v12c0,4.971,4.029,9,9,9s9-4.029,9-9V8H22z"></path></svg><div class="notion-file-info"><div class="notion-file-title">全体官方wp</div><div class="notion-file-size">20066.8KB</div></div></a></div><div class="notion-blank notion-block-7064264a45984b439611505573354f11"> </div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hgame 2024 复现]]></title>
            <link>https://ethanyi9.site/article/hgame</link>
            <guid>https://ethanyi9.site/article/hgame</guid>
            <pubDate>Tue, 05 Mar 2024 00:00:00 GMT</pubDate>
            <description><![CDATA[关于hgame2024 pwn方向的wp，目前week 2和week3已复现完毕，week4 施工中]]></description>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-cfa1acfd66f14e3f98fe07db784cb088"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><div class="notion-table-of-contents notion-gray notion-block-7e39aab6c0134c31b9fbc3f3cf11cad5"><a href="#b9eec92113884a51a813d8e774e7c823" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:0">Week 2</span></a><a href="#4de9b2a909fa4d658f9c4b7e082f7565" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">tcache posion</span></a><a href="#03f94a3a3a984d3b8e6a8707ad46f15f" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">shellcodemaster</span></a><a href="#28cdb4fdb5d943589537a3236b0b147e" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">fastnote</span></a><a href="#6a46121d2f384249bb185f2e63d7218e" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:0">week 3</span></a><a href="#2e8628a86313437dba56b52750afc545" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">Elden Ring Ⅲ</span></a><a href="#02eb5645a7d945ec9250b1dbdc2f1722" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">off-by-null（house of einherjar）</span></a></div><div class="notion-blank notion-block-ffef5742b26e428b8ae3a0f005e0c413"> </div><div class="notion-text notion-block-3d201b6c071448dcab5bb698300ad508">我真的太菜了！！今年一定要超出game范畴！</div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-b9eec92113884a51a813d8e774e7c823" data-id="b9eec92113884a51a813d8e774e7c823"><span><div id="b9eec92113884a51a813d8e774e7c823" class="notion-header-anchor"></div><a class="notion-hash-link" href="#b9eec92113884a51a813d8e774e7c823" title="Week 2"><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">Week 2</span></span></h2><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-4de9b2a909fa4d658f9c4b7e082f7565" data-id="4de9b2a909fa4d658f9c4b7e082f7565"><span><div id="4de9b2a909fa4d658f9c4b7e082f7565" class="notion-header-anchor"></div><a class="notion-hash-link" href="#4de9b2a909fa4d658f9c4b7e082f7565" title="tcache posion"><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">tcache posion</span></span></h3><div class="notion-text notion-block-d1fba73ce02d4a849ee5d33b0bc51a65">这是一道模板题，是关于tcache posion的一道模板题</div><div class="notion-text notion-block-5ed6ca166305448a86de224c11aaac16">我们知道在2.31之后其实tcache dup基本就是不能用的，要用也是用house of botcake来实现dup操作</div><div class="notion-text notion-block-678eb9c59a8d4daaaaf0f43bc13b7402">当然，这道题还没有达到这个程度，他只是一道比较简单的签到题，或者就是一个不需要思考的poison题</div><div class="notion-text notion-block-c4f50de415604dffb358dbae730fbf57">打开反汇编：</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-4b43a97eb0df4c8b967ee4c820362bae"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:622px;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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2F453082a7-b7f9-456d-8a61-0c3c9066d70b%2FUntitled.png?table=block&amp;id=4b43a97e-b0df-4c8b-967e-e4c820362bae&amp;t=4b43a97e-b0df-4c8b-967e-e4c820362bae&amp;width=622&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-4d703823e4c1493abecfb728b7b06863">add函数：两个数组，一个存地址，一个存size</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-3fbcd5f249b3469fa2da5f0c01ac3218"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:647.9750366210938px;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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2F05dd31a9-6f7f-4b5a-8dd8-142f26345e78%2FUntitled.png?table=block&amp;id=3fbcd5f2-49b3-469f-a2da-5f0c01ac3218&amp;t=3fbcd5f2-49b3-469f-a2da-5f0c01ac3218&amp;width=647.9750366210938&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-2fef1f078e2442f295d554f28fb8775d">del函数，uaf很明显</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-54c41b765e6e422b9f653909d1bc871a"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:647.9750366210938px;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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2Fa589df67-fd9d-4c85-a289-d8fc2593e219%2FUntitled.png?table=block&amp;id=54c41b76-5e6e-422b-9f65-3909d1bc871a&amp;t=54c41b76-5e6e-422b-9f65-3909d1bc871a&amp;width=647.9750366210938&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-312ed7e1ff34495885ec51fd54f6794b">edit函数，可以对free或者对没有free的都进行edit</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-76fb4aca1cb240b09879370ed749b472"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:599px;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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2Feb2e5276-8e9b-42d2-b1b6-549caddb59aa%2FUntitled.png?table=block&amp;id=76fb4aca-1cb2-40b0-9879-370ed749b472&amp;t=76fb4aca-1cb2-40b0-9879-370ed749b472&amp;width=599&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-ab1a17e303a74121af41a0ccbf68457c">show函数，同上，都可以show</div><div class="notion-text notion-block-f9b8a7156739446ebd1f4bdb43fdf180">exp：</div><div class="notion-text notion-block-5449322e84e44416b2e2ede39207aadc">这里我们也可以用它来总结一下：</div><ul class="notion-list notion-list-disc notion-block-fdff082345e6476ca86d2d7b83ba7a66"><li>在堆类型题目，想要拿libc的地址最简单的还是使用main_arena</li></ul><ul class="notion-list notion-list-disc notion-block-a5f405508faa410db2a350e4feae4653"><li>tcache bin的poison，可以进行，但以防万一还是使用一条0x80大小来进行libc的leak，另一个像是0x20这种用来进行poison（至少在2.31中这种操作是可以的，其实单用一个大小的链也可以，就是转换着很麻烦）</li></ul><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-03f94a3a3a984d3b8e6a8707ad46f15f" data-id="03f94a3a3a984d3b8e6a8707ad46f15f"><span><div id="03f94a3a3a984d3b8e6a8707ad46f15f" class="notion-header-anchor"></div><a class="notion-hash-link" href="#03f94a3a3a984d3b8e6a8707ad46f15f" title="shellcodemaster"><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">shellcodemaster</span></span></h3><div class="notion-text notion-block-c7d31c6e29834f60a64433b56891a2e8">又是一道shellcode题目，这道题目目的是想要让新生学会对shellcode进行缩减，来达到执行shellcode的目的，同时也利用了mprotect调用</div><div class="notion-text notion-block-d2d0ad4b11cd41d69cc60b3f4fbb12fc">查看限制，发现没有pie：</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-6324c917e4b145428ae0b0f9b417a0a5"><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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2F19c946c8-d80d-43f4-90a1-ebc402d7b987%2FUntitled.png?table=block&amp;id=6324c917-e4b1-4542-8ae0-b0f9b417a0a5&amp;t=6324c917-e4b1-4542-8ae0-b0f9b417a0a5&amp;width=708&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-1e1e7804f051435a9be84fd4f09e0e1a">不过这个限制在这个题目中没有什么用</div><div class="notion-text notion-block-43d7d6e5860f4ed3b0fef9a1dc61adf1">然后看反汇编代码：</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-548c1f830cff45cd9335901c895623df"><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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2Faf33dac2-a59b-435f-a27a-3a7cef176db4%2FUntitled.png?table=block&amp;id=548c1f83-0cff-45cd-9335-901c895623df&amp;t=548c1f83-0cff-45cd-9335-901c895623df&amp;width=708&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-e7fb8259de474e02a178bfbc79e91ba3">发现首先用mmap申请了一个内存空间在0x2333000处，这个地址被赋予给了buf变量，然后我们可以对这个空间进行0x16个字节的写入，然后用<code class="notion-inline-code">mprotect</code> 函数，将这片地址空间变成了仅可写的权限。</div><div class="notion-text notion-block-6185076d68754c7dbfdbe2c166795f62">我们可以就此展开操作：</div><ul class="notion-list notion-list-disc notion-block-88d77dafe7c048f2b3968443a0801550"><li>为应对0x16的字节输入，我们可以想到先输入进一个read系统调用，来绕过这个0x16的字节输入。</li></ul><ul class="notion-list notion-list-disc notion-block-72f83bd013804550916b108c5874ea35"><li>如果我们要read进入其他的地方，后续的操作相对有点麻烦，所以可以进行对mprotect的二次修改，也就是我们在这0x16字节中加入mprotect系统调用，将这篇内存修改为可以写入，然后在使用read</li></ul><div class="notion-text notion-block-2e02515713004d79a65eed9778bf3e98">这里是代码：</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-28cdb4fdb5d943589537a3236b0b147e" data-id="28cdb4fdb5d943589537a3236b0b147e"><span><div id="28cdb4fdb5d943589537a3236b0b147e" class="notion-header-anchor"></div><a class="notion-hash-link" href="#28cdb4fdb5d943589537a3236b0b147e" title="fastnote"><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">fastnote</span></span></h3><div class="notion-text notion-block-21800aead76142ea852fbde979cdcaf4">这个题是考查了关于是2.31中的dup，具体来说是fastbin dup，在2.31中确实是要比house of botcake方便不少，起码是直接就可以进行的思路</div><div class="notion-text notion-block-08fb9da5608f438db326045c17f59818">做题思路如下：</div><ul class="notion-list notion-list-disc notion-block-8e1f8727aa58457c8c49f516c0798c71"><li>首先利用unsorted bin的main_arena来leak glibc</li></ul><ul class="notion-list notion-list-disc notion-block-ff5202d3250243dea9893a3b7beaa77f"><li>然后重新申请0x20的chunk，申请9个并都释放，对多出来的两个分别命名chunk1、chunk2</li></ul><ul class="notion-list notion-list-disc notion-block-60f92003c1a740e88c5d65547c84d43f"><li>再次释放chunk2，这样在fastbin中就是chunk2→chunk1→chunk2</li></ul><ul class="notion-list notion-list-disc notion-block-c6d99e8407cd4b5d876316d63925984b"><li>申请chunk2，content写free_hook地址，bin中现在就是chunk1→chunk2→free_hook</li></ul><ul class="notion-list notion-list-disc notion-block-bf27ffb9907b46dd8546909080e1eb63"><li>连续申请三个，第三个的content写system地址，这样就完成将system写入free_hook</li></ul><div class="notion-text notion-block-1aaaaa26632e429baa29509a46a82e05">exp</div><div class="notion-blank notion-block-b21a465579454bd19991e4829fa3574f"> </div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-6a46121d2f384249bb185f2e63d7218e" data-id="6a46121d2f384249bb185f2e63d7218e"><span><div id="6a46121d2f384249bb185f2e63d7218e" class="notion-header-anchor"></div><a class="notion-hash-link" href="#6a46121d2f384249bb185f2e63d7218e" title="week 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">week 3</span></span></h2><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-2e8628a86313437dba56b52750afc545" data-id="2e8628a86313437dba56b52750afc545"><span><div id="2e8628a86313437dba56b52750afc545" class="notion-header-anchor"></div><a class="notion-hash-link" href="#2e8628a86313437dba56b52750afc545" title="Elden Ring Ⅲ"><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">Elden Ring Ⅲ</span></span></h3><div class="notion-text notion-block-9839ae8a5adc4c2bbf8b2848d33b5a26">这个题其实是一个涉及到了largebin attack的题目，我们首先看看反汇编</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-8a0507cf04564f6f840fb23db70d4916"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:345px;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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2F23d1b5b2-5e23-46bb-8749-c6ec06b4df82%2FUntitled.png?table=block&amp;id=8a0507cf-0456-4f6f-840f-b23db70d4916&amp;t=8a0507cf-0456-4f6f-840f-b23db70d4916&amp;width=345&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-d32d4f03f3d54e60b2428603193f41f5">可以看到add函数中，只能进行对大于0x4ff的chunk的赋予，这个chunk由于已经远远大于small bin的范围（0x3f0，在某些版本中），所以当它们被完整释放之后一定是会进入large bin</div><div class="notion-text notion-block-44b25eb80c0643a580f76d5a43242bf6">large bin attack的逻辑是这样的：</div><ul class="notion-list notion-list-disc notion-block-f1e50d3fe341485ba46e0c97cd482b41"><li>首先有一个chunk进入large bin，同时这个chunk是可以被修改的（由于UAF或是其他漏洞）</li></ul><ul class="notion-list notion-list-disc notion-block-2a8843a2039a427ea463717f88f1323f"><li>将这个large bin的fd_nextsize和bk_nextsize修改为<code class="notion-inline-code">任意写的地址-0x20</code> ，这个任意写的地址会被看作是一个假chunk，这样在进行后一个largebin的添加的时候，链表之间链接的逻辑会将新进入的large bin的chunk地址赋予给这个 <code class="notion-inline-code">任意写的地址</code> （具体是由于源码中的这行代码），它将新的chunk地址赋予给了虚假的<code class="notion-inline-code">victim-&gt;bk_nextsize-&gt;fd_nextsize</code></li></ul><ul class="notion-list notion-list-disc notion-block-a43c4d3ca1864df2ba7e3078f68b1adf"><li>这样我们就可以实现任意地址写的功能，但是能够写的值都是chunk地址</li></ul><div class="notion-text notion-block-f42224aa60984371b0cafda652acc7ea">在这个题中，通过这个attack将mp_结构体中的值进行了修改，mp_结构体是这样的：</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-b422d949df2f47229d049b4148618d81"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:345px;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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2Fbd142a64-a189-4cf7-9c01-c3a92db74606%2FUntitled.png?table=block&amp;id=b422d949-df2f-4722-9d04-9b4148618d81&amp;t=b422d949-df2f-4722-9d04-9b4148618d81&amp;width=345&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-1faaa5a43c5d4ca9b2612839220f592e">可以看出它负责关于tcache bin的相关数据，这个结构体中的<code class="notion-inline-code">tcache_bins</code> 项就代表了<code class="notion-inline-code">tcache_perthread_struct</code> 中的数组大小<code class="notion-inline-code">TCACHE_MAX_BINS</code> ，如果我们将这个参数进行修改，可以看作我们将tcache bin的范围远远扩大，0x500大小的chunk这下可以直接进入tcache bin而不是unsorted bin了</div><div class="notion-text notion-block-679c1c166f114270820d540360c55b5a">由于还有UAF，这样就可以实现tcache posion来进行free_hook的修改了</div><div class="notion-text notion-block-f708830d54234819a8b6693ed768add4">exp如下：</div><div class="notion-text notion-block-3fa6c99ec7094950b7f2a129cfeebe7f">注意：在2.31以后的large bin attack，如果free的chunk大于large bin中的chunk，会报double free的错误，具体代码如下：</div><div class="notion-text notion-block-8795121eb91845e8aa74eac2b9b35238">具体逻辑我还需要在研究研究，但是尝试着确实是存在报错问题，如果有大佬的看到这个博客希望可以帮我解释一下呜呜。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-02eb5645a7d945ec9250b1dbdc2f1722" data-id="02eb5645a7d945ec9250b1dbdc2f1722"><span><div id="02eb5645a7d945ec9250b1dbdc2f1722" class="notion-header-anchor"></div><a class="notion-hash-link" href="#02eb5645a7d945ec9250b1dbdc2f1722" title="off-by-null（house of einherjar）"><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">off-by-null（house of einherjar）</span></span></h3><div class="notion-text notion-block-81f1bc35b0604bedaf7372b500921dd0">这个题是一个考察off-by-null和malloc_consolidate的题目，所以我就直接把它叫做off-by-null了</div><div class="notion-text notion-block-b87f2459b193474bbecf9505ecdc452f"><code class="notion-inline-code">malloc_consolidate</code> ：用于将 fastbin 中的空闲 chunk 合并整理到 unsorted_bin 中以及进行初始化堆的工作</div><div class="notion-callout notion-gray_background_co notion-block-2f308e1305894934a9a1a35707b0d7bd"><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"><s>注意：</s><s><code class="notion-inline-code">malloc_consolidate</code></s><s>只能实现在除tcache bins以外的bin中，可能是因为tcache bin中的结构体是由</s><s><code class="notion-inline-code">tcache_entry</code></s><s>构成的链表，和chunk存在细微区别，所以在malloc的源码中关于</s><s><code class="notion-inline-code">malloc_consolidate</code></s><s>中没有关于tcache bin的内容</s></div></div><div class="notion-text notion-block-8eb16c9c41de4e93ad216af39eedb4a1">注意：在进行malloc_consolidate中，使用<code class="notion-inline-code">house of einherjar</code>的时候，之所以只能将本chunk的低地址的一个被free的chunk来进行malloc_consolidate，是因为源码就是如此：</div><div class="notion-text notion-block-0d8aef35d8fd4bccb4c86b952c092d77">可以看出后面是会进行unlink的，这个unlink就是针对在bin中的chunk的操作</div><div class="notion-text notion-block-e1838e3959774183a2fc603e7ca95503">收获：</div><ul class="notion-list notion-list-disc notion-block-6811d9e781114b95a3b100c368463565"><li>学习到了在获取libc地址时，利用unsorted bin的<b>不断切割</b>来实现</li></ul><ul class="notion-list notion-list-disc notion-block-1a666d421ba442218755b5d0d04616cb"><li>同时学习到了在如果tcachebin被malloc空，同时相同大小的fastbin仍存在，那么在fastbin中的chunk被利用时，剩下的chunk会自动进入tcache bin中</li></ul><div class="notion-text notion-block-b6f80698f06044a4a7968c57f227b945">exp：</div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[四川大学网络空间安全学院考研经验贴]]></title>
            <link>https://ethanyi9.site/article/experience</link>
            <guid>https://ethanyi9.site/article/experience</guid>
            <pubDate>Wed, 06 Mar 2024 00:00:00 GMT</pubDate>
            <description><![CDATA[关于自己的一些考研经验]]></description>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-ad9a293aa0bb4459b77ee9dcd94a5d64"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><div class="notion-text notion-block-05d7a9c454394fada0c3200b2568c519">23考研结束其实有一段时间了，不过毕业设计耗费了我大多数精力，所以直到现在才开始进行考研的经验复盘（其实也是太懒了）我考的是四川大学网安专硕，数二英二，在今年的考研初试科目中难度还是算简单的。</div><div class="notion-text notion-block-e90f29772652459cbee226d59e8f76a5">总分是388，其中数学114，英语83，政治70以及专业课121。</div><div class="notion-text notion-block-402bbb8227674056a16c7f97ca633681">不过因为川大自命题872的缘故其实是找不到对应的试卷，当初复习的时候可以说是全部都在看但是很多知识又记不住的状态，而且还正好遇上了疫情，大家都逐渐开始被感染开始发烧，真的可以说是很难受了。</div><div class="notion-text notion-block-cbc75e70288449abba5505d40dbb55c4">现在开始一科一科进行阐述吧：</div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-a4876b1e8d424e55b8a4af49a60285ee" data-id="a4876b1e8d424e55b8a4af49a60285ee"><span><div id="a4876b1e8d424e55b8a4af49a60285ee" class="notion-header-anchor"></div><a class="notion-hash-link" href="#a4876b1e8d424e55b8a4af49a60285ee" 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-28a3ee6ead2142f492c2018a6a75a3ae">我的本科时期的数学成绩在全班算是中等水平，大概80来分的样子。但是由于很久没有接触数学了，耗费在数学上的时间可以说的最多的。看得最多，同时也是最痛苦的的一科就是数学。因为做到后面不会的题目还是不会做，该算错的题目还是会算错，特别是在计算积分和证明题方面，哪怕在很后期了也是有着不小的算错概率。（我觉得数一可能更加痛苦毕竟还有三重积分什么的）但同时又是花的时间最多你不花又不行。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-a7b94a819c4e4624998b69b6c3818fb6" data-id="a7b94a819c4e4624998b69b6c3818fb6"><span><div id="a7b94a819c4e4624998b69b6c3818fb6" class="notion-header-anchor"></div><a class="notion-hash-link" href="#a7b94a819c4e4624998b69b6c3818fb6" title="开始复习（12月到5月）"><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月到5月）</span></span></h3><div class="notion-text notion-block-52c9a481331a454299f5df2fb766f2e6">我其实从很早很早的时候就开始复习数学了，大概是在21年的12月份吧，开始听杨超老师的《三大计算》。《三大计算》是一个单独联系极限、求导、求不定积分三种计算的习题册，我觉得还是很有用的。但是也是不能光练计算而不追求进度，当时大三下的时候我们有一个大创项目和一个类似于课程设计的东西，占据了我绝大部分时间和精力，所以我基本这几个月就是在弄项目和看代码，看数学就是做做《三大计算》而没有听后面的课程。</div><div class="notion-text notion-block-f99216479810448e94489e4f576c95e3">这种节奏就导致我后面至少到5月中旬了，进度其实没看多少，《三大计算》刷了两遍，但是数二可能只看到了微积分的一半左右，更别说线代了。其实后面的关于二重积分或者是多元微分这样的知识对我来说难度还挺大的。《三大计算》虽然很注重基础，但是它的知识范围在整个考研数学中的占比确实也不多。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-15a453ed686646c9a5e471dfb532c3ce" data-id="15a453ed686646c9a5e471dfb532c3ce"><span><div id="15a453ed686646c9a5e471dfb532c3ce" class="notion-header-anchor"></div><a class="notion-hash-link" href="#15a453ed686646c9a5e471dfb532c3ce" title="开始进入状态（5月到8月）"><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">开始进入状态（5月到8月）</span></span></h3><div class="notion-text notion-block-4e6a5ae5e0f443c591ce69b612261373">因为我的成绩其实是在保研的边缘（大概加上综测达到年级40多名的样子），当时如果有一个项目可以拿奖的话大概率可以保研，不过在后面失之交臂了。这个时期我逐渐意识到了数学学习进度不行，开始拉进度。</div><div class="notion-text notion-block-87873efd362b4531b667ef7309affa8c">具体表现为直接开始看杨超老师的讲解，然后不做题了。不过视频课上的题都会跟着做做，同时是线代和微积分一起听的，毕竟两边的知识也不是很重叠。当然，也没有很急躁，按部就班地一天听个一两节可能。直到6月底接近开始暑假了，才大致弄完了两科。进度拉完了但是不少细节还是没记住。</div><div class="notion-text notion-block-43f98b5ed5e24db7980ef9decce84e33">暑假中我其实也没用什么资料，基本都是做做杨超平时微博发的一些题（现在想想我怎么敢的啊），然后复习一下没记住的知识点（比如说微分方程的公式）。不会的又去看看视频这样。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-416fc18021274e0d807cf90986fe8279" data-id="416fc18021274e0d807cf90986fe8279"><span><div id="416fc18021274e0d807cf90986fe8279" class="notion-header-anchor"></div><a class="notion-hash-link" href="#416fc18021274e0d807cf90986fe8279" title="完全进入状态（8月到12月）"><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">完全进入状态（8月到12月）</span></span></h3><div class="notion-text notion-block-a1b6cb774ce14af7b9f923d990748d2a">8月末左右，经过女朋友的影响，开始喜欢去翻小红书，然后看着非常非常多的考研人士推荐《660》，出于好奇买了一本，开始刷题。然后发现真的《660》真的好难，直接一开头几页就有好多不会的，终于开始有点慌了，开始直接死磕《660》（现在想想说不定做880都比做660好）</div><div class="notion-text notion-block-c2feac18f0434336bf87b0d5df584fb0">去年的660不像是24考研的660，听说24年的660是真的往基础方向靠拢了，但是23年的时候660的难度直接可以当作强化的题型，对我来说难得离谱。每天就是做做做，然后错错错。而且660不像880那样感觉每道题是经典例题，可以从中消化和延伸出不少知识点，660的难度分布对我真的有点迷惑。</div><div class="notion-text notion-block-0ce1309ac23b4a0eb538255b83b959b5">这样差不多做了1个月，每天大半天时间都在看数学，大概9月中的时候660被我做完了，但是如上所说，吸收得不是很好，所以开始刷880了，当然由于时间的原因只能挑不会的部分章节做。</div><div class="notion-text notion-block-5c117f3dc51144b5bf6d60a4e4950647">然后就是开始做卷子了，汤家凤强化5套（这个可能偏基础计算一点）、13~22年真题、余炳森5套、张宇8套、以及最重要的李林6+4套卷。做的时候一边复习一边做，哪个部分知识点不会的，记录下来取去880上面寻找类似的题目，从9月末开始可能2、3天一篇吧，到11月可能是3天2篇那种。</div><div class="notion-text notion-block-0f7d0296acbe4fd49627485f0f357705">这里真的推荐一个B站up主：没咋了，它的660和880我真是太喜欢了，他解题数形结合的思想让我真的茅塞顿开。后期李林套卷我也是跟着他的视频进行的梳理归纳，真的很喜欢他的风格。</div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-aaec7ab377ee44e2aa4782f3a250a7e6" data-id="aaec7ab377ee44e2aa4782f3a250a7e6"><span><div id="aaec7ab377ee44e2aa4782f3a250a7e6" class="notion-header-anchor"></div><a class="notion-hash-link" href="#aaec7ab377ee44e2aa4782f3a250a7e6" 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-a00286f6e71747219560307236b29e0e">英语其实可以说的也不是很多，主要是背单词和看文章。我的英语六级大概刚刚达到500分，勉强还是有一点基础。就我的经验来说的话，单词为王。</div><div class="notion-text notion-block-e30c43572da44e1b92704b249a20ad0e">我大概是从22年1月左右开始的，当时也就只有背单词，不过当时有项目占据我的时间，单词背得也不多。真正开始是从4~5月之后开始每天固定雷打不动的背单词，然后就是微信公众号找那种英文文章看，最好是带个中英翻译的文章，每次看文章把不会的词记在单词本（或者单词app）里面。</div><div class="notion-text notion-block-f15c8484ad4141eda02bbb947efe29e4">因为每篇文章都会有一些比较常用的较为学术化的单词，文章看多了单词本记多了就自然而然的对英语文章中出现频率较高的词有种敏感性了。</div><div class="notion-text notion-block-27fd6c5793ef419db275d02d7306136c">我是从暑假开始做题的，英语做题只用做真题就行了，建议留几张真题试卷当模拟题做，其他的试卷都可以把阅读部分拆开看，主要就是看阅读，英语卷子阅读部分好大概率就是高分。</div><div class="notion-text notion-block-002496149353444b877c0a1f23e84016">然后把真题阅读部分不会的单词也整理在自己的单词本上，英一英二其实也就是10 ~ 22年的卷子总共26套，一套4篇阅读。哪怕你留个6套卷子那也有20 * 4 = 80篇阅读，也还是不少了。一开始可以先随便看几篇做做，然后9月份开始一天看个1到2篇左右，全部做完了你可以试试二刷，总结一下做题小技巧之类的也行。</div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-af40bc7846f242b68bde66add316073b" data-id="af40bc7846f242b68bde66add316073b"><span><div id="af40bc7846f242b68bde66add316073b" class="notion-header-anchor"></div><a class="notion-hash-link" href="#af40bc7846f242b68bde66add316073b" 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-ec30c86be1884567a361818b3ebca088">政治别听别人说是直接9月开始什么的，其实暑假就可以开始听了。不然你在后期反而要花很多时间去听政治基础课，理解那些很绕脑的概念。可以在暑假期间当做解闷的内容之一，复习完数学部分或者是专业课部分就听听政治，算是换换脑子。</div><div class="notion-text notion-block-3278ae3f559547038e2134ce49315a44">我也是从暑假开始的听政治课的，那个时候也就是看看视频，大概对考研政治中要考什么内容做一个了解，搭建一个框架。我是直接先听的徐涛老师的课，很有意思，像是在听相声一样。前期知识没听多少，徐涛老师的生活习惯倒是听得不少。</div><div class="notion-text notion-block-6eb32bfcb69f49cc9ee55a232a05fa12">暑假期间把马原部分全部听完之后听了听近纲的部分知识。这时候就差不多快9月了，后面毛概和思修内容就都是听腿姐的冲刺班了（冲刺班好像是10月开始的？），然后就是刷刷卷子了。肖1000可以做做，算是巩固知识点。</div><div class="notion-text notion-block-f8fb256f855c4350a3867d2de2b4a11b">政治的卷子就不能用真题了，毕竟每年变换一个样子。基本还是做模拟卷的比较多，像是腿姐四套卷之类的。腿姐的冲刺班会列出一些题，做做还是可以的。然后12月肖四肖八出来了就狂背肖四肖八。我当初只背了肖四前三套，结果考了第四套的一些题，直接给我弄无语了。</div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-625867eef51e47cab9dc23942f45a033" data-id="625867eef51e47cab9dc23942f45a033"><span><div id="625867eef51e47cab9dc23942f45a033" class="notion-header-anchor"></div><a class="notion-hash-link" href="#625867eef51e47cab9dc23942f45a033" 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-80a71d364d374a519e739a13c92cab6b">专业课部分我付出的时间可能相对来说不是很多，但是它的内容其实是最多的。川大的专业课是自命题，和408还是有很大的区别。我的建议是多去找找川大本科的期末考试题，有些题就是期末考试接近原题的题目，自命题考试可能或多或少都有点这种感觉吧。</div><div class="notion-text notion-block-b09b63104d3347449a334649cc4fd39f">专业课的开始也是在暑假期间，当时计网和操作系统都是使用的王道系列的教材。听听课，做做课后题。这两本书的课后题选择题部分我都做了，然后是大题部分我只做了标有408原题的题目。后期开始去看黑书的内容，黑书很经典所以其实872的出题是较为偏向黑书的。</div><div class="notion-text notion-block-25f6857909ea442c86e2b5f9771e55c8">同时也可以在网上找一些川大毕业的学长学姐，或者去找找比较正规的那种考研机构的一对一辅导，别人给你期末考试资料同时还可以给你勾画重点呢（我没去过我也不知道，不过附近有人去参加相应辅导的）</div><div class="notion-text notion-block-33e132d2c20a426c9c3f2bac5b6783f6">川大872的三个科目中，信安科目是涉及安全知识的，它的知识面很广很杂，并且难度很高，但是分值只有30分。从性价比方面来看完全不如同样是30分的操作系统。建议可以把这30分复习信安的时间放在操作系统和计网上。操作系统看王道就好，计网的话还是多看看黑书吧，从暑假开始看黑书，也可以用王道的视频看，只是知识点有点不一样。872考得要比408计网更难，知识点更细。</div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-f2fc3af35c16420bb1c7ad053c6daddd" data-id="f2fc3af35c16420bb1c7ad053c6daddd"><span><div id="f2fc3af35c16420bb1c7ad053c6daddd" class="notion-header-anchor"></div><a class="notion-hash-link" href="#f2fc3af35c16420bb1c7ad053c6daddd" 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-2ec3625d8fb14350bad84cd9d89ad734">一年多的时间总的来说，其实也谈不上有多少波折。就是按部就班，平平常常地学习和学习。当然其中也不乏有着玩耍的时间，劳逸结合还是最重要的。在这里尤其感谢我的女朋友，和她一起出去玩之后回来进入学习状态的时间反而还变快了。果然也不能一直待在书本待在电脑前埋头苦干，觉得累了适当出去散散步，松松自己紧绷的弦。（当然也不能太频繁出去玩了）</div><div class="notion-text notion-block-2687a6d4e097462e89cfe2785e7b1797">你要对自己的学习进度有个明确的认知，知道自己在这个学科中是否达到了让你玩玩也可以安心的阶段。当然这个属于是“说起容易做起难”，学习进度这个事情除了自己本人以外，很少有人可以知道什么时候该学到什么地方。不过需要有太大的压力，进入学习状态的时候自然而然就会想着学习，不会想着其他事了。</div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GeekChallenge 2023]]></title>
            <link>https://ethanyi9.site/article/geekchallenge</link>
            <guid>https://ethanyi9.site/article/geekchallenge</guid>
            <pubDate>Tue, 05 Mar 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-52763ffa667d47689c1a9b7c9064789c"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><div class="notion-table-of-contents notion-gray notion-block-2e5f92d95ee8430ca71690fd22dc0953"><a href="#8f86d403f85a4e92a82767bac80b52a9" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:0">week1~2</span></a><a href="#915e2c23fa2b4d4ca8029da645ee971a" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">password</span></a><a href="#f2886c6a08aa4c5e82a02908900e673c" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">ret2libc</span></a><a href="#2f86689bc8784fcd88973885acb7fcf5" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">ezpwn</span></a><a href="#87a4c18fa9f64cf6afe1af420701499c" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">fmt1.0</span></a><a href="#a7fb7d6bf5724977be87a71fbd1bb69f" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">white-canary</span></a><a href="#1b39d93de90944a3a4d1580712bace2d" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:0">week 3</span></a><a href="#d9ed604418bd47629c427d3348a20d6b" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">fmt2</span></a><a href="#b50cf310cd224c729a6d26d1853272f5" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">why_not_puts</span></a><a href="#d91e0c863fe24628bf087b9cc7c7f1f5" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">ez_fullprotection</span></a><a href="#86b4c1c8ae0942a19f00bc71bab24c29" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px">EVA</span></a><a href="#9bf93cbb96334067ad961face9d59c57" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:0">week 4</span></a><a href="#b334a6abd4664deaa5dff6dfdb4618ef" class="notion-table-of-contents-item"><span class="notion-table-of-contents-item-body" style="display:inline-block;margin-left:24px"> fmt3</span></a></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-8f86d403f85a4e92a82767bac80b52a9" data-id="8f86d403f85a4e92a82767bac80b52a9"><span><div id="8f86d403f85a4e92a82767bac80b52a9" class="notion-header-anchor"></div><a class="notion-hash-link" href="#8f86d403f85a4e92a82767bac80b52a9" title="week1~2"><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">week1~2</span></span></h2><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-915e2c23fa2b4d4ca8029da645ee971a" data-id="915e2c23fa2b4d4ca8029da645ee971a"><span><div id="915e2c23fa2b4d4ca8029da645ee971a" class="notion-header-anchor"></div><a class="notion-hash-link" href="#915e2c23fa2b4d4ca8029da645ee971a" title="password"><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">password</span></span></h3><div class="notion-text notion-block-bdaf88d9c83b4a208e256c1f288b78ec">爆破</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-d9c1219fd3084d6ebb22278a82a993b7"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:407px;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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2F7f15ecf9-d532-4d41-9fd7-2b6a83c559de%2FUntitled.png?table=block&amp;id=d9c1219f-d308-4d6e-bb22-278a82a993b7&amp;t=d9c1219f-d308-4d6e-bb22-278a82a993b7&amp;width=407&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-735a7eacf4c84f7396938c67e6035700"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:633px;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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2F437fa892-ac88-435d-a32b-555ef4804e79%2FUntitled.png?table=block&amp;id=735a7eac-f4c8-4f73-9693-8c67e6035700&amp;t=735a7eac-f4c8-4f73-9693-8c67e6035700&amp;width=633&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-f2886c6a08aa4c5e82a02908900e673c" data-id="f2886c6a08aa4c5e82a02908900e673c"><span><div id="f2886c6a08aa4c5e82a02908900e673c" class="notion-header-anchor"></div><a class="notion-hash-link" href="#f2886c6a08aa4c5e82a02908900e673c" title="ret2libc"><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">ret2libc</span></span></h3><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-2f86689bc8784fcd88973885acb7fcf5" data-id="2f86689bc8784fcd88973885acb7fcf5"><span><div id="2f86689bc8784fcd88973885acb7fcf5" class="notion-header-anchor"></div><a class="notion-hash-link" href="#2f86689bc8784fcd88973885acb7fcf5" title="ezpwn"><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">ezpwn</span></span></h3><div class="notion-text notion-block-2f523db9af7f4bffa42d56744a20c7c5">在这道题中尝试了自己手工写shellcode的机器码</div><div class="notion-text notion-block-3bdf05475a374970bc5cc2009e8c975f">同时，如果用asm模块进行写的话，举个例子如下</div><div class="notion-blank notion-block-e1287d4454b8443dac62b1cfa8e0179f"> </div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-87a4c18fa9f64cf6afe1af420701499c" data-id="87a4c18fa9f64cf6afe1af420701499c"><span><div id="87a4c18fa9f64cf6afe1af420701499c" class="notion-header-anchor"></div><a class="notion-hash-link" href="#87a4c18fa9f64cf6afe1af420701499c" title="fmt1.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">fmt1.0</span></span></h3><div class="notion-text notion-block-d012f2f70dbc4a669d1a25d4cc6f3bef">这道题有点东西，我们首先看看反汇编：</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-37b4fb311a2a429d9b25321c7aafe079"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:423px;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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2Fa8a89e1c-6382-45b4-8ab6-9b664b2aa66c%2FUntitled.png?table=block&amp;id=37b4fb31-1a2a-429d-9b25-321c7aafe079&amp;t=37b4fb31-1a2a-429d-9b25-321c7aafe079&amp;width=423&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-3e63c24e8a8d49d1b0fd04ff90b57004">发现只有一个printf输出，和一个栈溢出漏洞。</div><div class="notion-text notion-block-3069d44d25004da7aee8a50b3d3f8bb9">其实相对简单的能够意识到可以进行对返回地址的修改来将printf函数和read函数多次利用</div><div class="notion-blank notion-block-b1155635fb7f4e3383d6c1b3437c983b"> </div><div class="notion-blank notion-block-18d056537f074f2ebdb5bc4e650e3fa7"> </div><div class="notion-text notion-block-d4d2ff8fc31c4b65a4ac0d1d8346478d">问题就是出现在这里，我们在对返回地址进行修改的时候，大多数情况其实都是直接将main或者是vuln的一开始的函数覆盖掉原来的返回地址就好了，这里一般来说应该也是这个情况</div><div class="notion-text notion-block-da574f3d9e024ce6ad9daa9ea3a0552f">但是问题出现了，当我们使用这个地址作为返回地址的时候，在第二轮进行printf函数的时候，会有这个情况：</div><blockquote class="notion-quote notion-block-481bf1bad95f464fbf89e2682e05bcb1"><div>► 0x7ffa60c81e98 movaps xmmword ptr [rsp + 0x40], xmm0</div></blockquote><div class="notion-text notion-block-7d10e20e406b4ff3adda295660651419">程序卡死在这个命令不动了</div><div class="notion-text notion-block-6b92c8a97a3f48e7b0d4e0b1dd5fbb65">这个命令是用来干什么的呢？这里截取了相关解释：</div><blockquote class="notion-quote notion-block-1b7f1fc1aab54a2fbdfd73199853a77e"><div>这条指令是将<code class="notion-inline-code"><b>xmm0</b></code>寄存器中的值移动到栈上某个位置（<code class="notion-inline-code"><b>rsp + 0x40</b></code>）。<code class="notion-inline-code"><b>movaps</b></code>指令要求目标地址必须是16字节对齐的，如果不是的话，它会引发<code class="notion-inline-code"><b>SIGSEGV</b></code>（段错误）。</div></blockquote><div class="notion-text notion-block-8ad789d5fd3c43599ddb89dcb1f13787">意思就是我们在使用printf开始的时候，我们的rsp指针一定要是16字节对齐的！</div><div class="notion-text notion-block-e180f4e8e54f4a95a1905bc6c2a67f23">那我们应该怎么修改呢？</div><div class="notion-text notion-block-c9523220473b4c9c905f8947e9cdc928">这里我修改了返回的地址，从一开始的vuln地址变成了舍去push rbp这个地址</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-cd0fb8cf99e948209523d9fc14be0a6c"><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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2F128315e6-e9ce-47c2-9b4e-f25110623f91%2FUntitled.png?table=block&amp;id=cd0fb8cf-99e9-4820-9523-d9fc14be0a6c&amp;t=cd0fb8cf-99e9-4820-9523-d9fc14be0a6c&amp;width=708&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-439d8c0c414c48679a61110f3d73ee56">因为对我第二遍使用的vuln函数来说其实有没有rbp都好像可以哈哈哈，这样就让rsp少了一次减去0x8的机会，让其保持在十六进制对齐，这样就可以进行printf的正常使用了！</div><div class="notion-text notion-block-3397e3e355944b5787b6969c6e73b09d">完整代码如下：</div><div class="notion-text notion-block-8132064f48984f379f1021390d92dd11">别看这个原理很简单，但是了解这个东西真的耗费了好几个小时</div><div class="notion-blank notion-block-be12fc0448e447b09024ad595241e339"> </div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-a7fb7d6bf5724977be87a71fbd1bb69f" data-id="a7fb7d6bf5724977be87a71fbd1bb69f"><span><div id="a7fb7d6bf5724977be87a71fbd1bb69f" class="notion-header-anchor"></div><a class="notion-hash-link" href="#a7fb7d6bf5724977be87a71fbd1bb69f" title="white-canary"><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">white-canary</span></span></h3><div class="notion-text notion-block-065b4331161b4a5f87d6d5e6919bc9b2">这个题我真的不该没做出来，这个题目正好打击的到我的一个弱项，那就是不喜欢看别的源代码函数，总以为是没用的初始化函数，但是其实并不是这个样子，有可能就是在这些函数中，就是存在着重要的突破口。</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-a61c4ff2f03343bd81a9d497690f800a"><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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2F5b636ef3-f096-4df5-b0d5-dfc61038205c%2FUntitled.png?table=block&amp;id=a61c4ff2-f033-43bd-81a9-d497690f800a&amp;t=a61c4ff2-f033-43bd-81a9-d497690f800a&amp;width=708&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-dba7624b3d82449bac916ef7b5def621">我们打开源代码文件</div><div class="notion-text notion-block-64d0ae5e3d184118b32d5cf51bdb0819">发现是存在向一个buf地址进行输入，同时存在一个栈溢出，还是一个gets栈溢出，没有长度限制</div><div class="notion-text notion-block-310555a11d8f4c829856a072c164c880">同时我们知道buf是一个有rwx权限的地方，证明可以在这个地方写shellcode</div><div class="notion-text notion-block-0180ae3c6e2446239791b2b098ef64d8">然后呢？然后我就没有思路了，在网上能查的关于canary泄露的，要不是有格式化字符串漏洞的泄露，要不是有子线程的爆破，但是我在这道题中都没用找到。</div><div class="notion-blank notion-block-ab4b88fe6e7947ee8bebd462c310a14e"> </div><div class="notion-text notion-block-d04520ac14934713a8b40c384498ba57">最后最后，才发现了有一个init函数，但是也没注意这个函数（因为我没看到调用），里面居然直接把canary算法写出来了！！！！</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-34e6e1300a4349c5a9aa449d38805cce"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:674px;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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2F67e12234-7483-4c46-bb0c-06f5c78e506c%2FUntitled.png?table=block&amp;id=34e6e130-0a43-49c5-a9aa-449d38805cce&amp;t=34e6e130-0a43-49c5-a9aa-449d38805cce&amp;width=674&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-a83d781ae55f404fbd810848a8a93b61">意思是我看的关于canary的都是无用功，唉</div><div class="notion-text notion-block-5c4e5d642c084eea829757ee827317aa">不过还是学习到了，要注意看除了main函数以外的其他函数是不是有突破空间。</div><div class="notion-text notion-block-6adeed134f5c4f7ba408d17d6c835d25">而且事后其他师傅直接提点我：<b>你看到gdb中这些函数的地址空间是有执行权限的就知道有着自己写的初始化函数了！</b></div><div class="notion-text notion-block-c43899cfe073483bb4261675ee4db551">谢谢，我懂了</div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-1b39d93de90944a3a4d1580712bace2d" data-id="1b39d93de90944a3a4d1580712bace2d"><span><div id="1b39d93de90944a3a4d1580712bace2d" class="notion-header-anchor"></div><a class="notion-hash-link" href="#1b39d93de90944a3a4d1580712bace2d" title="week 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">week 3</span></span></h2><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-d9ed604418bd47629c427d3348a20d6b" data-id="d9ed604418bd47629c427d3348a20d6b"><span><div id="d9ed604418bd47629c427d3348a20d6b" class="notion-header-anchor"></div><a class="notion-hash-link" href="#d9ed604418bd47629c427d3348a20d6b" title="fmt2"><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">fmt2</span></span></h3><div class="notion-text notion-block-7f61180f34a74ff5a766531a353f30fc">这应该算是我第一次手搓格式化字符串的漏洞吧，就是还挺值得纪念的</div><div class="notion-text notion-block-73955c66b6364bac9588f620a9f3e3ae">主要是终于发现了，<code class="notion-inline-code">fmtstr_payload</code> 函数真的在x64的系统上不好用，一直都会报不少错，所以手搓还是挺好的。</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-a926a9cb57e942c9be608254ad92475f"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:667px;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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2F1f94b53a-bc1e-4993-b550-fa0d87b47b8e%2FUntitled.png?table=block&amp;id=a926a9cb-57e9-42c9-be60-8254ad92475f&amp;t=a926a9cb-57e9-42c9-be60-8254ad92475f&amp;width=667&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-6b413cff75814f7eb19fa88e96171a8f">打开ida，发现是格式化漏洞</div><div class="notion-text notion-block-cb2d59b767f64362a8b9fd5ddc7572b1">我们直接修改返回地址为<code class="notion-inline-code">one_gadget</code>函数，同时注意，因为<code class="notion-inline-code">one_gadget</code>函数也是在libc中的，所以也不至于直接全部改，改几个字节就好了</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-fc06e3e989c644ca92f9496ff2fb431d"><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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2Faa111b29-1f1a-4bca-875b-a3169bf5a3f1%2FUntitled.png?table=block&amp;id=fc06e3e9-89c6-44ca-92f9-496ff2fb431d&amp;t=fc06e3e9-89c6-44ca-92f9-496ff2fb431d&amp;width=708&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-b50cf310cd224c729a6d26d1853272f5" data-id="b50cf310cd224c729a6d26d1853272f5"><span><div id="b50cf310cd224c729a6d26d1853272f5" class="notion-header-anchor"></div><a class="notion-hash-link" href="#b50cf310cd224c729a6d26d1853272f5" title="why_not_puts"><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">why_not_puts</span></span></h3><div class="notion-row"><a target="_blank" rel="noopener noreferrer" class="notion-bookmark notion-block-0f62d80c9c734ee094e434889e0b2bb0" href="https://blog.csdn.net/qq_51868336/article/details/114644569"><div><div class="notion-bookmark-title">ret2dlresolve超详细教程(x86&amp;x64)-CSDN博客</div><div class="notion-bookmark-description">文章浏览阅读3.8k次，点赞20次，收藏46次。X86前置知识在Linux中，程序使用_dl_runtime_resolve(link_map,reloc_offset)来对动态链接的函数进行重定位。而ret2dlresolve攻击的核心就是控制相应的参数及其对应地址的内容，从而控制解析的函数。延迟绑定第一次调用一个函数时，先是到plt表，然后jmp到got表此时got表存的地址是在plt表上其实也就是jmp got的下一条指令，这里先是push一个数字（该函数在rel.plt上的偏移,reloc_arg，后文会讲到），然后jmp到pl_ret2dlresolve</div><div class="notion-bookmark-link"><div class="notion-bookmark-link-icon"><img src="https://g.csdnimg.cn/static/logo/favicon32.ico?t=0f62d80c-9c73-4ee0-94e4-34889e0b2bb0" alt="ret2dlresolve超详细教程(x86&amp;x64)-CSDN博客" loading="lazy" decoding="async"/></div><div class="notion-bookmark-link-text">https://blog.csdn.net/qq_51868336/article/details/114644569</div></div></div></a></div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-d91e0c863fe24628bf087b9cc7c7f1f5" data-id="d91e0c863fe24628bf087b9cc7c7f1f5"><span><div id="d91e0c863fe24628bf087b9cc7c7f1f5" class="notion-header-anchor"></div><a class="notion-hash-link" href="#d91e0c863fe24628bf087b9cc7c7f1f5" title="ez_fullprotection"><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">ez_fullprotection</span></span></h3><div class="notion-text notion-block-90a2904166024ec68d63fb52bc225ef8">自己想了好久做出来的题，还是感觉不一样，好爽哈哈哈哈</div><div class="notion-text notion-block-984337a8148b4cbdb7421384cb8ae3c9">由题意，所有防御皆开启</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-a23e7b68b3d541958759ee5c62a4dade"><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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2F67bc4663-6922-46da-84d3-4ddd35a75c98%2FUntitled.png?table=block&amp;id=a23e7b68-b3d5-4195-8759-ee5c62a4dade&amp;t=a23e7b68-b3d5-4195-8759-ee5c62a4dade&amp;width=708&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-c3fbe2ed0580439da7c0cdd0232372d0">再看看ida</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-74f5e117b07d4b80a4be572866a228f0"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:654px;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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2Ff1c45d3c-2590-447b-8df7-5f65b1f40765%2FUntitled.png?table=block&amp;id=74f5e117-b07d-4b80-a4be-572866a228f0&amp;t=74f5e117-b07d-4b80-a4be-572866a228f0&amp;width=654&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-4d9a86684d634b5489ab1eff0d61f325">进入game()</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-9b0df3a574df4a59ac3f62ae5c7faa7a"><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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2F2c4deec6-ef63-4464-b151-198139fc978c%2FUntitled.png?table=block&amp;id=9b0df3a5-74df-4a59-ac3f-62ae5c7faa7a&amp;t=9b0df3a5-74df-4a59-ac3f-62ae5c7faa7a&amp;width=708&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-428ff8b26f484404ac736b8a68dbc3a3">我们注意到v1这里是标了亮黄色的，这代表v1可能没有被赋值</div><div class="notion-text notion-block-4bbc37c214f348bf839be6fbba73cb52">我们通过gdb调试的话也可以看出：</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-3ea6d6b8b5ef40b4a88d0ad15b11d5cc"><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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2F4ff0e90a-312e-4c66-b0a0-d0c076a3ddcb%2FUntitled.png?table=block&amp;id=3ea6d6b8-b5ef-40b4-a88d-0ad15b11d5cc&amp;t=3ea6d6b8-b5ef-40b4-a88d-0ad15b11d5cc&amp;width=708&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-5b9a4a8f0132464ea281b13cb3e4fd56">我们进行了scanf之后，局部变量v1并没有被赋值，所以这就泄露了函数的地址，我们可以就此绕过PIE（但是为啥scanf没能赋值，我也没看懂，希望到时候的WP有写吧）</div><div class="notion-text notion-block-2438d9bd226d45338608fb2dd7bcbcc7">官方的wp是这样说的，它解释了关于scanf的一个性质：</div><blockquote class="notion-quote notion-block-368fb9e9baac42e98e4be831735548a9"><div>scanf有个特性，当我们输⼊⾮法数据时，⽐如我们这⾥输⼊⾮数字，它不会覆盖原本参数的所在地址上的数据，从⽽利⽤后⾯的格式化字符串来打印出栈上数据，从⽽ leak 出 pie</div></blockquote><div class="notion-text notion-block-381e5f20698c426a88e04bc07d261b73">意思就是如果我们输入的和scanf想要的不一样，它就不会改内存，所以内存里面的值就是原来的值</div><div class="notion-text notion-block-ae143b2a54814d09a2b8d738a6aab469">然后进入</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-ec8e0eff12e94c6fb507b963e84840bd"><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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2F2b639b80-f158-4821-b980-aaf41e73e8e7%2FUntitled.png?table=block&amp;id=ec8e0eff-12e9-4c6f-b507-b963e84840bd&amp;t=ec8e0eff-12e9-4c6f-b507-b963e84840bd&amp;width=708&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-61feaabcdd044e09a72684be812f066b"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:465px;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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2Fd7946dfa-1359-45d9-891c-a188f2598fc6%2FUntitled.png?table=block&amp;id=61feaabc-dd04-4e09-a726-84be812f066b&amp;t=61feaabc-dd04-4e09-a726-84be812f066b&amp;width=465&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-707acd3f539c44b99903e3e2a7f9668b">发现新线程的函数中存在gets函数，明显栈溢出，但是我们知道此时这个子线程存在canary</div><div class="notion-text notion-block-a8e26fd27bd04c13b9247d541b0ebcb5">经过网上的资料查询，发现是TLS劫持攻击：</div><div class="notion-row"><a target="_blank" rel="noopener noreferrer" class="notion-bookmark notion-block-f350c29fffb5479a97770dd1a31f7d36" href="https://sf2333.github.io/2022/02/01/CTF-pwn-技术总结（3）/"><div><div class="notion-bookmark-title">CTF-pwn 技术总结（3）</div><div class="notion-bookmark-description">CTF-pwn 技术总结（3)转载自https://forum.butian.net/share/1190 前言学习linux pwn，linux安全机制的知识是绕不开的。如果能理解这些安全机制的原理以及不懂得如何绕过它们，那么在比赛时将你举步维艰，本节我就总结了所有linux安全机制的基本原理以及具体的绕过方法，希望能帮助一些小萌新更快入门，帮助需要进阶的朋友打好根基。 linux安全机制详解与</div><div class="notion-bookmark-link"><div class="notion-bookmark-link-icon"><img src="https://sf2333.github.io/img/favicon.png?t=f350c29f-ffb5-479a-9777-0dd1a31f7d36" alt="CTF-pwn 技术总结（3）" loading="lazy" decoding="async"/></div><div class="notion-bookmark-link-text">https://sf2333.github.io/2022/02/01/CTF-pwn-技术总结（3）/</div></div></div><div class="notion-bookmark-image"><img style="object-fit:cover" src="https://my-tc-1308282641.cos.ap-guangzhou.myqcloud.com/markdown/typora-user-images/wallhaven-o3wzql.jpg?t=f350c29f-ffb5-479a-9777-0dd1a31f7d36" alt="CTF-pwn 技术总结（3）" loading="lazy" decoding="async"/></div></a></div><div class="notion-row"><a target="_blank" rel="noopener noreferrer" class="notion-bookmark notion-block-c3a2d5a308864ba6a745bebe41c23f6c" href="https://xz.aliyun.com/t/4657#toc-5"><div><div class="notion-bookmark-title">canary的各种姿势----pwn题解版 - 先知社区</div><div class="notion-bookmark-description">先知社区，先知安全技术社区</div><div class="notion-bookmark-link"><div class="notion-bookmark-link-icon"><img src="https://xz.aliyun.com/static/icon/favicon.ico?t=c3a2d5a3-0886-4ba6-a745-bebe41c23f6c" alt="canary的各种姿势----pwn题解版 - 先知社区" loading="lazy" decoding="async"/></div><div class="notion-bookmark-link-text">https://xz.aliyun.com/t/4657#toc-5</div></div></div></a></div><div class="notion-text notion-block-8948345077654217a8d6eb8916bde990"><b>原理</b>：</div><div class="notion-text notion-block-6ea98964cd0446619753f01bd3f17e05">TLS（Thread-Local Storage）劫持攻击是一种针对应用程序的攻击方法，它利用线程本地存储的机制来实施恶意活动。线程本地存储是一种允许数据在多个线程之间隔离的存储机制，每个线程都有自己的数据副本，常用于存储每个线程的用户会话、状态或配置。在TLS劫持攻击中，攻击者通过获取对目标进程足够的访问权限，然后修改TLS数据结构中的特定值，例如通过指针重定向、代码注入或数据篡改。</div><blockquote class="notion-quote notion-block-d94c3321e2f04b44946b8dad1356cf7f"><div>按照我的理解就是，开辟线程的时候，线程本地存储会将诸多相关的数据进行一个备份，放在这个线程内存高地址的地方。canary也是一样，这样线程就是直接对TLS中的canary副本进行对比，所以当我们进行比较大一点的栈溢出的时候，就可以进行覆盖，将其修改。这样在函数验证的时候就可以通过。 </div></blockquote><div class="notion-text notion-block-26e2609b2d204d98beace3bdcb8888ff">所以这个题就转化成了进行很大的栈溢出，看看其offset是多少。</div><blockquote class="notion-quote notion-block-acf7a4614e164010bf5422bfece0d6d9"><div>我们可以用canary命令先在gdbdbg中看看canary大致在哪，然后自己对比</div></blockquote><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-9768bdde78a3427188f899b1b878932a"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:654px;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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2F08505213-c5ed-441f-801a-959cb66e08c2%2FUntitled.png?table=block&amp;id=9768bdde-78a3-4271-88f8-99b1b878932a&amp;t=9768bdde-78a3-4271-88f8-99b1b878932a&amp;width=654&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-52a041cfd556463ab0981d4775a997a6">爆破脚本：</div><div class="notion-text notion-block-d4e5fa944172456c8fee8bd978890790">得到大概爆破是在0x870左右，我们在这个附近都行，只要超过了0x870就行</div><div class="notion-text notion-block-e83592ff87ad4d589de961cbaaec8d4d">然后就是常规的ROP链操作了，这里用栈迁移比较方便，毕竟我也不知道泄露libc地址后该返回到哪里，也不知道返回到的地方有没有什么其他的限制，所以在bss+0x300的地址上先写个ROP链，再迁移过去就行</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-86b4c1c8ae0942a19f00bc71bab24c29" data-id="86b4c1c8ae0942a19f00bc71bab24c29"><span><div id="86b4c1c8ae0942a19f00bc71bab24c29" class="notion-header-anchor"></div><a class="notion-hash-link" href="#86b4c1c8ae0942a19f00bc71bab24c29" title="EVA"><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">EVA</span></span></h3><div class="notion-text notion-block-a5f987b873784faebc86297ac709f082">这个题是后面和T1d师傅讨论出来的，或者说是T1d师傅交给我了这个思路</div><div class="notion-text notion-block-7fc0678578d946c0bae2c46d2c5e67d2">这个思路应该是个非预期</div><div class="notion-text notion-block-dd93ecccdcd840b3ba8b20c170875d54">这个思路就是：直接通过修改<code class="notion-inline-code">__stack_chk_fail</code> 函数的got表来绕过canary</div><div class="notion-text notion-block-c78633fd9a6441078a6668817c84af42">真的很厉害这个思路，感觉可以用于很多地方，只要在这个二进制文件保持着partial RELRO的程度，就可以尝试着修改<code class="notion-inline-code">__stack_chk_fail</code>来进行修改，把这个函数的got表随便指向一个ret指令，就可以进行绕过canary的检查，把<code class="notion-inline-code">__stack_chk_fail</code>函数变成一个空函数</div><div class="notion-text notion-block-209d4d59ba734e109b7ca831efea8161">我们查看源代码</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-4ddd283e413d4f08928b0ab07ba37674"><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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2F5f574bf3-fd80-446e-9e98-0d2645ba32f9%2FUntitled.png?table=block&amp;id=4ddd283e-413d-4f08-928b-0ab07ba37674&amp;t=4ddd283e-413d-4f08-928b-0ab07ba37674&amp;width=708&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-528ef774d40f416d88c115f687af4d37">可以看出，当我们选择‘2’后，可以修改rbp以及之后的0x10字节，也就是rbp和return地址</div><div class="notion-text notion-block-6c929892bbd34009b0ecdff8043c47f4">修改rbp就可以修改很多main函数之中调用的函数</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-5d5ea70364934f9d84948121fe460a80"><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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2Ff681cef4-734a-430b-b3f3-0452c96636a8%2FUntitled.png?table=block&amp;id=5d5ea703-6493-4f9d-8494-8121fe460a80&amp;t=5d5ea703-6493-4f9d-8494-8121fe460a80&amp;width=2096&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-03dbc4c3b5294caeb49db410a043ba74">可以看到从这个地方，改rbp的值来进行修改read函数覆盖的地方</div><div class="notion-text notion-block-54301cc7bcec4c83b3129269b15924e1">还有write函数也可以被修改</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-8df84902f8484b5e836b231496579c9e"><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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2F387eb661-4c7c-4f28-bc03-6c1bd3ff578f%2FUntitled.png?table=block&amp;id=8df84902-f848-4b5e-836b-231496579c9e&amp;t=8df84902-f848-4b5e-836b-231496579c9e&amp;width=708&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-c600faf676d042d98b98d7d9c1f37b91">所以可以通过先选2，然后发送</div><div class="notion-text notion-block-f15344286b2342b2bc3edcb00c6ca7dc">将rbp修改到这里</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-969d94608fa941b38bc829e397ccc554"><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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2F6e12fe86-859f-41f3-bd2c-2f6543d6b97f%2FUntitled.png?table=block&amp;id=969d9460-8fa9-41b3-8bc8-29e397ccc554&amp;t=969d9460-8fa9-41b3-8bc8-29e397ccc554&amp;width=708&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-63cbeaf358a640b1b6e2a35bac4acbe6">这样就可以泄漏libc基地址</div><div class="notion-text notion-block-d158d5fa71f2464ea2636aa07a01e2f7">泄漏完了之后到达重新选择1和2</div><div class="notion-text notion-block-0b1ef91d856f487b91abcdf75a49a6f0">选择1可以重新覆写rbp</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-f140f33d83f24b37b80a4fcfc7fd60f3"><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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2Faecc826c-a79c-4922-a340-039607fef0a3%2FUntitled.png?table=block&amp;id=f140f33d-83f2-4b37-b80a-4fcfc7fd60f3&amp;t=f140f33d-83f2-4b37-b80a-4fcfc7fd60f3&amp;width=708&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-cc5b7197165a4f02a3b7521feeea2f72">在这个地方我们直接进行输入：</div><div class="notion-text notion-block-4cee5947aa964f45b531282c86b1ac7d">达到这个效果</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-39248b703b8c4612ad54d56e14400ee4"><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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2Fdcb26abf-dfdb-4040-8102-b93be3e07629%2FUntitled.png?table=block&amp;id=39248b70-3b8c-4612-ad54-d56e14400ee4&amp;t=39248b70-3b8c-4612-ad54-d56e14400ee4&amp;width=708&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-7856523d9d1d44688db3a4b5ef7a27ab">可以看出我们此时直接将got表中的<code class="notion-inline-code">__stack_chk_fail</code> 函数变成ret指令了。</div><div class="notion-text notion-block-d72296d0a5df49df84565a4fe1866283">这样就可以直接绕过canary了</div><div class="notion-text notion-block-491ca39201194baf962e0fab4295928a">这里是exp.py</div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-9bf93cbb96334067ad961face9d59c57" data-id="9bf93cbb96334067ad961face9d59c57"><span><div id="9bf93cbb96334067ad961face9d59c57" class="notion-header-anchor"></div><a class="notion-hash-link" href="#9bf93cbb96334067ad961face9d59c57" title="week 4"><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">week 4</span></span></h2><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-b334a6abd4664deaa5dff6dfdb4618ef" data-id="b334a6abd4664deaa5dff6dfdb4618ef"><span><div id="b334a6abd4664deaa5dff6dfdb4618ef" class="notion-header-anchor"></div><a class="notion-hash-link" href="#b334a6abd4664deaa5dff6dfdb4618ef" title=" fmt3"><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"> fmt3</span></span></h3><div class="notion-text notion-block-521675e357c542bcb2398a9f522b5ac6">没做出来，不过应该就是关于fmt和栈迁移之类的操作</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-46d7eca94b054cb2a50fbf43cc46357a"><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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2F282b4bb3-cfdc-4458-b111-c162c05a5336%2FUntitled.png?table=block&amp;id=46d7eca9-4b05-4cb2-a50f-bf43cc46357a&amp;t=46d7eca9-4b05-4cb2-a50f-bf43cc46357a&amp;width=708&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-df529946d7d54db18cc81f414c0c087b"><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%2Fedf982f7-67dd-41da-b59a-77da10d5ed16%2F4341f935-e838-4439-8065-4ffac8cda5cf%2FUntitled.png?table=block&amp;id=df529946-d7d5-4db1-8cc8-1f414c0c087b&amp;t=df529946-d7d5-4db1-8cc8-1f414c0c087b&amp;width=708&amp;cache=v2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-blank notion-block-6a4f4d95ce684c27b1b69b608bdb9d75"> </div></main></div>]]></content:encoded>
        </item>
    </channel>
</rss>