Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(勘误) P42 - 3.2.3 CVE-2019-14271:加载不受信任的动态链接库 #6

Closed
XDTG opened this issue Apr 12, 2022 · 3 comments
Closed
Assignees
Labels
erratum 勘误

Comments

@XDTG
Copy link

XDTG commented Apr 12, 2022

P42 - 3.2.3.3 第三步:实现逃逸
正文倒数第一行:

符号链接指向的库文件移动到容器根目录下并重命名为 original_libnss_files.so.2。

此处移动的对象可以为 libnss_files.so.2 这个符号链接文件本身,不需要移动它所指向的库文件。
在 files-services.c 中添加的代码里,通过 rename(ORIGINAL_LIBNSS, LIBNSS_PATH) 恢复原始 libnss_files.so.2,如果是将库文件移动为 original_libnss_files.so.2,则原始的符号链接文件会被恢复成所指向库文件 ( libnss_files-2.27.so ),和此处本意不符。

@brant-ruan brant-ruan self-assigned this Apr 12, 2022
@brant-ruan brant-ruan added the erratum 勘误 label Apr 12, 2022
@brant-ruan
Copy link
Member

@XDTG 你好,书上描述的步骤应该没有问题,按照书上的步骤:

  1. 将libnss_files.so.2符号链接指向的文件libnss_files-2.27.so保存到/original_libnss_files.so.2;
  2. 将原libnss_files.so.2替换为前文构造好的恶意libnss_files.so(即,此时libnss_files.so.2不再是符号链接,而是实体文件);
  3. 在代码中,rename(ORIGINAL_LIBNSS, LIBNSS_PATH)将/original_libnss_files.so.2移动到/lib/x86_64-linux-gnu/libnss_files.so.2,此时的libnss_files.so.2也不再是符号链接,而是实体文件。

不过,上面这样操作后确实与实验前不同,libnss_files.so.2不再是符号链接。你提到的操作方式能够保证实验前后libnss_files.so.2都是符号链接。

@XDTG
Copy link
Author

XDTG commented Apr 12, 2022

@brant-ruan 确实,两种步骤都可以,只是感觉书上的操作多余了一步 readlink~,感谢回复

@brant-ruan
Copy link
Member

也谢谢你指出,下一次印刷时我们更新一下👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
erratum 勘误
Projects
None yet
Development

No branches or pull requests

2 participants