计算机科学 ›› 2026, Vol. 53 ›› Issue (8): 446-454.doi: 10.11896/jsjkx.250600180

• 信息安全 • 上一篇    下一篇

基于代码专门化的程序能力限制方法

樊宇豪1, 孙聪1, 张淋茂2   

  1. 1 西安电子科技大学网络与信息安全学院 西安 710126
    2 华为技术有限公司 西安 710100
  • 收稿日期:2025-06-24 修回日期:2025-11-06 发布日期:2026-08-17
  • 通讯作者: 孙聪(suncong@xidian.edu.cn)
  • 作者简介:(minamiya26@163.com)
  • 基金资助:
    国家自然科学基金(62272366)

Program Capabilities Reduction Based on Code Specialization

FAN Yuhao1, SUN Cong1, ZHANG Linmao2   

  1. 1 School of Cyber Engineering, Xidian University, Xi’an 710126, China
    2 Huawei Technologies Co., Ltd., Xi’an 710100, China
  • Received:2025-06-24 Revised:2025-11-06 Online:2026-08-17
  • About author:FAN Yuhao,born in 2000,master.His main research interests include software security and so on.
    SUN Cong,born in 1982,Ph.D,professor,Ph.D supervisor,is a member of CCF(No.28286M).His main research interests include software security,program analysis,and high-confidence software.
  • Supported by:
    National Natural Science Foundation of China(62272366).

摘要: Linux系统setuid机制允许用户临时提升程序权限,但这一机制违背了最小特权原则。一旦此类程序存在漏洞,攻击者就可利用其权限实现提权,导致严重后果。为降低风险,Linux引入了能力机制,将root权限分散到一组细粒度的能力中,按需分配能力。现有基于系统调用识别的能力限制方案在赋予程序真正需要的能力子集时仍存在缺陷:一方面,由于未过滤动态库冗余代码及对Glibc库函数调用图分析不精确,得到的系统调用集过近似;另一方面,对系统调用的参数分析不准确,导致对程序需要的能力估计较保守。对此,提出了一种基于代码专门化的程序能力限制方案。方案对程序依赖的二进制动态库进行裁剪,减少冗余库代码对系统调用识别的影响;结合动态库裁剪结果对Glibc调用图进行修剪和系统调用分析,得到更精确的程序特定系统调用集。进一步地,对裁剪后的程序特定的动态库进行后向迭代数据流分析,提取特定系统调用的敏感参数值,依据程序特定系统调用集和敏感参数值得到程序需要的精确能力集。对于具体的二进制程序,在实现以上分析的基础上,依据分析得到的精确能力集和系统调用集对二进制程序进行限制,减少程序能够执行的特权操作。实验结果表明,所提方法相比现有方案,系统调用识别更精确,能实现更强的程序能力限制,在setuid程序上能够显著减小攻击面并缓解特权升级漏洞。

关键词: 权限, 系统调用, Linux能力, 程序分析, 数据流分析, 参数分析

Abstract: The setuid mechanism in Linux enables users to temporarily escalate the privileges of programs.Such a mechanism violates the principle of least privilege.Once vulnerabilities exist in these programs,attackers can exploit the privileges to conduct privilege escalation,resulting in severe consequences.To address this issue,the capability mechanism in Linux decomposes the root privilege into a set of fine-grained capabilities and assigns only the required capability to the program,thereby mitigating risks.Existing capability-limiting approaches based on system-call identification have exhibited drawbacks when obtaining the genuine capability subset required by the program.On one hand,due to the failure to filter out redundant code in dynamic libraries and the inaccurate analysis of the Glibc call graph,the resulting system-call set is over-approximated.On the other hand,the inaccurate system-call parameter analysis leads to a conservative estimation of capabilities for the system calls.This paper presents a program capability-limiting framework based on code specialization.The program-dependent dynamic libraries are pruned to reduce the impact of redundant library code on the system-call identification.Combined with the dynamic library pruning results,this work analyzes the system calls on the pruned Glibc call graph and obtains a more precise set of system calls specific to the program.Moreover,this work conducts iterative backward data-flow analysis on the pruned program-specific dynamic libraries to extract sensitive parameter values for specific system calls.Based on the program-specific system call set and the sensitive para-meter values,the accurate capability set required by the program is identified.For a specific binary program,the proposed framework conducts the analysis and restricts the program with the accurate capability set and system-call set,thereby reducing the privileged operations that the program can perform.Experimental results demonstrate that,compared to state-of-the-art approaches,the proposed approach identifies system calls more accurately and enforces stronger capability restrictions on the program.On setuid programs,this work can significantly reduce the attack surface and alleviate privilege-escalation vulnerabilities.

Key words: Privilege, System call, Linux capability, Program analysis, Data-flow analysis, Parameter analysis

中图分类号: 

  • TP309
[1] GREGG B.Linux bcc Tracing Security Capabilities[EB/OL].(2016-10-01)[2025-05-17].https://www.brendangregg.com/blog/2016-10-01/linux-bcc-security-capabilities.html.
[2] KANG H,KIM J,SHIN S.MiniCon:Automatic Enforcement of a Minimal Capability Set for Security-Enhanced Containers[C]//Proceedings of the IEEE International IoT,Electronics and Mechatronics Conference.IEEE,2021:1-5.
[3] HASAN M M,GHAVAMNIA S,POLYCHRONAKIS M.Decap:Deprivileging Programs by Reducing Their Capabilities[C]//Proceedings of the 25th International Symposium on Research in Attacks,Intrusions and Defenses.ACM,2022:395-408.
[4] 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.ACM,2020:459-474.
[5] 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.ACM,2020:443-458.
[6] KERRISK M.CAP_SYS_ADMIN:the new root[EB/OL].(2012-02-15)[2025-05-17].https://lwn.net/Articles/486306/.
[7] ZHANG L M,SUN C,RAO X.Dynamic Library Debloating Enhanced System Call Restriction of Programs[J].Computer Science,2025,52(7):50-57.
[8] 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.
[9] 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.
[10] 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.
[11] Musl Libc[EB/OL].2024[2025-05-17].https://musl.libc.org/.
[12] HU X Y,ZHOU J,GRAVANI S,et al.Transforming Code to Drop Dead Privileges[C]//Proceedings of the 2018 IEEE Cybersecurity Development.IEEE,2018:45-52.
[13] SUN M H,SONG Z R,REN XX,et al.LiCA:A Fine-Grained and Path-Sensitive Linux Capability Analysis Framework[C]//Proceedings of the 25th International Symposium on Research in Attacks,Intrusions and Defenses.2022:364-379.
[14] VAN DER VEEN V,GOKTAS E,CONTAG M,et al.A Tough Call:Mitigating Advanced Code-Reuse Attacks at the Binary Level[C]//Proceedings of 2016 IEEE Symposium on Security and Privacy.IEEE,2016:934-953.
[15] ANDERSEN L O.Program analysis and specialization for the C programming language[D].Copenhagen:University of Cophenhagen,1994.
[16] HIND M.Pointer Analysis:Haven’t We Solved This ProblemYet?[C]//Proceedings of the ACM SIGPLAN/SIGSOFT Workshop on Program Analysis for Software Tools and Engineering.ACM,2001:54-61.
[17] 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.
[18] LUK C K,COHN R,MUTH R,et al.Pin:Building Customized Program Analysis Tools with Dynamic Instrumentation[J].ACM SIGPLAN Notices,2005,40(6):190-200.
Viewed
Full text


Abstract

Cited

  Shared   
  Discussed   
No Suggested Reading articles found!