ASLR 是如何保护 Linux 系统免受缓冲区溢出攻击的 | Linux 中国

找不到分类 evilven 5个月前 (06-25) 120次浏览 已收录 0个评论 扫描二维码
ASLR 是如何保护 Linux 系统免受缓冲区溢出攻击的 | Linux 中国

地址空间随机化(ASLR)是一种内存攻击缓解技术,可以用于 Linux 和 Windows 系统。了解一下如何运行它、启用/禁用它,以及它是如何工作的。

— Sandra Henry-stocker


地址空间随机化Address Space Layout Randomization(ASLR)是一种操作系统用来抵御缓冲区溢出攻击的内存保护机制。这种技术使得系统上运行的进程的内存地址无法被预测,使得与这些进程有关的漏洞变得更加难以利用。

ASLR 目前在 Linux、Windows 以及 MacOS 系统上都有使用。其最早出现在 2005 的 Linux 系统上。2007 年,这项技术被 Windows 和 MacOS 部署使用。尽管 ASLR 在各个系统上都提供相同的功能,却有着不同的实现。

ASLR 的有效性依赖于整个地址空间布局是否对于攻击者保持未知。此外,只有编译时作为位置无关可执行文件Position Independent Executable(PIE)的可执行程序才能得到 ASLR 技术的最大保护,因为只有这样,可执行文件的所有代码节区才会被加载在随机地址。PIE 机器码不管绝对地址是多少都可以正确执行。

ASLR 的局限性

尽管 ASLR 使得对系统漏洞的利用更加困难了,但其保护系统的能力是有限的。理解关于 ASLR 的以下几点是很重要的:

◈ 它不能解决漏洞,而是增加利用漏洞的难度
◈ 并不追踪或报告漏洞
◈ 不能对编译时没有开启 ASLR 支持的二进制文件提供保护
◈ 不能避免被绕过

ASLR 是如何工作的

通过对攻击者在进行缓冲区溢出攻击时所要用到的内存布局中的偏移做了随机化,ASLR 加大了攻击成功的难度,从而增强了系统的控制流完整性。

通常认为 ASLR 在 64 位系统上效果更好,因为 64 位系统提供了更大的熵(可随机的地址范围)。

ASLR 是否正在你的 Linux 系统上运行?

下面展示的两条命令都可以告诉你的系统是否启用了 ASLR 功能:

<ol class="linenums list-paddingleft-2" style="margin-left: 2em;margin-right: 2em;">
<li><section style="overflow-wrap: break-word;width: 1200px;max-width: 1200px !important;"><code style="overflow-wrap: break-word;background: none;color: rgb(33, 150, 243);line-height: 1.2em;padding-left: 10px !important;border-radius: 0px !important;margin-top: 1em !important;margin-bottom: 1em !important;border-width: initial !important;border-style: none !important;border-color: initial !important;"><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">$ </span><span class="kwd" style="overflow-wrap: break-word;color: rgb(226, 137, 100);">cat</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">proc</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">sys</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">kernel</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">randomize_va_space</span></code></section></li>
<li><section style="overflow-wrap: break-word;width: 1200px;max-width: 1200px !important;"><code style="overflow-wrap: break-word;background: none;color: rgb(33, 150, 243);line-height: 1.2em;padding-left: 10px !important;border-radius: 0px !important;margin-top: 1em !important;margin-bottom: 1em !important;border-width: initial !important;border-style: none !important;border-color: initial !important;"><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">2</span></code></section></li>
<li><section style="overflow-wrap: break-word;width: 1200px;max-width: 1200px !important;"><code style="overflow-wrap: break-word;background: none;color: rgb(33, 150, 243);line-height: 1.2em;padding-left: 10px !important;border-radius: 0px !important;margin-top: 1em !important;margin-bottom: 1em !important;border-width: initial !important;border-style: none !important;border-color: initial !important;"><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">$ </span><span class="kwd" style="overflow-wrap: break-word;color: rgb(226, 137, 100);">sysctl</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">-</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">a </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">--</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">pattern randomize</span></code></section></li>
<li><section style="overflow-wrap: break-word;width: 1200px;max-width: 1200px !important;"><code style="overflow-wrap: break-word;background: none;color: rgb(33, 150, 243);line-height: 1.2em;padding-left: 10px !important;border-radius: 0px !important;margin-top: 1em !important;margin-bottom: 1em !important;border-width: initial !important;border-style: none !important;border-color: initial !important;"><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">kernel</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">randomize_va_space </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">=</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">2</span></code></section></li>
</ol>

