Taint analysis for C depends on how precisely the analysis tracks tainted values as they flow through memory objects. Without field sensitivity, a tainted object field can spuriously taint an entire object, producing significant false alarms. In this paper, we present a field-sensitive taint analysis that combines Data Structure Analysis (DSA) for field-sensitive points-to information with a data-flow analysis for tracking explicit dependencies. We identify that existing DSA-style analyses lose precision on a common object pattern: a C struct object that mixes scalar fields with a flexible array member. When such an array is accessed with symbolic indices, DSA loses points-to field sensitivity for the entire object, inflating false alarms in the data-flow analysis. To address this, we propose I-DSA, which extends DSA by representing field positions as intervals, so that a pointer with symbolic bounds merges only the fields within those bounds. We further develop a sound data-flow analysis based on abstract interpretation. We implement I-DSA on top of SeaDSA and the data-flow analysis inside Crab. Our tool targets LLVM IR and supports configurable taint policies by instrumenting the IR with taint intrinsics. Our experiments show that I-DSA reduces the false alarms caused by this pattern at little cost in the pointer analysis, that SVF, an inclusion-based pointer analysis, shows a similar field-sensitivity loss, and that our taint analysis scales better than PhASAR on real-world programs.
翻译:暂无翻译