引言
背景
软件漏洞检测“两板斧”
静态分析工具现状
原理与实现
实例演示
漏洞原理
void CWE416_Use_After_Free__malloc_free_struct_01_bad()
{
twoIntsStruct * data;
/* Initialize data */
data = NULL;
data = (twoIntsStruct *)malloc(100*sizeof(twoIntsStruct));
if (data == NULL) {exit(-1);}
{
size_t i;
for(i = 0; i < 100; i++)
{
data[i].intOne = 1;
data[i].intTwo = 2;
}
}
/* POTENTIAL FLAW: Free data in the source - the bad sink attempts to use data */
free(data);
/* POTENTIAL FLAW: Use of data that may have been freed */
printStructLine(&data[0]);
/* POTENTIAL INCIDENTAL - Possible memory leak here if data was not freed */
}
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
printLine("Calling bad()...");
CWE416_Use_After_Free__malloc_free_struct_01_bad();
printLine("Finished bad()");
return 0;
}
安装及导入
结果展示
图2-1 分析结果展现
分析溯源
图3-1 分析溯源反汇编框
图3-2 分析溯源反编译框
性能评估
总结
迄今成果
步履不停
有奖反馈
文献参考