上方指令结果中的数值(2)表示 ASLR 工作在全随机化模式。其可能为下面的几个数值之一:

<ol class="linenums list-paddingleft-2" style="margin-left: 2em;margin-right: 2em;">
<li><section style="overflow-wrap: break-word;width: 1200px;max-width: 1200px !important;"><code style="overflow-wrap: break-word;background: none;color: rgb(33, 150, 243);line-height: 1.2em;padding-left: 10px !important;border-radius: 0px !important;margin-top: 1em !important;margin-bottom: 1em !important;border-width: initial !important;border-style: none !important;border-color: initial !important;"><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">0</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">=</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="typ" style="overflow-wrap: break-word;color: rgb(137, 189, 255);">Disabled</span></code></section></li>
<li><section style="overflow-wrap: break-word;width: 1200px;max-width: 1200px !important;"><code style="overflow-wrap: break-word;background: none;color: rgb(33, 150, 243);line-height: 1.2em;padding-left: 10px !important;border-radius: 0px !important;margin-top: 1em !important;margin-bottom: 1em !important;border-width: initial !important;border-style: none !important;border-color: initial !important;"><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">1</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">=</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="typ" style="overflow-wrap: break-word;color: rgb(137, 189, 255);">Conservative</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="typ" style="overflow-wrap: break-word;color: rgb(137, 189, 255);">Randomization</span></code></section></li>
<li><section style="overflow-wrap: break-word;width: 1200px;max-width: 1200px !important;"><code style="overflow-wrap: break-word;background: none;color: rgb(33, 150, 243);line-height: 1.2em;padding-left: 10px !important;border-radius: 0px !important;margin-top: 1em !important;margin-bottom: 1em !important;border-width: initial !important;border-style: none !important;border-color: initial !important;"><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">2</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">=</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="typ" style="overflow-wrap: break-word;color: rgb(137, 189, 255);">Full</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="typ" style="overflow-wrap: break-word;color: rgb(137, 189, 255);">Randomization</span></code></section></li>
</ol>

如果你关闭了 ASLR 并且执行下面的指令,你将会注意到前后两条 ldd 的输出是完全一样的。ldd命令会加载共享对象并显示它们在内存中的地址。

