Package it.unive.lisa.analysis.taint
Class BaseTaint<T extends BaseTaint<T>>
- java.lang.Object
-
- it.unive.lisa.analysis.taint.BaseTaint<T>
-
- Type Parameters:
T
- the concrete type of the analysis
- All Implemented Interfaces:
it.unive.lisa.analysis.BaseLattice<T>
,it.unive.lisa.analysis.Lattice<T>
,it.unive.lisa.analysis.nonrelational.NonRelationalDomain<T,it.unive.lisa.symbolic.value.ValueExpression,it.unive.lisa.analysis.nonrelational.value.ValueEnvironment<T>>
,it.unive.lisa.analysis.nonrelational.NonRelationalElement<T,it.unive.lisa.symbolic.value.ValueExpression,it.unive.lisa.analysis.nonrelational.value.ValueEnvironment<T>>
,it.unive.lisa.analysis.nonrelational.value.BaseNonRelationalValueDomain<T>
,it.unive.lisa.analysis.nonrelational.value.NonRelationalValueDomain<T>
,it.unive.lisa.analysis.SemanticEvaluator
,it.unive.lisa.util.representation.StructuredObject
- Direct Known Subclasses:
Taint
,ThreeLevelsTaint
public abstract class BaseTaint<T extends BaseTaint<T>> extends java.lang.Object implements it.unive.lisa.analysis.nonrelational.value.BaseNonRelationalValueDomain<T>
A taint analysis, that is, an information-flow analysis tracking only explicit flows.
-
-
Field Summary
Fields Modifier and Type Field Description static it.unive.lisa.program.annotations.Annotation
CLEAN_ANNOTATION
The annotation used to mark clean variables, that is, sanitizers of tainted information.static it.unive.lisa.program.annotations.matcher.AnnotationMatcher
CLEAN_MATCHER
AnAnnotationMatcher
forCLEAN_ANNOTATION
.static it.unive.lisa.program.annotations.Annotation
TAINTED_ANNOTATION
The annotation used to mark tainted variables, that is, sources of tainted information.static it.unive.lisa.program.annotations.matcher.AnnotationMatcher
TAINTED_MATCHER
AnAnnotationMatcher
forTAINTED_ANNOTATION
.
-
Constructor Summary
Constructors Constructor Description BaseTaint()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description it.unive.lisa.analysis.nonrelational.value.ValueEnvironment<T>
assume(it.unive.lisa.analysis.nonrelational.value.ValueEnvironment<T> environment, it.unive.lisa.symbolic.value.ValueExpression expression, it.unive.lisa.program.cfg.ProgramPoint src, it.unive.lisa.program.cfg.ProgramPoint dest, it.unive.lisa.analysis.SemanticOracle oracle)
protected abstract T
clean()
Yields the domain element that represents clean values.protected T
defaultApprox(it.unive.lisa.symbolic.value.Identifier id, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle)
Default approximation forIdentifier
s.T
evalBinaryExpression(it.unive.lisa.symbolic.value.operator.binary.BinaryOperator operator, T left, T right, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle)
T
evalIdentifier(it.unive.lisa.symbolic.value.Identifier id, it.unive.lisa.analysis.nonrelational.value.ValueEnvironment<T> environment, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle)
T
evalNonNullConstant(it.unive.lisa.symbolic.value.Constant constant, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle)
T
evalNullConstant(it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle)
T
evalPushAny(it.unive.lisa.symbolic.value.PushAny pushAny, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle)
T
evalTernaryExpression(it.unive.lisa.symbolic.value.operator.ternary.TernaryOperator operator, T left, T middle, T right, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle)
T
evalTypeCast(it.unive.lisa.symbolic.value.BinaryExpression cast, T left, T right, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle)
T
evalTypeConv(it.unive.lisa.symbolic.value.BinaryExpression conv, T left, T right, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle)
T
evalUnaryExpression(it.unive.lisa.symbolic.value.operator.unary.UnaryOperator operator, T arg, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle)
T
fixedVariable(it.unive.lisa.symbolic.value.Identifier id, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle)
boolean
isAlwaysClean()
Yieldstrue
if this instance represents information that is definitely clean across all execution paths.abstract boolean
isAlwaysTainted()
Yieldstrue
if this instance represents information that is definitely tainted across all execution paths.boolean
isPossiblyClean()
Yieldstrue
if this instance represents information that is definitely clean in at least one execution path.abstract boolean
isPossiblyTainted()
Yieldstrue
if this instance represents information that is definitely tainted in at least one execution path.it.unive.lisa.analysis.lattices.Satisfiability
satisfies(it.unive.lisa.symbolic.value.ValueExpression expression, it.unive.lisa.analysis.nonrelational.value.ValueEnvironment<T> environment, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle)
protected abstract T
tainted()
Yields the domain element that represents tainted values.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface it.unive.lisa.analysis.BaseLattice
equals, glb, glbAux, hashCode, lessOrEqual, lessOrEqualAux, lub, lubAux, narrowing, narrowingAux, toString, widening, wideningAux
-
Methods inherited from interface it.unive.lisa.analysis.nonrelational.value.BaseNonRelationalValueDomain
assumeBinaryExpression, assumeTernaryExpression, assumeUnaryExpression, canProcess, eval, evalPushInv, evalSkip, evalValueExpression, satisfiesAbstractValue, satisfiesBinaryExpression, satisfiesNonNullConstant, satisfiesNullConstant, satisfiesTernaryExpression, satisfiesUnaryExpression
-
-
-
-
Field Detail
-
TAINTED_ANNOTATION
public static final it.unive.lisa.program.annotations.Annotation TAINTED_ANNOTATION
The annotation used to mark tainted variables, that is, sources of tainted information.
-
TAINTED_MATCHER
public static final it.unive.lisa.program.annotations.matcher.AnnotationMatcher TAINTED_MATCHER
AnAnnotationMatcher
forTAINTED_ANNOTATION
.
-
CLEAN_ANNOTATION
public static final it.unive.lisa.program.annotations.Annotation CLEAN_ANNOTATION
The annotation used to mark clean variables, that is, sanitizers of tainted information.
-
CLEAN_MATCHER
public static final it.unive.lisa.program.annotations.matcher.AnnotationMatcher CLEAN_MATCHER
AnAnnotationMatcher
forCLEAN_ANNOTATION
.
-
-
Method Detail
-
tainted
protected abstract T tainted()
Yields the domain element that represents tainted values.- Returns:
- the tainted domain element
-
clean
protected abstract T clean()
Yields the domain element that represents clean values.- Returns:
- the clean domain element
-
isAlwaysTainted
public abstract boolean isAlwaysTainted()
Yieldstrue
if this instance represents information that is definitely tainted across all execution paths.- Returns:
true
if that condition holds
-
isPossiblyTainted
public abstract boolean isPossiblyTainted()
Yieldstrue
if this instance represents information that is definitely tainted in at least one execution path.- Returns:
true
if that condition holds
-
isAlwaysClean
public boolean isAlwaysClean()
Yieldstrue
if this instance represents information that is definitely clean across all execution paths. By default, this method returnstrue
if this is not the bottom instance andisPossiblyTainted()
returnsfalse
.- Returns:
true
if that condition holds
-
isPossiblyClean
public boolean isPossiblyClean()
Yieldstrue
if this instance represents information that is definitely clean in at least one execution path. By default, this method returnstrue
ifisAlwaysTainted()
returnsfalse
.- Returns:
true
if that condition holds
-
defaultApprox
protected T defaultApprox(it.unive.lisa.symbolic.value.Identifier id, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle) throws it.unive.lisa.analysis.SemanticException
Default approximation forIdentifier
s. This method returns the same asNonRelationalElement.fixedVariable(Identifier, ProgramPoint, SemanticOracle)
if the given identifier has no annotations. Otherwise, it relies on the presence ifTAINTED_ANNOTATION
andCLEAN_ANNOTATION
to produce abstract values. defaulting to bottom.
If this method does not return bottom, it is used as return value for bothfixedVariable(Identifier, ProgramPoint, SemanticOracle)
andevalIdentifier(Identifier, ValueEnvironment, ProgramPoint, SemanticOracle)
.- Parameters:
id
- the identifier to evaluatepp
- the program point where the evaluation happensoracle
- the oracle for inter-domain communication- Returns:
- a fixed approximation for the given variable, if any
- Throws:
it.unive.lisa.analysis.SemanticException
- if an exception happens during the evaluation
-
fixedVariable
public T fixedVariable(it.unive.lisa.symbolic.value.Identifier id, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle) throws it.unive.lisa.analysis.SemanticException
- Specified by:
fixedVariable
in interfaceit.unive.lisa.analysis.nonrelational.NonRelationalElement<T extends BaseTaint<T>,it.unive.lisa.symbolic.value.ValueExpression,it.unive.lisa.analysis.nonrelational.value.ValueEnvironment<T extends BaseTaint<T>>>
- Throws:
it.unive.lisa.analysis.SemanticException
-
evalIdentifier
public T evalIdentifier(it.unive.lisa.symbolic.value.Identifier id, it.unive.lisa.analysis.nonrelational.value.ValueEnvironment<T> environment, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle) throws it.unive.lisa.analysis.SemanticException
-
evalPushAny
public T evalPushAny(it.unive.lisa.symbolic.value.PushAny pushAny, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle) throws it.unive.lisa.analysis.SemanticException
-
evalNullConstant
public T evalNullConstant(it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle) throws it.unive.lisa.analysis.SemanticException
-
evalNonNullConstant
public T evalNonNullConstant(it.unive.lisa.symbolic.value.Constant constant, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle) throws it.unive.lisa.analysis.SemanticException
-
evalUnaryExpression
public T evalUnaryExpression(it.unive.lisa.symbolic.value.operator.unary.UnaryOperator operator, T arg, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle) throws it.unive.lisa.analysis.SemanticException
-
evalBinaryExpression
public T evalBinaryExpression(it.unive.lisa.symbolic.value.operator.binary.BinaryOperator operator, T left, T right, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle) throws it.unive.lisa.analysis.SemanticException
-
evalTernaryExpression
public T evalTernaryExpression(it.unive.lisa.symbolic.value.operator.ternary.TernaryOperator operator, T left, T middle, T right, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle) throws it.unive.lisa.analysis.SemanticException
-
evalTypeCast
public T evalTypeCast(it.unive.lisa.symbolic.value.BinaryExpression cast, T left, T right, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle) throws it.unive.lisa.analysis.SemanticException
-
evalTypeConv
public T evalTypeConv(it.unive.lisa.symbolic.value.BinaryExpression conv, T left, T right, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle) throws it.unive.lisa.analysis.SemanticException
-
satisfies
public it.unive.lisa.analysis.lattices.Satisfiability satisfies(it.unive.lisa.symbolic.value.ValueExpression expression, it.unive.lisa.analysis.nonrelational.value.ValueEnvironment<T> environment, it.unive.lisa.program.cfg.ProgramPoint pp, it.unive.lisa.analysis.SemanticOracle oracle) throws it.unive.lisa.analysis.SemanticException
- Specified by:
satisfies
in interfaceit.unive.lisa.analysis.nonrelational.value.BaseNonRelationalValueDomain<T extends BaseTaint<T>>
- Specified by:
satisfies
in interfaceit.unive.lisa.analysis.nonrelational.NonRelationalElement<T extends BaseTaint<T>,it.unive.lisa.symbolic.value.ValueExpression,it.unive.lisa.analysis.nonrelational.value.ValueEnvironment<T extends BaseTaint<T>>>
- Throws:
it.unive.lisa.analysis.SemanticException
-
assume
public it.unive.lisa.analysis.nonrelational.value.ValueEnvironment<T> assume(it.unive.lisa.analysis.nonrelational.value.ValueEnvironment<T> environment, it.unive.lisa.symbolic.value.ValueExpression expression, it.unive.lisa.program.cfg.ProgramPoint src, it.unive.lisa.program.cfg.ProgramPoint dest, it.unive.lisa.analysis.SemanticOracle oracle) throws it.unive.lisa.analysis.SemanticException
- Specified by:
assume
in interfaceit.unive.lisa.analysis.nonrelational.value.BaseNonRelationalValueDomain<T extends BaseTaint<T>>
- Specified by:
assume
in interfaceit.unive.lisa.analysis.nonrelational.NonRelationalElement<T extends BaseTaint<T>,it.unive.lisa.symbolic.value.ValueExpression,it.unive.lisa.analysis.nonrelational.value.ValueEnvironment<T extends BaseTaint<T>>>
- Throws:
it.unive.lisa.analysis.SemanticException
-
-