代码审计
人工代码审计
内存漏洞:高危函数
自动化代码审计
污点分析
fuzzing
符号执行
静态审计
攻击表面分析:监控文件执行记录重要行为 网络数据分析
angr例子
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
import angr, archinfo def basic_symbolic_execution(): proj = angr.Project('./mem') print hex(proj.entry) state = proj.factory.entry_state() br = state.solver.BVS("br", 32) state.solver.add(br < 102) state.solver.add(br.SGT(100)) state.memory.store(0x601030, br) simgr = proj.factory.simulation_manager(state) simgr.run() print simgr for value in simgr.stashes.values(): for s in value: print hex(s.solver.eval(br))
if __name__ == '__main__': basic_symbolic_execution()
state.inspect.b('mem_write', when=angr.BP_AFTER, action=debug_func)内存断点在写后并且执行debug函数
simgr.explore(find=lambda s: "Welcome" in s.posix.dumps(1))约束 print simgr return simgr.found[0].posix.dumps(0)输出
k = state.posix.files[0].read_from(1) state.solver.add(k.SGE(0x30)) state.solver.add(k.SLE(0x39))
from angr import Project, SimProcedure project = Project('./fauxware')
class BugFree(SimProcedure): def run(self, argc, argv): return 0
project.hook_symbol('main', BugFree())
simgr = project.factory.simulation_manager() project._sim_procedures simgr.run() print simgr.deadended[0].posix.dumps(1)
|