<ol class="linenums list-paddingleft-2" style="margin-left: 2em;margin-right: 2em;">
<li><section style="overflow-wrap: break-word;width: 1200px;max-width: 1200px !important;"><code style="overflow-wrap: break-word;background: none;color: rgb(33, 150, 243);line-height: 1.2em;padding-left: 10px !important;border-radius: 0px !important;margin-top: 1em !important;margin-bottom: 1em !important;border-width: initial !important;border-style: none !important;border-color: initial !important;"><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">$ </span><span class="kwd" style="overflow-wrap: break-word;color: rgb(226, 137, 100);">sudo</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="kwd" style="overflow-wrap: break-word;color: rgb(226, 137, 100);">sysctl</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">-</span><span class="kwd" style="overflow-wrap: break-word;color: rgb(226, 137, 100);">w</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> kernel</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">randomize_va_space</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">=</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">0</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">    </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"><==</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> disable</span></code></section></li>
<li><section style="overflow-wrap: break-word;width: 1200px;max-width: 1200px !important;"><code style="overflow-wrap: break-word;background: none;color: rgb(33, 150, 243);line-height: 1.2em;padding-left: 10px !important;border-radius: 0px !important;margin-top: 1em !important;margin-bottom: 1em !important;border-width: initial !important;border-style: none !important;border-color: initial !important;"><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">[</span><span class="kwd" style="overflow-wrap: break-word;color: rgb(226, 137, 100);">sudo</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">]</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> password </span><span class="kwd" style="overflow-wrap: break-word;color: rgb(226, 137, 100);">for</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> shs</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">:</span></code></section></li>
<li><section style="overflow-wrap: break-word;width: 1200px;max-width: 1200px !important;"><code style="overflow-wrap: break-word;background: none;color: rgb(33, 150, 243);line-height: 1.2em;padding-left: 10px !important;border-radius: 0px !important;margin-top: 1em !important;margin-bottom: 1em !important;border-width: initial !important;border-style: none !important;border-color: initial !important;"><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">kernel</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">randomize_va_space </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">=</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">0</span></code></section></li>
<li><section style="overflow-wrap: break-word;width: 1200px;max-width: 1200px !important;"><code style="overflow-wrap: break-word;background: none;color: rgb(33, 150, 243);line-height: 1.2em;padding-left: 10px !important;border-radius: 0px !important;margin-top: 1em !important;margin-bottom: 1em !important;border-width: initial !important;border-style: none !important;border-color: initial !important;"><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">$ </span><span class="kwd" style="overflow-wrap: break-word;color: rgb(226, 137, 100);">ldd</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">bin</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="kwd" style="overflow-wrap: break-word;color: rgb(226, 137, 100);">bash</span></code></section></li>
<li><section style="overflow-wrap: break-word;width: 1200px;max-width: 1200px !important;"><code style="overflow-wrap: break-word;background: none;color: rgb(33, 150, 243);line-height: 1.2em;padding-left: 10px !important;border-radius: 0px !important;margin-top: 1em !important;margin-bottom: 1em !important;border-width: initial !important;border-style: none !important;border-color: initial !important;"><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">        linux</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">-</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">vdso</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">so</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">1</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">(</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">0x00007ffff7fd1000</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">)</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"><==</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> same addresses</span></code></section></li>
<li><section style="overflow-wrap: break-word;width: 1200px;max-width: 1200px !important;"><code style="overflow-wrap: break-word;background: none;color: rgb(33, 150, 243);line-height: 1.2em;padding-left: 10px !important;border-radius: 0px !important;margin-top: 1em !important;margin-bottom: 1em !important;border-width: initial !important;border-style: none !important;border-color: initial !important;"><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">        libtinfo</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">so</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">6</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">=></span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">lib</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">x86_64</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">-</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">linux</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">-</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">gnu</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">libtinfo</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">so</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">6</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">(</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">0x00007ffff7c69000</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">)</span></code></section></li>
<li><section style="overflow-wrap: break-word;width: 1200px;max-width: 1200px !important;"><code style="overflow-wrap: break-word;background: none;color: rgb(33, 150, 243);line-height: 1.2em;padding-left: 10px !important;border-radius: 0px !important;margin-top: 1em !important;margin-bottom: 1em !important;border-width: initial !important;border-style: none !important;border-color: initial !important;"><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">        libdl</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">so</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">2</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">=></span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">lib</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">x86_64</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">-</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">linux</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">-</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">gnu</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">libdl</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">so</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">2</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">(</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">0x00007ffff7c63000</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">)</span></code></section></li>
<li><section style="overflow-wrap: break-word;width: 1200px;max-width: 1200px !important;"><code style="overflow-wrap: break-word;background: none;color: rgb(33, 150, 243);line-height: 1.2em;padding-left: 10px !important;border-radius: 0px !important;margin-top: 1em !important;margin-bottom: 1em !important;border-width: initial !important;border-style: none !important;border-color: initial !important;"><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">        libc</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">so</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">6</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">=></span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">lib</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">x86_64</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">-</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">linux</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">-</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">gnu</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">libc</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">so</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">6</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">(</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">0x00007ffff7a79000</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">)</span></code></section></li>
<li><section style="overflow-wrap: break-word;width: 1200px;max-width: 1200px !important;"><code style="overflow-wrap: break-word;background: none;color: rgb(33, 150, 243);line-height: 1.2em;padding-left: 10px !important;border-radius: 0px !important;margin-top: 1em !important;margin-bottom: 1em !important;border-width: initial !important;border-style: none !important;border-color: initial !important;"><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">        </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">lib64</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="kwd" style="overflow-wrap: break-word;color: rgb(226, 137, 100);">ld</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">-</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">linux</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">-</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">x86</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">-</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">64.so</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">2</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">(</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">0x00007ffff7fd3000</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">)</span></code></section></li>
<li><section style="overflow-wrap: break-word;width: 1200px;max-width: 1200px !important;"><code style="overflow-wrap: break-word;background: none;color: rgb(33, 150, 243);line-height: 1.2em;padding-left: 10px !important;border-radius: 0px !important;margin-top: 1em !important;margin-bottom: 1em !important;border-width: initial !important;border-style: none !important;border-color: initial !important;"><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">$ </span><span class="kwd" style="overflow-wrap: break-word;color: rgb(226, 137, 100);">ldd</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">bin</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="kwd" style="overflow-wrap: break-word;color: rgb(226, 137, 100);">bash</span></code></section></li>
<li><section style="overflow-wrap: break-word;width: 1200px;max-width: 1200px !important;"><code style="overflow-wrap: break-word;background: none;color: rgb(33, 150, 243);line-height: 1.2em;padding-left: 10px !important;border-radius: 0px !important;margin-top: 1em !important;margin-bottom: 1em !important;border-width: initial !important;border-style: none !important;border-color: initial !important;"><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">        linux</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">-</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">vdso</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">so</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">1</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">(</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">0x00007ffff7fd1000</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">)</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"><==</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> same addresses</span></code></section></li>
<li><section style="overflow-wrap: break-word;width: 1200px;max-width: 1200px !important;"><code style="overflow-wrap: break-word;background: none;color: rgb(33, 150, 243);line-height: 1.2em;padding-left: 10px !important;border-radius: 0px !important;margin-top: 1em !important;margin-bottom: 1em !important;border-width: initial !important;border-style: none !important;border-color: initial !important;"><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">        libtinfo</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">so</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">6</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">=></span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">lib</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">x86_64</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">-</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">linux</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">-</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">gnu</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">libtinfo</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">so</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">6</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">(</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">0x00007ffff7c69000</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">)</span></code></section></li>
<li><section style="overflow-wrap: break-word;width: 1200px;max-width: 1200px !important;"><code style="overflow-wrap: break-word;background: none;color: rgb(33, 150, 243);line-height: 1.2em;padding-left: 10px !important;border-radius: 0px !important;margin-top: 1em !important;margin-bottom: 1em !important;border-width: initial !important;border-style: none !important;border-color: initial !important;"><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">        libdl</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">so</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">2</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">=></span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">lib</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">x86_64</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">-</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">linux</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">-</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">gnu</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">libdl</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">so</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">2</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">(</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">0x00007ffff7c63000</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">)</span></code></section></li>
<li><section style="overflow-wrap: break-word;width: 1200px;max-width: 1200px !important;"><code style="overflow-wrap: break-word;background: none;color: rgb(33, 150, 243);line-height: 1.2em;padding-left: 10px !important;border-radius: 0px !important;margin-top: 1em !important;margin-bottom: 1em !important;border-width: initial !important;border-style: none !important;border-color: initial !important;"><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">        libc</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">so</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">6</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">=></span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">lib</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">x86_64</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">-</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">linux</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">-</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">gnu</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">libc</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">so</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">6</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">(</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">0x00007ffff7a79000</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">)</span></code></section></li>
<li><section style="overflow-wrap: break-word;width: 1200px;max-width: 1200px !important;"><code style="overflow-wrap: break-word;background: none;color: rgb(33, 150, 243);line-height: 1.2em;padding-left: 10px !important;border-radius: 0px !important;margin-top: 1em !important;margin-bottom: 1em !important;border-width: initial !important;border-style: none !important;border-color: initial !important;"><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">        </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">lib64</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="kwd" style="overflow-wrap: break-word;color: rgb(226, 137, 100);">ld</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">-</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">linux</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">-</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">x86</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">-</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">64.so</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">2</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">(</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">0x00007ffff7fd3000</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">)</span></code></section></li>
</ol>

