计算机科学 ›› 2025, Vol. 52 ›› Issue (7): 50-57.doi: 10.11896/jsjkx.240700026
张淋茂1,2, 孙聪1, 饶雪1
ZHANG Linmao1,2, SUN Cong1, RAO Xue1
摘要: 应用程序的开发和执行广泛依赖于动态库。动态库因具有多程序公用的特点,通常包含远多于特定应用程序所需函数的大量库函数。一方面,虽然应用程序通常仅使用动态库中的少量函数,但运行时会装载整个动态库,装载多余的库代码扩大了程序攻击面,对动态库进行应用程序特定的裁剪有助于减小攻击面。另一方面,现有的应用程序系统调用限制方案未考虑动态库裁剪带来的额外系统调用限制空间,因此无法实现对应用程序系统调用的严格限制。基于此,提出了一种基于中间表示的动态库裁剪增强的程序系统调用限制方案,对应用程序进行二进制裁剪,以减少应用程序本身的冗余代码对动态库裁剪与系统调用限制的影响。在动态库的中间表示上实现了一种改进的指针分析,获得与应用程序相关的库函数调用图,进而裁剪冗余库函数,生成裁剪后的动态库。在动态库中间表示上,提取与裁剪结果保留函数对应的系统调用,以确定系统调用允许集合。依据系统调用允许集合对裁剪后的二进制应用程序进行二进制重写,过滤允许集合之外的系统调用。实验结果表明,所提方案相比现有方案具有更高的库函数裁剪率和更严格的系统调用限制能力,指针分析方法具有更高精准性;在典型应用程序上,所提方案能够显著减小代码重用攻击面并避免典型的已知漏洞。
中图分类号:
[1]FLYNN C.PyPI Stats[EB/OL].[2024-07-01].https://pypistats.org/packages/all. [2]Packagist statistics[EB/OL].(2012-04-13)[2024-07-01].https://packagist.org/statistics. [3]QUACH A,ERINFOLAMI R,DEMICCO D,et al.A Multi-OS Cross-Layer Study of Bloating in User Programs,Kernel and Managed Execution Environments[C]//Proceedings of the 2017 Workshop on Forming an Ecosystem Around Software Transformation.ACM,2017:65-70. [4]AGADAKOS I,DEMARINIS N,JIN D,et al.Large-Scale Debloating of Binary Shared Libraries[J].Digital Threats:Research and Practice,2020,1(4):1-28. [5]AGADAKOS I,JIN D,WILLIAMS-KING D,et al.Nibbler:Debloating Binary Shared Libraries[C]//Proceedings of the 35th Annual Computer Security Applications Conference.ACM,2019:70-83. [6]ZHANG H,REN M,LEI Y,et al.One Size Does Not Fit All:Security Hardening of MIPS Embedded Systems via Static Binary Debloating for Shared Libraries[C]//Proceedings of the 27th ACM International Conference on Architectural Support for Programming Languages and Operating Systems.ACM,2022:255-270. [7]QIAN C,HU H,ALHARTHI M,et al.RAZOR:A Framework for Post-Deployment Software Debloating[C]//Proceedings of the 28th USENIX Security Symposium.USENIX Association,2019:1733-1750. [8]DING D,SUN C,ZHENG T.Robust Binary Program Debloating[J].Computer Science,2024,51(10):208-217. [9]GHAVAMNIA S,PALIT T,BENAMEUR A,et al.Confine:Automated System Call Policy Generation for Container Attack Surface Reduction[C]//Proceedings of the 23rd International Symposium on Research in Attacks,Intrusions and Defenses.USENIX Association,2020:443-458. [10]GHAVAMNIA S,PALIT T,MISHRA S,et al.Temporal System Call Specialization for Attack Surface Reduction[C]//Proceedings of the 29th USENIX Security Symposium.USENIX Association,2020:1749-1766. [11]DEMARINIS N,WILLIAMS-KING K,JIN D,et al.Sysfilter:Automated System Call Filtering for Commodity Software[C]//Proceedings of the 23rd International Symposium on Research in Attacks,Intrusions and Defenses.USENIX Association,2020:459-474. [12]Seccomp BPF(SECure COMPuting with filters)[EB/OL].[2024-07-01].https://www.kernel.org/doc/html/v4.16/userspace-api/seccomp_filter.html. [13]QUACH A,PRAKASH A,YAN L.Debloating Softwarethrough Piece-Wise Compilation and Loading[C]//Proceedings of the 27th USENIXSecurity Symposium.USENIX Association,2018:869-886. [14]PORTER C,MURURU G,BARUA P,et al.Blankit Library Debloating:Getting What You Want instead of Cutting What You don't[C]//Proceedings of the 41st ACM SIGPLAN Conference on Programming Language Design and Implementation.ACM,2020:164-180. [15]WILLIAMS-KING D,KOBAYASHI H,WILLIAMS-KING K,et al.Egalito:Layout-Agnostic Binary Recompilation[C]//Proceedings of the Twenty-Fifth International Conference on Architectural Support for Programming Languages and Operating Systems.ACM,2020:133-147. [16]SHOSHITAISHVILI Y,WANG R,SALLS C,et al.Sok:(State of) the Art of War:Offensive Techniques in Binary Analysis[C]//Proceedings of 2016 IEEE symposium on security and privacy.IEEE,2016:138-157. [17]RAJAGOPALAN V L,KLEFTOGIORGOS K,GOKTAS E,et al.SysPart:Automated Temporal System Call Filtering for Binaries[C]//Proceedings of the 2023 ACM SIGSAC Conference on Computer and Communications Security.ACM,2023:1979-1993. [18]GAIDIS A J,ATLIDAKIS V,KEMERLIS V P.SysXCHG:Refining Privilege with Adaptive System Call Filters[C]//Proceedings of the 2023 ACM SIGSAC Conference on Computer and Communications Security.ACM,2023:1964-1978. [19]SUI Y L,XUE J L.SVF:Interprocedural Static Value-Flow Analysis in LLVM[C]//Proceedings of the 25th International Conference on Compiler Construction.ACM,2016:265-266. [20]SUI Y,YE D,XUE J.Detecting Memory Leaks Statically with Full-Sparse Value-Flow Analysis[J].IEEE Transaction on Software Engineering,2014,40(2):107-122. [21]LU K,HU H.Where Does It Go?:Refining Indirect-Call Targets with Multi-Layer Type Analysis[C]//Proceedings of the 2019 ACM SIGSAC Conference on Computer and Communications Security.ACM,2019:1867-1881. [22]Seccomp Tools[EB/OL].[2024-07-01].https://github.com/david942j/seccomp-tools. [23]pwntools-CTF toolkit[EB/OL].[2024-07-01].https://github.com/Gallopsled/pwntools. [24]Musl Libc[EB/OL].[2024-07-01].https://www.musl-libc.org. [25]SHACHAM H.The Geometry of Innocent Flesh on the Bone:Return-into-Libc without Function Calls(on the X86)[C]//Proceedings of the 2007 ACM Conference on Computer and Communications Security.ACM,2007:552-561. [26]SIDIKE PA-ERHATIJIANG,MA J,SUN C.Fine-Grained Control Flow Integrity Method on Binaries[J].Computer Science,2019,46(S2):417-420. |
|