model checking one million lines of c code检查c代码一百万行模型_第1页
model checking one million lines of c code检查c代码一百万行模型_第2页
model checking one million lines of c code检查c代码一百万行模型_第3页
model checking one million lines of c code检查c代码一百万行模型_第4页
model checking one million lines of c code检查c代码一百万行模型_第5页
已阅读5页,还剩17页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1,Model Checking One Million Lines of C Code,Hao Chen, UC BerkeleyDrew Dean, SRI InternationalDavid Wagner, UC Berkeley,2,MOPS (MOdel checking Programs for Security properties),A static analysis tool that checks source programs for temporal safety properties.e.g. a setuid-root program must drop privilege before making risky system calls.AnalysisPushdown model checkingInter-proceduralControl flow centric,3,The MOPS process,Parser,ModelChecker,C Program,SafetyProperty,CFG,FSA,Program satisifessafety property,Error Traces,FSA: finite state automatonCFG: control flow graph,Treat the model checker as a black box for this talk,4,Is software model checking readyfor prime time?,Can model checking be used by open source developers to find security vulnerabilities?Criteria for a successful toolIt is usefulCan check many propertiesCan check diverse, widely-deployed programsRequires moderate computational resourcesIt is usableCan be used easily by non-tool developersCan generate comprehensible error reports,5,Outline,ExperimentPrograms: 8 widely-deployed programs, with over 1 million LOCProperties: 5 security-related propertiesFindingsMore than a dozen vulnerabilities and weaknesses Usability improvementsConclusion,6,Programs,7,Security properties,Drop privilege completely when neededAvoid stderr vulnerability Avoid race condition (TOCTTOU)Create chroot-jail safelychdir(“/”) must follow chroot() immediatelyCreate temporary files safelyUse only the safe function mkstemp()Never reuse filename in mkstemp(filename),8,Property: drop privilege completely,Setuid-root programs should drop root privilege completelybefore executing an untrusted program via system(), popen(), execvp() and friends, orwhen the program intends to do soOtherwise, the remaining privilege may be exploited bythe untrusted program that is executedmalicious code injected via buffer overrun attacks,9,Vulnerability: fail to drop privilege completely,seteuid(getuid();setuid(getuid();execlp(askpass, askpass, msg, (char *) 0);,OpenSSH client(in readpass.c),10,What is wrong?,R0, E=S=0,OpenSSH 3.5 on Linux,R=E0, S=0,R=E0, S=0,seteuid(getuid(),setuid(getuid(),R0, E=S=0,OpenSSH 3.5 on OpenBSD,R=E0, S=0,R=E=S0,seteuid(getuid(),setuid(getuid(),R0, E=S=0,OpenSSH 2.5.2 on Linux,R=E=S0,setuid(getuid(),11,Potential Vulnerability,Weaknessesssh: fails to drop privilege before executing a user programssh-keysign: fails to drop privilege before doing complex cryptographic operationsA buffer overrun would allow the attacker to regain root privilege in euid.,12,Property: drop privilege completely,13,Vulnerability: stderr exploits in at,attack.c,at.c,Code,Standard File Descriptorsstdinstdoutstderr,close(1); close(2);,execl(“at”, );,open(LFILE, O_WRONLY);,fd = open(atfile, O_CREAT);,ttyttytty,tty ,tty ,ttyLFILE,ttyLFILEatfile,Rule: No setuid-root program may open a file for writing to stderr,14,Property: stderr vulnerability,15,Summary of Findings,16,Outline,ExperimentPrograms: 8 widely-deployed programs, with over 1 million LOCProperties: 5 security-related propertiesFindingsMore than a dozen vulnerabilities and weaknesses Usability improvementsConclusion,17,Usability improvement 1:Make it really easy to run!,ProblemsPackages have different build processesTool has to be manually configured for each packageSolutionProvide a script that integrates model checking into the build processes of packages automaticallyResult: allow the user to run the tool as simple asmops m setuid.fsa openssh-3.5p1-6.src.rpm,18,Integrating MOPS intoSoftware Build Processes,1st attempt: manually edit MakefilesToo complicated; does not survive autoconf2nd attempt: setenv GCC_EXEC_PREFIX to run MOPS instead of gccBuild processes generate links to object files broken4th attempt: Put CFGs into ELF filesSolves all identified problems!,19,Usability improvement 2:report comprehensible error messages,ProblemOne bug may trigger many error tracesThe user has to review all the traces manuallyCriteria for good error trace reportingReporting one error trace per bugReporting shortest error traces,20,Algorithm,Find the shortest error trace t and output itFind the crucial statement s on t, i.e. the first statement that causes an error on tPrune s from the programIf the program still has error traces, go to step 1,21,Criteria for good tools: revisited,It is usefulCan check many propertiesCan check diverse, widely-deployed programsRequires moderate computational resourcesIt is usableCan be used easily by non-tool developersCan generate comprehensible error reports,22,Conclusion,Mod

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论