如果将其重新设置为 2 来启用 ASLR,你将会看到每次运行 ldd,得到的内存地址都不相同。

<ol class="linenums list-paddingleft-2" style="margin-left: 2em;margin-right: 2em;">
<li><section style="overflow-wrap: break-word;width: 1200px;max-width: 1200px !important;"><code style="overflow-wrap: break-word;background: none;color: rgb(33, 150, 243);line-height: 1.2em;padding-left: 10px !important;border-radius: 0px !important;margin-top: 1em !important;margin-bottom: 1em !important;border-width: initial !important;border-style: none !important;border-color: initial !important;"><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">$ </span><span class="kwd" style="overflow-wrap: break-word;color: rgb(226, 137, 100);">sudo</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="kwd" style="overflow-wrap: break-word;color: rgb(226, 137, 100);">sysctl</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">-</span><span class="kwd" style="overflow-wrap: break-word;color: rgb(226, 137, 100);">w</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> kernel</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">randomize_va_space</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">=</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">2</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">    </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"><==</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> enable</span></code></section></li>
<li><section style="overflow-wrap: break-word;width: 1200px;max-width: 1200px !important;"><code style="overflow-wrap: break-word;background: none;color: rgb(33, 150, 243);line-height: 1.2em;padding-left: 10px !important;border-radius: 0px !important;margin-top: 1em !important;margin-bottom: 1em !important;border-width: initial !important;border-style: none !important;border-color: initial !important;"><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">[</span><span class="kwd" style="overflow-wrap: break-word;color: rgb(226, 137, 100);">sudo</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">]</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> password </span><span class="kwd" style="overflow-wrap: break-word;color: rgb(226, 137, 100);">for</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> shs</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">:</span></code></section></li>
<li><section style="overflow-wrap: break-word;width: 1200px;max-width: 1200px !important;"><code style="overflow-wrap: break-word;background: none;color: rgb(33, 150, 243);line-height: 1.2em;padding-left: 10px !important;border-radius: 0px !important;margin-top: 1em !important;margin-bottom: 1em !important;border-width: initial !important;border-style: none !important;border-color: initial !important;"><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">kernel</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">randomize_va_space </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">=</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">2</span></code></section></li>
<li><section style="overflow-wrap: break-word;width: 1200px;max-width: 1200px !important;"><code style="overflow-wrap: break-word;background: none;color: rgb(33, 150, 243);line-height: 1.2em;padding-left: 10px !important;border-radius: 0px !important;margin-top: 1em !important;margin-bottom: 1em !important;border-width: initial !important;border-style: none !important;border-color: initial !important;"><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">$ </span><span class="kwd" style="overflow-wrap: break-word;color: rgb(226, 137, 100);">ldd</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">bin</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="kwd" style="overflow-wrap: break-word;color: rgb(226, 137, 100);">bash</span></code></section></li>
<li><section style="overflow-wrap: break-word;width: 1200px;max-width: 1200px !important;"><code style="overflow-wrap: break-word;background: none;color: rgb(33, 150, 243);line-height: 1.2em;padding-left: 10px !important;border-radius: 0px !important;margin-top: 1em !important;margin-bottom: 1em !important;border-width: initial !important;border-style: none !important;border-color: initial !important;"><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">        linux</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">-</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">vdso</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">so</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">1</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">(</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">0x00007fff47d0e000</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">)</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"><==</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> first </span><span class="kwd" style="overflow-wrap: break-word;color: rgb(226, 137, 100);">set</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> of addresses</span></code></section></li>
<li><section style="overflow-wrap: break-word;width: 1200px;max-width: 1200px !important;"><code style="overflow-wrap: break-word;background: none;color: rgb(33, 150, 243);line-height: 1.2em;padding-left: 10px !important;border-radius: 0px !important;margin-top: 1em !important;margin-bottom: 1em !important;border-width: initial !important;border-style: none !important;border-color: initial !important;"><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">        libtinfo</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">so</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">6</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">=></span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">lib</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">x86_64</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">-</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">linux</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">-</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">gnu</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">libtinfo</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">so</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">6</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">(</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">0x00007f1cb7ce0000</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">)</span></code></section></li>
<li><section style="overflow-wrap: break-word;width: 1200px;max-width: 1200px !important;"><code style="overflow-wrap: break-word;background: none;color: rgb(33, 150, 243);line-height: 1.2em;padding-left: 10px !important;border-radius: 0px !important;margin-top: 1em !important;margin-bottom: 1em !important;border-width: initial !important;border-style: none !important;border-color: initial !important;"><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">        libdl</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">so</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">2</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">=></span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">lib</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">x86_64</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">-</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">linux</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">-</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">gnu</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">libdl</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">so</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">2</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">(</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">0x00007f1cb7cda000</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">)</span></code></section></li>
<li><section style="overflow-wrap: break-word;width: 1200px;max-width: 1200px !important;"><code style="overflow-wrap: break-word;background: none;color: rgb(33, 150, 243);line-height: 1.2em;padding-left: 10px !important;border-radius: 0px !important;margin-top: 1em !important;margin-bottom: 1em !important;border-width: initial !important;border-style: none !important;border-color: initial !important;"><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">        libc</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">so</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">6</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">=></span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">lib</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">x86_64</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">-</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">linux</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">-</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">gnu</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">libc</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">so</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">6</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">(</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">0x00007f1cb7af0000</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">)</span></code></section></li>
<li><section style="overflow-wrap: break-word;width: 1200px;max-width: 1200px !important;"><code style="overflow-wrap: break-word;background: none;color: rgb(33, 150, 243);line-height: 1.2em;padding-left: 10px !important;border-radius: 0px !important;margin-top: 1em !important;margin-bottom: 1em !important;border-width: initial !important;border-style: none !important;border-color: initial !important;"><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">        </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">lib64</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="kwd" style="overflow-wrap: break-word;color: rgb(226, 137, 100);">ld</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">-</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">linux</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">-</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">x86</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">-</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">64.so</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">2</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">(</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">0x00007f1cb8045000</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">)</span></code></section></li>
<li><section style="overflow-wrap: break-word;width: 1200px;max-width: 1200px !important;"><code style="overflow-wrap: break-word;background: none;color: rgb(33, 150, 243);line-height: 1.2em;padding-left: 10px !important;border-radius: 0px !important;margin-top: 1em !important;margin-bottom: 1em !important;border-width: initial !important;border-style: none !important;border-color: initial !important;"><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">$ </span><span class="kwd" style="overflow-wrap: break-word;color: rgb(226, 137, 100);">ldd</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">bin</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="kwd" style="overflow-wrap: break-word;color: rgb(226, 137, 100);">bash</span></code></section></li>
<li><section style="overflow-wrap: break-word;width: 1200px;max-width: 1200px !important;"><code style="overflow-wrap: break-word;background: none;color: rgb(33, 150, 243);line-height: 1.2em;padding-left: 10px !important;border-radius: 0px !important;margin-top: 1em !important;margin-bottom: 1em !important;border-width: initial !important;border-style: none !important;border-color: initial !important;"><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">        linux</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">-</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">vdso</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">so</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">1</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">(</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">0x00007ffe1cbd7000</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">)</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"><==</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> second </span><span class="kwd" style="overflow-wrap: break-word;color: rgb(226, 137, 100);">set</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> of addresses</span></code></section></li>
<li><section style="overflow-wrap: break-word;width: 1200px;max-width: 1200px !important;"><code style="overflow-wrap: break-word;background: none;color: rgb(33, 150, 243);line-height: 1.2em;padding-left: 10px !important;border-radius: 0px !important;margin-top: 1em !important;margin-bottom: 1em !important;border-width: initial !important;border-style: none !important;border-color: initial !important;"><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">        libtinfo</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">so</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">6</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">=></span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">lib</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">x86_64</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">-</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">linux</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">-</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">gnu</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">libtinfo</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">so</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">6</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">(</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">0x00007fed59742000</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">)</span></code></section></li>
<li><section style="overflow-wrap: break-word;width: 1200px;max-width: 1200px !important;"><code style="overflow-wrap: break-word;background: none;color: rgb(33, 150, 243);line-height: 1.2em;padding-left: 10px !important;border-radius: 0px !important;margin-top: 1em !important;margin-bottom: 1em !important;border-width: initial !important;border-style: none !important;border-color: initial !important;"><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">        libdl</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">so</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">2</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">=></span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">lib</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">x86_64</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">-</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">linux</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">-</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">gnu</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">libdl</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">so</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">2</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">(</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">0x00007fed5973c000</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">)</span></code></section></li>
<li><section style="overflow-wrap: break-word;width: 1200px;max-width: 1200px !important;"><code style="overflow-wrap: break-word;background: none;color: rgb(33, 150, 243);line-height: 1.2em;padding-left: 10px !important;border-radius: 0px !important;margin-top: 1em !important;margin-bottom: 1em !important;border-width: initial !important;border-style: none !important;border-color: initial !important;"><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">        libc</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">so</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">6</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">=></span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">lib</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">x86_64</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">-</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">linux</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">-</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">gnu</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">libc</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">so</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">6</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">(</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">0x00007fed59552000</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">)</span></code></section></li>
<li><section style="overflow-wrap: break-word;width: 1200px;max-width: 1200px !important;"><code style="overflow-wrap: break-word;background: none;color: rgb(33, 150, 243);line-height: 1.2em;padding-left: 10px !important;border-radius: 0px !important;margin-top: 1em !important;margin-bottom: 1em !important;border-width: initial !important;border-style: none !important;border-color: initial !important;"><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">        </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">lib64</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">/</span><span class="kwd" style="overflow-wrap: break-word;color: rgb(226, 137, 100);">ld</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">-</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">linux</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">-</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">x86</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">-</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">64.so</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">.</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">2</span><span class="pln" style="overflow-wrap: break-word;color: rgb(184, 255, 184);"> </span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">(</span><span class="lit" style="overflow-wrap: break-word;color: rgb(51, 135, 204);">0x00007fed59aa7000</span><span class="pun" style="overflow-wrap: break-word;color: rgb(184, 255, 184);">)</span></code></section></li>
</ol>

