Class EasyTaintWrapper
java.lang.Object
soot.jimple.infoflow.taintWrappers.AbstractTaintWrapper
soot.jimple.infoflow.taintWrappers.EasyTaintWrapper
- All Implemented Interfaces:
Cloneable,IReversibleTaintWrapper,ITaintPropagationWrapper
public class EasyTaintWrapper
extends AbstractTaintWrapper
implements IReversibleTaintWrapper, Cloneable
A list of methods is passed which contains signatures of instance methods
that taint their base objects if they are called with a tainted parameter.
When a base object is tainted, all return values are tainted, too. For static
methods, only the return value is assumed to be tainted when the method is
called with a tainted parameter value.
- Author:
- Christian Fritz, Steven Arzt
-
Field Summary
Fields inherited from class soot.jimple.infoflow.taintWrappers.AbstractTaintWrapper
manager -
Constructor Summary
ConstructorsConstructorDescriptionEasyTaintWrapper(InputStream stream) EasyTaintWrapper(Reader reader) EasyTaintWrapper(Map<String, Set<String>> classList) Creates a new instanceof theEasyTaintWrapperclass.EasyTaintWrapper(Map<String, Set<String>> classList, Map<String, Set<String>> excludeList, Map<String, Set<String>> killList) EasyTaintWrapper(Map<String, Set<String>> classList, Map<String, Set<String>> excludeList, Map<String, Set<String>> killList, Set<String> includeList) EasyTaintWrapper(EasyTaintWrapper taintWrapper) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddIncludePrefix(String prefix) Registers a prefix of class names to be included when generating taints.voidaddMethodForWrapping(String className, String subSignature) Adds a method to which the taint wrapping rules shall applyclone()booleanGets whether the taint wrapper shall always consider return values as tainted if the base object of the respective invocation is taintedgetAliasesForMethod(soot.jimple.Stmt stmt, Abstraction d1, Abstraction taintedPath) Gets the aliases that a summarized method generates for the given abstraction.booleanGets whether the equals() and hashCode() methods shall always be modeled, regardless of the target type.static EasyTaintWrappergetInverseTaintsForMethod(soot.jimple.Stmt stmt, Abstraction d1, Abstraction taintedPath) Checks an invocation statement for black-box taint propagation.getInverseTaintsForMethodInternal(soot.jimple.Stmt stmt, Abstraction taintedAbs) getTaintsForMethodInternal(soot.jimple.Stmt stmt, AccessPath taintedPath) Checks an invocation statement for black-box taint propagation.booleanisExclusiveInternal(soot.jimple.Stmt stmt, AccessPath taintedPath) Gets whether the taints produced by this taint wrapper are exclusive, i.e.static FileAttempts to locate the definition file for the easy taint wrapper in its default locationvoidsetAggressiveMode(boolean aggressiveMode) Sets whether the taint wrapper shall always assume the return value of a call "a = x.foo()" to be tainted if the base object is tainted, even if the respective method is not in the data file.voidsetAlwaysModelEqualsHashCode(boolean alwaysModelEqualsHashCode) Sets whether the equals() and hashCode() methods shall always be modeled, regardless of the target type.booleansupportsCallee(soot.jimple.Stmt callSite) Checks whether this taint wrapper can in general produce artificial taints for the given call site.booleansupportsCallee(soot.SootMethod method) Checks whether this taint wrapper can in general produce artificial taints for the given callee.Methods inherited from class soot.jimple.infoflow.taintWrappers.AbstractTaintWrapper
getPreAnalysisHandlers, getTaintsForMethod, getWrapperHits, getWrapperMisses, initialize, isExclusiveMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface soot.jimple.infoflow.taintWrappers.ITaintPropagationWrapper
getPreAnalysisHandlers, getTaintsForMethod, getWrapperHits, getWrapperMisses, initialize, isExclusive
-
Constructor Details
-
EasyTaintWrapper
Creates a new instanceof theEasyTaintWrapperclass. This constructor assumes that all classes are included and get wrapped. However, only the methods in the given map create new taints- Parameters:
classList- The method for which to create new taints. This is a mapping from class names to sets of subsignatures.
-
EasyTaintWrapper
-
EasyTaintWrapper
-
EasyTaintWrapper
-
EasyTaintWrapper
- Throws:
IOException
-
EasyTaintWrapper
- Throws:
IOException
-
EasyTaintWrapper
- Throws:
IOException
-
EasyTaintWrapper
- Throws:
IOException
-
EasyTaintWrapper
-
-
Method Details
-
getDefault
- Throws:
IOException
-
getTaintsForMethodInternal
Description copied from class:AbstractTaintWrapperChecks an invocation statement for black-box taint propagation. This allows the wrapper to artificially propagate taints over method invocations without requiring the analysis to look inside the method.- Specified by:
getTaintsForMethodInternalin classAbstractTaintWrapper- Parameters:
stmt- The invocation statement which to check for black-box taint propagationtaintedPath- The tainted field or value to propagate- Returns:
- The list of tainted values after the invocation statement referenced
in
Stmthas been executed
-
getInverseTaintsForMethod
public Set<Abstraction> getInverseTaintsForMethod(soot.jimple.Stmt stmt, Abstraction d1, Abstraction taintedPath) Description copied from interface:IReversibleTaintWrapperChecks an invocation statement for black-box taint propagation. This allows the wrapper to artificially propagate taints over method invocations without requiring the analysis to look inside the method. Note that this method is the inverse ofgetTaintsForMethod. It obtains the taints that could have been tainted before a certain statement was executed given a taint that was active after the call.- Specified by:
getInverseTaintsForMethodin interfaceIReversibleTaintWrapper- Parameters:
stmt- The invocation statement which to check for black-box taint propagationd1- The abstraction at the beginning of the method that calls the wrapped methodtaintedPath- The tainted field or value to propagate. Note that this taint must be valid after the execution of the black-box method.- Returns:
- The list of possibly tainted values before the invocation statement
referenced in
Stmthas been executed
-
getInverseTaintsForMethodInternal
public Set<AccessPath> getInverseTaintsForMethodInternal(soot.jimple.Stmt stmt, Abstraction taintedAbs) -
isExclusiveInternal
Description copied from class:AbstractTaintWrapperGets whether the taints produced by this taint wrapper are exclusive, i.e. there are no other taints than those produced by the wrapper. In effect, this tells the analysis not to propagate inside the callee.- Specified by:
isExclusiveInternalin classAbstractTaintWrapper- Parameters:
stmt- The call statement to checktaintedPath- The tainted field or value to propagate- Returns:
- True if this taint wrapper is exclusive, otherwise false.
-
setAggressiveMode
public void setAggressiveMode(boolean aggressiveMode) Sets whether the taint wrapper shall always assume the return value of a call "a = x.foo()" to be tainted if the base object is tainted, even if the respective method is not in the data file.- Parameters:
aggressiveMode- True if return values shall always be tainted if the base object on which the method is invoked is tainted, otherwise false
-
getAggressiveMode
public boolean getAggressiveMode()Gets whether the taint wrapper shall always consider return values as tainted if the base object of the respective invocation is tainted- Returns:
- True if return values shall always be tainted if the base object on which the method is invoked is tainted, otherwise false
-
setAlwaysModelEqualsHashCode
public void setAlwaysModelEqualsHashCode(boolean alwaysModelEqualsHashCode) Sets whether the equals() and hashCode() methods shall always be modeled, regardless of the target type.- Parameters:
alwaysModelEqualsHashCode- True if the equals() and hashCode() methods shall always be modeled, regardless of the target type, otherwise false
-
getAlwaysModelEqualsHashCode
public boolean getAlwaysModelEqualsHashCode()Gets whether the equals() and hashCode() methods shall always be modeled, regardless of the target type.- Returns:
- True if the equals() and hashCode() methods shall always be modeled, regardless of the target type, otherwise false
-
addIncludePrefix
Registers a prefix of class names to be included when generating taints. All classes whose names don't start with a registered prefix will be skipped.- Parameters:
prefix- The prefix to register
-
addMethodForWrapping
Adds a method to which the taint wrapping rules shall apply- Parameters:
className- The class containing the method to be wrappedsubSignature- The subsignature of the method to be wrapped
-
clone
-
supportsCallee
public boolean supportsCallee(soot.SootMethod method) Description copied from interface:ITaintPropagationWrapperChecks whether this taint wrapper can in general produce artificial taints for the given callee. If an implementation returns "false" for a callee, all call sites for this callee might be removed if not needed elsewhere.- Specified by:
supportsCalleein interfaceITaintPropagationWrapper- Parameters:
method- The method to check- Returns:
- True if this taint wrapper can in general produce taints for the given method.
-
supportsCallee
public boolean supportsCallee(soot.jimple.Stmt callSite) Description copied from interface:ITaintPropagationWrapperChecks whether this taint wrapper can in general produce artificial taints for the given call site. If an implementation returns "false" for a call site, this call sites might be removed if not needed elsewhere.- Specified by:
supportsCalleein interfaceITaintPropagationWrapper- Parameters:
callSite- The call site to check- Returns:
- True if this taint wrapper can in general produce taints for the given call site.
-
getAliasesForMethod
public Set<Abstraction> getAliasesForMethod(soot.jimple.Stmt stmt, Abstraction d1, Abstraction taintedPath) Description copied from interface:ITaintPropagationWrapperGets the aliases that a summarized method generates for the given abstraction. Note that this is a may-alias problem.- Specified by:
getAliasesForMethodin interfaceITaintPropagationWrapper- Parameters:
stmt- The statement that calls the summarized methodd1- The abstraction at the entry point of the method that calls the wrapped methodtaintedPath- The abstraction for which the aliases shall be computed- Returns:
- The set of aliases for the given abstraction or null if no such aliases exist
-
locateDefaultDefinitionFile
Attempts to locate the definition file for the easy taint wrapper in its default location- Returns:
- The default definition file for the easy taint wrapper if it could be found, otherwise null
-