尝试绕过 ASLR

尽管这项技术有很多优点,但绕过 ASLR 的攻击并不罕见,主要有以下几类:

◈ 利用地址泄露
◈ 访问与特定地址关联的数据
◈ 针对 ASLR 实现的缺陷来猜测地址,常见于系统熵过低或 ASLR 实现不完善。
◈ 利用侧信道攻击

总结

ASLR 有很大的价值,尤其是在 64 位系统上运行并被正确实现时。虽然不能避免被绕过,但这项技术的确使得利用系统漏洞变得更加困难了。这份参考资料可以提供 在 64 位 Linux 系统上的完全 ASLR 的有效性[1] 的更多有关细节,这篇论文介绍了一种利用分支预测 绕过 ASLR[2] 的技术。


via: https://www.networkworld.com/article/3331199/linux/what-does-aslr-do-for-linux.html

作者:Sandra Henry-Stocker[4] 选题:lujun9972 译者:leommxj 校对:wxy

本文由 LCTT 原创编译,Linux中国 荣誉推出

ASLR 是如何保护 Linux 系统免受缓冲区溢出攻击的 | Linux 中国


Hacking For Fun , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:ASLR 是如何保护 Linux 系统免受缓冲区溢出攻击的 | Linux 中国
喜欢 (0)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址